[R] Basic Help
Andy Bunn
abunn at montana.edu
Thu Feb 12 21:36:21 CET 2004
Marisa,
If the examples in R Data Import/Export can't help you you'll have to be
way way way more specific.
http://cran.r-project.org/doc/manuals/R-data.pdf
I'm assuming you are using windows. Here's an example. Try saving the
attached file to c:\temp and copying the commands below into R. This
file junk.csv is a text file where each value is seperated by a comma.
You can open it in Excel or with a text editor like notepad. Try looking
at it with both. In windows it's often easiest to get you data from
excel to R by saving it as a comma seperated file (.csv) from excel.
Good luck, Andy
#### Start copy and paste
# Set the working directory so R knows where your files are
setwd("c:/temp")
# Read the data (see read.csv for comma seperated files too)
some.data <- read.table(file = "junk.csv", header = T, sep = ",")
# Now try some things with this data
some.data
summary(some.data)
attach(some.data)
a.model <- lm(Y ~ X1 + X2)
detach(some.data)
summary(a.model)
# now look at the help pages for these commands
?read.table
?setwd
?lm
?summary
?attach
?detach
#### End copy and paste
Here's a copy of the attached file junk.csv which probably won't make it
to the R-Help list.
ID,Y,X1,X2,X3
1,2,2,75,645
2,5,6,35,8
3,73,2,754,323
4,8,7,26,76
5,3,21,6,25
More information about the R-help
mailing list