Here is something I couldn't figure out - when using as.numeric() to change the type of variables, which all are character, only a few of them did change but not all of them. below were the codes and results
final1<- within(final1, Bother <- as.numeric(Bother),
concentration <- as.numeric(concentration),
Depressed <- as.numeric(Depressed),
Effort <- as.numeric(Effort),
Happy <- as.numeric(Happy),
Lonely <- as.numeric(Lonely),
only Bother, Effort, Fearful, and Happy did change, but the rest of them did not.
Thanks in advance for help!
Check whether the variables that don't change all have valid numbers.
thanks, it seems not related to that.
Can you provide a reproducible example of the dataset?
The problem has been fixed now with using the following function
data[,'variable'] <- as.numeric(data[,'variable'])
Thanks for everyone support!
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.