[R] help with R
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Wed Jan 9 23:11:49 CET 2008
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?
>
>
Ideally, you shouldn't really start from there (because transfer of data
between different applications is not for beginners -- it is better to
have your data in a text file with a well-defined format), but let's try:
a) Open the spreadsheet. Make sure that the 1st element of each column
has the name of the variable. Let us assume that the 2 relevant ones are
called "x" and "y". Highlight the relevant region and copy to clipboard.
b) In R type
mydata <- read.delim2("clipboard")
names(y)
plot(y~x, data=mydata)
summary(lm(y~x, data=mydata))
This assumes that you are using a German locale (comma is decimal
separator), otherwise use read.delim("clipboard").
> (2) Where do I get to see the complete library of packages offered by R?
> In particular, I am interested in quantile regression and logistic
> regression.
>
> Thanks.
>
> Sitadri
>
>
--
O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list