I tried loading the baseball statistics from this link. When I read it from the file using
data <- read.csv("MLB2011.csv")
it seems to be reading all fields as factor values. I tried dropping those factor values by doing:
read.csv("MLB2011.xls", as.is= FALSE)
.. but it looks like the values are still being read as factors. What can I do to have them loaded as simple character values and not factors?
You aren’t reading a
csvfile, it is an excel spreadsheet (.xls format). It contains two worksheetsbat2011andpitch2011You could use the
XLConnectlibrary to read thisreadWorksheethas an argumentcolTypewhich you could use to specify the column types.Edit
If you have already saved the sheets as csv files then
as.is = TRUEorstringsAsFactors = FALSEwill be the correct argument values