[R] Getting started with R
Warnes, Gregory R
gregory_r_warnes at groton.pfizer.com
Tue Jan 15 21:15:54 CET 2002
> -----Original Message-----
> From: Jay Pfaffman [mailto:pfaffman at relaxpc.com]
> Sent: Tuesday, January 15, 2002 12:35 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Getting started with R
> [...]
> What I'd like is a cookbook of a few basic procedures. I think I'm
> more interested in the R code than I am statistical explication,
> though I don't object to the latter. Is Venables and Ripley "MASS"
> going to do that for me or would "S Programming" be more
> appropriate?
Have you looked at http://cran.r-project.org/doc/manuals/R-intro.pdf ?
> [...]
> In a perception study, I've got three within-subject
> conditions, A, B,
> and C. Each condition has 4 trials with 2 times and an angle
> (actually an error measurement between the actual angle and the one
> the subjects pointed to). All I want is to get the stuff that
> summary() gives split out by condition. It might also be nice to
> split it out between subjects as well to look at, and
> possibly correct
> for individual differences, (which might be difficult with so few
> trials?). My data columns are as follows:
>
> A B C (with 0 or 1 to indicate condition, would a single column with
> 1-3 be better?)
It is probably easier to deal with a single 'factor' variable with three
levels 'A','B', and 'C'.
>
> t1, t2, angle-error
>
> Surely fewer than 10 lines of R could yield me these
> results and maybe
> a couple pretty graphs.
>
If you create a data file named myfile.csv containing :
Condition,t1,t2,angle.error
A, 10, 12, 30
B, 12, 6, 15
C, 9, 16, 0
...
you can read it in using
> mydata <- read.csv("myfile.csv")
Then to get summaries of each of the variables separated by conditions do
something like
> by(mydata, mydata$Condition, summary)
Some plots:
> plot(t1 ~ Condition, data=mydata)
> plot(t2 ~ Condition, data=mydata)
> plot(angle ~ Condition, data=mydata)
Run a regression model testing if t1 depends on condition:
> summary(lm(t2 ~ Condition, data=mydata))
> In another study where I'm looking at motivation and
> hobbies, which I
> have almost no idea how to analyze (which suggests I might
> have chosen
> a bad design & that a problem like this probably doesn't
> belong in my
> "cookbook") I've had people rank a set of 25
> characteristics of their
> activities or motivations (5 in each of 5 categories) and would like
> to see if any patterns are emerging there. My data start out as an
> ordered list of these cards (1-25); I futzed in a spreadsheet to get
> two columns, the motivation number and its rank. If I could avoid
> using the spreadsheet, that'd be nice.
You would need to give quite a bit more information before one could suggest
a reasonable method of anlyzing this data. Still, it seems that the easiest
format to handle the data for statistical analysis would be one row per
participant, with one variable (column) for each activity or motivation.
-Greg
>
> Thanks.
>
> --
> Jay Pfaffman pfaffman at relaxpc.com
> +1-415-821-7507 (H) +1-415-810-2238 (M)
> http://relax.ltc.vanderbilt.edu/~pfaffman/
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
> -.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read
http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._
LEGAL NOTICE
Unless expressly stated otherwise, this message is confidential and may be privileged. It is intended for the addressee(s) only. Access to this E-mail by anyone else is unauthorized. If you are not an addressee, any disclosure or copying of the contents of this E-mail or any action taken (or not taken) in reliance on it is unauthorized and may be unlawful. If you are not an addressee, please inform the sender immediately.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list