0

I have a data set comprising of columns:Name, engine , power and seats etc

columns of Name,Engine and power have some missing values and NA'S

Based on the name i want to fill those values

can any one suggest the write syntax to do it

    Name        |  seats
BMW X1 sDrive   |     5
BMW X3          |     5
BMW X6          |     5
BMW 5 Series    |     NA
BMW 3 Series    |     NA
Honda City 1.5  |     5
Honda City ZX   |     5
Honda City i VTEC  |  5
Honda City i DTEC  | NA

Like this there are about 200 model names , based on their names i wanted to group them by name and fill the NA values .

i have tried

usedcars1 <- usedcars%>%  
             group_by(Name) %>%
             mutate_at(c("Seats"), funs(ifelse(is.na(.), median(., na.rm = TRUE),.)))

But it is creating additional columns of same , i am confused suggest any best command to deal with it

Sotos
  • 47,396
  • 5
  • 31
  • 61

0 Answers0