Skip to content
Prev 13677 / 15075 Next

Unable to change some members of a vector

This question is not related to Macs, but here is the answer anyway.

First up, anyone who uses R should understand what a factor is. Find an introductory text on R and read the section on factors. Even better, read the whole book.  It seems that it has been decided that R will not automatically add a factor level, which is probably a good idea.

There is an option in the read.table command of stringsAsFactors. You can set it to FALSE to obtain character strings. You can also convert the factor to character using as.character().

If Excel decides to put strange characters into your data file then that is Excel?s problem. I suggest looking at the file with a text editor. The free version of BBEdit will work fine. You can read Excel files directly using teh readxl package.

Ken