Reputation: 5051
Hi I am trying to load a dataset that I downloaded from this link: https://docs.google.com/spreadsheet/ccc?key=0AkY2lFgS9uiDdDdxazdLMnUwalpyMjc0UlY1U2p4cnc#gid=0
I downloaded it into my C drive in this location C:/CDA drive as popular.tsv
I am trying to read it into a dataframe. I use both source and load and I get an error in both of them.
>present=source("C://CDA//popular.tsv")
Error in source("C://CDA//popular.tsv") :
C://CDA//popular.tsv:1:9: unexpected symbol
1: gender grade
^
> present=load("C://CDA//popular.tsv")
Error: bad restore file magic number (file may be corrupted) -- no data loaded
In addition: Warning message:
file ‘popular.tsv’ has magic number 'gende'
Use of save versions prior to 2 is deprecated
>present=read.table("C://CDA//popular.tsv")
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
line 23 did not have 11 elements
Please help! Thanks
Upvotes: 0
Views: 2426
Reputation: 193687
You are using the wrong functions to read the data in.
load
is for data files which have been saved using R's saved objects (usually files ending with ".Rdata" or ".rda"). source
is generally used to read files or connections containing R scripts.
You should try read.table
and family. Since this is a tab separated file, you can use:
read.delim("C://CDA//popular.tsv")
## ^^ is the same as `read.table(..., header = TRUE, sep = "\t")
## see ?read.table for more details
Upvotes: 1