[R-SIG-Mac] Unable to change some members of a vector

Parkhurst, David F. p@rkhur@ @end|ng |rom |nd|@n@@edu
Sat Feb 13 23:54:07 CET 2021


I have a problem I don’t know how to deal with.  I’ve used read.table to create the data frame called msPdf.  It contains three vectors:  month, site, conc.  Some of the site values look like this:  MLH\xca.  I was able to change that with this command: msPdf$site[13]="MLH”.  That seems to have been allowed because some of the other sites are simply MLH.  But the system won’t let me make the same kind of change in another case:
 msPdf$site[29]="MUH”.  When I ask for that, I get 
Warning message:
In `[<-.factor`(`*tmp*`, 29, value = c(5L, 2L, 1L, 11L, 5L, 12L,  :
  invalid factor level, NA generated
> #13  May MLH\xca 0.007
Then if I enter msPdf$site[29], I get this response:
[1] <NA>
Levels: CrCr LMO MCE MCH MFSC MLE MLH MLH\xca MUE MUH\xca NFSC SFSC

In other words, although other sites that were just plain MLH, there were not other sites that were just plain MUH.
How can I fix this problem?  I have no idea why excel added those \xca bits to a few of the site values.



More information about the R-SIG-Mac mailing list