I am having trouble converting the columns of 2 data frames in a list to numeric. Right now both data frames have 2 columns consisting of factors. I want to convert them to nu
You need to use lapply. do a str
on "b"
str(b)
This will let you know you have a list of 2 of 2 data.frames.
So you need to use lapply along with sapply, to preserve the data structure
lapply(b, function(x) sapply(x, function(x) as.numeric(as.character(x))))
You have D/N in your factor, which will be converted to NAs and also the list entries that are blank/empty