0
votes

I have a dataframe, WB. On WB I'm using dplyr's mutate() and ifelse() to convert ".." values to the values from adjacent variables.

The solution I've come to is,

mutate(WB, Rents2 = ifelse(Rents == "..", `X2014..YR2014.`, Rents)))

which produces this output: https://i.stack.imgur.com/7GFg5.png

Why does Rents2 return large values instead of the 2014 variable data?

1
Please provide your actual data and output rather than a picture.BLT
None of your variables are numeric. I would guess they are all factors. You should reconsider your data import to force anything that is ".." to NABenjamin

1 Answers

0
votes

Original data was comprised of all factors. Data provider's fields were non-numeric. Solution is to convert data to numeric.