Displaying 1 result from an estimated 1 matches for "goatsmilk".
Did you mean:
goatmilk
2009 Jul 22
3
How to replace NAs in a vector of factors?
...s been quite perplexing, thanks for any help
## Here's the example:
db1=data.frame(
olditems=c('soup','','','','nuts'),
prices=c(4.45, 3.25, 4.42, 2.25, 3.98))
db2=data.frame(
newitems=c('stew','crackers','tofu','goatsmilk','peanuts'))
str(db1) #factors and prices
str(db2) #new names, but I want *only* the updates
is.na(db1$olditems) #a little surprising that '' is not equal to NA
db1$olditems=='' #oh good, at least I can get to the blanks this way
db1$olditems[db1$olditems==&...