1

I load a file into R . The data goes from negative values to big positive values. The negative values are imported with " " around them (see below). $ Value : Factor w/ 11961 levels "-1.25","-102.34",..: 6541 If I change the type of the data to numeric, I now get a list of values from 1 to 11961 (the number of observations) in that column.

I ran the following script as.numeric(as.character(PMData8$Value)). It shows the data as it as numerics after running it but when I do a str(PMData8) again, I still see the data with " " around some of the data i.e. the negative data. Why is that ?

Renee
  • 31
  • 4
  • 1
    Did you run this? PMData8$Value<-as.numeric(as.character(PMData8$Value)) – Dave2e Apr 07 '16 at 19:55
  • Hi there . No only as "as.numeric(as.character(PMData8$Value))". "PMData8$Value<-as.numeric(as.character(PMData8$Value))" does not work. it only shows a + in the next line and nothing is executed. – Renee Apr 08 '16 at 12:23
  • Running only "as.numeric(as.character(PMData8$Value))" just outputs the results and does not update the original variable, thus is why one has to reassign "<-" the results back to the original variable. The + sign most likely means you missed a closing ). – Dave2e Apr 08 '16 at 12:44

0 Answers0