I have a dada frame this is a small part:
namess[270:285,]
first_name last_name
270 R Horne
271 T H
272 A McEvoy
273 Aumoitte <NA>
274 Johin <NA>
275 Waydelick <NA>
276 Vigneron <NA>
277 Sautereau <NA>
278 Johin <NA>
279 Aumoitte <NA>
280 Georges Taillandier
281 Fernand Sanz
282 John Lake
283 Louis Bastien
284 Louis Hildebrand
285 Daumain <NA>
I would like to replace every NA value in the column named last_name with the value in the column first_name. I saw a similar post in this is the link
Replace NA in column with value in adjacent column
I tried using what they suggeted
namess$last_name[is.na(namess$last_name)] <- as.character(namess$last_name[is.na(namess$last_name)])
It didn't change anything, both of the columns are character type so its not a problem of being a factor type variable