Re: [R] help with R

From: Roland Rau <roland.rproject_at_gmail.com>
Date: Wed, 09 Jan 2008 17:10:10 -0500

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



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. Received on Wed 09 Jan 2008 - 22:12:55 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 09 Jan 2008 - 22:30:05 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive