[R] Importing all observations and variables from csv file into dataframe

jim holtman jholtman at gmail.com
Mon Oct 17 21:09:02 CEST 2011


I would assume that you would use 'read.csv'.  I don't know where you
got the syntax for "summary";

x <- read.csv(("C:\\Documents\\R_dfiles\\H_N_T.csv",as.is=TRUE)
summary(x)

On Mon, Oct 17, 2011 at 2:56 PM, Sally Ann Sims <sallysims at earthlink.net> wrote:
> Hello,
>
> I need some help getting started with data analysis.  I’m having trouble getting R to read my data file.  I’ve referred to various R help documentation, the website, and FAQs, but I don’t see my situation listed.
>
> I saved an Excel file (post-2007 Excel version) of data as a “.csv” file.  However, the file still appears in column format when I open it.  Does that happen when you save a an Excel file in .csv format?  I have used the function file.choose() to pull in the file into R.  When I use the summary command I get:
>
> summary("C:\\Documents\\R_dfiles\\H_N_T.csv",header=TRUE,as.is=TRUE)
>   Length     Class      Mode
>        1 character character
> But the data table actually has five columns and 1000 rows (example of first two lines):
>
>      OBJECTID X Y elev HB_NHB
>      1 265712.1 90770.42 7.6372 0
>
>
> When I look at the .csv file, I see that the OBJECTID cell is selected so I think R is just reading the one cell as my data.  How can I get R to read the all the data rows and columns?  Is there a way to clear the one-cell selection status?  Or perhaps there is another issue that needs addressing.  I would like to get this data table configured into R as a dataframe.
>
> Thank you,
> Sally
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at r-project.org 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.
>
>



-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?



More information about the R-help mailing list