[R] help with R

Roland Rau roland.rproject at gmail.com
Wed Jan 9 23:10:10 CET 2008


Hi,

please have a look at the posting guide (link is at the bottom of your 
message). Most (if not all) of your problems should be solved if you 
follow the advice given there.
Anyway, please have a look below:

Sitadri_Bagchi at swissre.com wrote:
>  Folks, Two simple questions :
> 
> (1) I have a data set (call it data.xls) in a folder in my hard drive. How 
> do I perform a simple regression between two variables from that data set? 
>  After I click on 'R', what exactly do I type in?

1.1 getting excel data into R
- please read the manual R Data Import/Export shipped with your R 
distribution or browse online, for example, at 
http://cran.r-project.org/doc/manuals/R-data.html in particular 
http://cran.r-project.org/doc/manuals/R-data.html#Reading-Excel-spreadsheets
- I prefer to use rather CSV files which can be easily read by R using 
read.table()
1.2 simple regression
- function lm() is your friend
- furthermore have a look at "An Introduction to R", in particular 
Section 11.2 
http://cran.r-project.org/doc/manuals/R-intro.html#Linear-models

Maybe this code gets you started (not tested, modify according to your 
application):
mydata <- read.table("C:\\mypath\\tomyfile\\data.csv", header=TRUE, sep=",")
mymodel1 <- lm(mydata$Y ~ mydata$X)
mymodel1
summary(mymodel1)



> 
> (2) Where do I get to see the complete library of packages offered by R? 
One possibility is http://stat.ethz.ch/CRAN/src/contrib/PACKAGES.html


> In particular, I am interested in quantile regression and logistic 
> regression.
- There is a package called quantreg written by Roger Koenker.
- Logistic regression: check the function glm()

Hope this helps you to get started,
Roland



> 
> ______________________________________________
> 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.
>




More information about the R-help mailing list