[R] Importing a CSV file
Andrew Robinson
A.Robinson at ms.unimelb.edu.au
Tue Apr 24 03:57:50 CEST 2007
Hi Bill,
here's what's going on. R needs you to provide an object name for the
imported data. so,
niwage <- read.csv("niwage.csv", header = TRUE)
should do the trick.
Andrew
On Mon, Apr 23, 2007 at 09:18:01PM -0400, William Mabe wrote:
> 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
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Andrew Robinson
Department of Mathematics and Statistics Tel: +61-3-8344-9763
University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599
http://www.ms.unimelb.edu.au/~andrewpr
http://blogs.mbs.edu/fishing-in-the-bay/
More information about the R-help
mailing list