0

Since I'm not able to find/decipher solutions to my problem I'll try asking.

Up until now I've only worked with other people's data (.csv files) in RStudio but this time around it's my own data, which I entered into Excel. All entries are tab-delimited, and I wouldn't enter data into Excel any other way. After some googling it seems like R and .xlsx files aren't best friends, so I saved my file in various other formats, .csv one of them. Thus I have tab-delimited .csv file.

The problem with loading tab-delimited .csv files also features here, but my problem is not with "reading some of the numeric variables in as factors" (whatever that means), but that data is loaded as semi-colon separated in R:

data <- read.table(file.choose(), sep="\t", header=T)
View(data)

Date.Miles.Time
2015-08-10;5;45

Apart from improper formatting there are 29 observations rather than 24; the last five entries are just ;;. Again, my problem is not the same as in the link but I figure there's no harm in trying Justin's suggestion in the answer, i.e. options(stringsAsFactors=FALSE) and then running the above again, but it achieves nothing.

read.csv() and read.delim() yield the same result. Any suggestions?

Community
  • 1
  • 1
Erik Vesterlund
  • 481
  • 6
  • 19
  • 7
    It sure looks like your data is semi-colon delimited. I would suggest having a look at it in a text editor to confirm that it really is tab deimited, or try changing the read command to sep=";" – heathobrien Aug 10 '15 at 15:21
  • you could try with `fread()` from the `data.table` package – erasmortg Aug 10 '15 at 15:24
  • 1
    I would use the package readxl built by Hadley Wickham. It reads the data straight from excel without the need for rjava and java that other packages like xlconnect or xlsx need. – phiver Aug 10 '15 at 15:25
  • @heathobrien The output in RStudio is semi-colon delimited, the Excel file isn't, unless the tab key generates an invisible semi-colon. Edit: Apparently it does! Weird... thanks! – Erik Vesterlund Aug 10 '15 at 15:35

0 Answers0