Reputation: 1039
I have downloaded the package SemiPar and I have been trying to attach the dataset fuel.frame, using the command data(fuel.frame), but without sucess. The error I have been getting is:
Error in read.table(zfile, header = TRUE, as.is = FALSE) :
more columns than column names
In addition: Warning messages:
1: In read.table(zfile, header = TRUE, as.is = FALSE) :
line 1 appears to contain embedded nulls
2: In read.table(zfile, header = TRUE, as.is = FALSE) :
line 5 appears to contain embedded nulls
3: In read.table(zfile, header = TRUE, as.is = FALSE) :
incomplete final line found by readTableHeader on 'C:/...
Could you please tell me what is wrong here? I have tried to look for solutions online but it seems the package works for everyone besides myself.
My sessionInfo()
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] SemiPar_1.0-4.1
loaded via a namespace (and not attached):
[1] cluster_1.15.3 grid_3.1.1 lattice_0.20-29 MASS_7.3-33 nlme_3.1-117
[6] tools_3.1.1
Thank you.
Upvotes: 1
Views: 570
Reputation: 263301
The "fuel.frame" file is actually in the ../SemiPar/data/ directory wherever your library is. You can use the .libPaths()
function. For me it returns:
> .libPaths()
[1] "/Library/Frameworks/R.framework/Versions/3.1/Resources/library"
If you look in there you should see "fuel.frame.txt.gz" which tells you that it's a gzipped file that will expand to a text file (which is what the data()
call is doing before passing it to read.table()
). The top of it looks like:
car.name Weight Disp. Mileage Fuel Type
"Eagle Summit 4" 2560 97 33 3.030303 Small
"Ford Escort 4" 2345 114 33 3.030303 Small
"Ford Festiva 4" 1845 81 37 2.702703 Small
"Honda Civic 4" 2260 91 32 3.125000 Small
"Mazda Protege 4" 2440 113 32 3.125000 Small
"Mercury Tracer 4" 2285 97 26 3.846154 Small
"Nissan Sentra 4" 2275 97 33 3.030303 Small
"Pontiac LeMans 4" 2350 98 28 3.571429 Small
As you can see your error message is not correct about my copy. So you may want to use your unnamed system to expand the .gz file and investigate. (I was not getting an error with my R 3.1.1 (SnowLeopard build) running in OSX 10.7.5.) With my setup this also succeeds:
data('fuel.frame',
lib.loc='/Library/Frameworks/R.framework/Versions/3.1/Resources/library/')
Upvotes: 4