[R] Importing a CSV file

William Mabe billmabe at rci.rutgers.edu
Tue Apr 24 03:18:01 CEST 2007


Hi,

I'm trying to load .csv file into R (3790 by 30).  I'm having an odd 
difficulty. After I type:

read.csv("niwage.csv", header = TRUE)

the data appears on the screen.  The last thirty or so observations appear 
on the screen and they have been read in correctly.

However, when I type:

dim(data)

I see:

NULL

This seems odd to me--R seems to be recognizing the data but not storing 
it.  I didn't come across any mention of this in the "R Data Import/Export 
Manual", FAQs, prior questions that I thought addressed this issue.

(If this info would help: The csv file was created from a Stata file using 
the outsheet command.  When I tried to use library(foreign) to import the 
data directly from Stata, using:

stata.data <- read.dta("niwage.dta")
load("niwage.RData")

I got the following:

Error in readChar(con, 5) : cannot open the connection In addition: 
Warning message: cannot open compressed file 'niwage.RData'
)

I'd greatly appreciate any help anyone could offer on my problem.

Thanks,
Bill


**************************************************************************
William F. Mabe, Jr., PhD
Project Director
Heldrich Center for Workforce Development
33 Livingston Ave., 5th floor
Rutgers University
New Brunswick, NJ 08901
(732)932-4100 ext.530



More information about the R-help mailing list