Skip to content
Prev 14907 / 20628 Next

Managing person identifier variable

Margaret,

How are you reading the data into R? Are you using read.table() or read.csv()?

If so, see ?read.table and note the 'colClasses' argument. 

If that argument is the default NA, ?type.convert will be used to convert the columns in the incoming data from the character based source to numeric, etc. as apropos.

If you explicitly define colClasses for each column, you can set the persID column to "character" and it will not be coerced to numeric by default.

Some of these issues are covered in the R Data Import/Export manual in the section on Spreadsheet-like data:

  https://cran.r-project.org/doc/manuals/r-release/R-data.html#Variations-on-read_002etable <https://cran.r-project.org/doc/manuals/r-release/R-data.html#Variations-on-read_002etable>


Regards,

Marc Schwartz