So I have a very large dataset, which I'm trying to look at in R, with most of the columns having words in them.
I want to turn this character data into meaningful values that I can preform calculations on.
So I sub values for numeric data for example:
mydataset<-sub("Least Concern",1, mydataset)
All the numbers are between 1-7.
I then checked that all my sub values are what I expected and they are.
I then convert it to a dataframe and then convert each column like so:
asnumbers["currentstatus"]<-(as.numeric(asnumbers$currentstatus))
but then when I view mydataset
, the numbers aren't what they should be, they've changed by 1 or 2. And I can't see consistency, like sometimes a 1 will become a 2 and sometimes it wont. I'm confused.
Any suggestions?