[R] How to read 20 columns from the file

Jim Lemon jim at bitwrit.com.au
Wed Jul 13 14:00:29 CEST 2011


On 07/13/2011 08:16 PM, Kishore Kumar wrote:
> Dear Steven,
>            Many thanks for your reply. I am struggling to read the all the
> values. I have 20 columns for 200 rows in my excel sheet, which i want to
> read for plotting. Please let me know how to load or import or read those
> columns.
>
Hi Kishore,
Starting with your spreadsheet in Excel:

File - Save As
Click on the "File type" drop down list and select "CSV"
Save the file as "xlss.csv"
Click on OK and note where the file is saved

 From R:

setwd(to where the file was saved)
# if the uppermost row had labels for the columns
df20<-read.csv("xlss.csv")
# if the uppermost row was not labels
df20<-read.csv("xlss.csv",header=FALSE)

You should now have a 200x20 data frame named "df20".

Jim



More information about the R-help mailing list