Dear friends, are there enough R users in Cyprus to form a club?
jason
Dr. Iasonas Lamprianou
Department of Education
The University of Manchester
Oxford Road, Manchester M13 9PL, UK
Tel. 0044 161 275 3485
iasonas.lamprianou at manchester.ac.uk
----- Original Message ----
From: "r-help-request at r-project.org" <r-help-request at
r-project.org>
To: r-help at r-project.org
Sent: Thursday, 22 November, 2007 1:00:03 PM
Subject: R-help Digest, Vol 57, Issue 22
Send R-help mailing list submissions to
r-help at r-project.org
To subscribe or unsubscribe via the World Wide Web, visit
https://stat.ethz.ch/mailman/listinfo/r-help
or, via email, send a message with subject or body 'help' to
r-help-request at r-project.org
You can reach the person managing the list at
r-help-owner at r-project.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of R-help digest..."
Today's Topics:
1. Re: shrink a dataframe for plotting (Alex Brown)
2. NA values (Eleni Christodoulou)
3. Re: NA values (Gabor Csardi)
4. Re: NA values (Jared O'Connell)
5. normalised Voigt random numbers (Waterman, DG (David))
6. Odp: ave and sd (Petr PIKAL)
7. Re: NA values ( (Ted Harding))
8. R as server application (Kilian Schwab)
9. question about multiple comparison in ANOVA (Qiu Anqi)
10. Re: NA values (Eleni Christodoulou)
11. uniq -c (Alexy Khrabrov)
12. Re: display basename (mysimbaa)
13. multiple comparison (glht) problem (Anqi Qiu)
14. Re: uniq -c (Marc Schwartz)
15. Re: uniq -c (Henrique Dallazuanna)
16. Re: R as server application (Scionforbai)
17. Re: multiple comparison (glht) problem (Chuck Cleland)
18. Re: Logarithmic axis -- now in new version of 'sfsmisc'
(Martin Maechler)
19. Re: R as server application (Henrik Bengtsson)
20. Re: R as server application (Henrik Bengtsson)
21. Reconstruct array dataset (marcg)
22. Re: biocep project (R for the Web and the Virtual R
Workbench) (elw at stderr.org)
23. Packages - a great resource, but hard to find the right one.
(John Sorkin)
24. Re: plotting coxph results using survfit() function
(Terry Therneau)
25. Re: Packages - a great resource, but hard to find the right
one. (Gabor Csardi)
26. Re: Packages - a great resource, but hard to find the right
one. (John Sorkin)
27. Re: Reconstruct array dataset (marcg)
28. Changing axis scale (mysimbaa)
29. Re: Changing axis scale (aaront)
30. Re: Changing axis scale (aaront)
31. Re: Packages - a great resource, but hard to find the right
one. (Prof Brian Ripley)
32. Re: Packages - a great resource, but hard to find theright
one. (Ken Knoblauch)
33. Re: any measure for curvature (Bartjoosen)
34. Frailty (David)
35. randomForest() question (Peter Tait)
36. Help Required (Kushal M Shah)
37. Re: Packages - a great resource, but hard to find the right
one. (Gavin Simpson)
38. t.test : extracting Error (mogra)
39. Re: Packages - a great resource, but hard to find the right
one. (Christos Hatzis)
40. Re: Reconstruct array dataset (John Kane)
41. Re: shrink a dataframe for plotting (jim holtman)
42. Re: Help Required (jim holtman)
43. Help Required in using cast (reshape package) function
(Punit Anand)
44. better curve (mysimbaa)
45. better curve (mysimbaa)
46. better curve (mysimbaa)
47. Re: How do I import packages with the package I've built?
(Uwe Ligges)
48. Re: question about multiple comparison in ANOVA (Mark Wardle)
49. Re: Help Required in using cast (reshape package) function
(Punit Anand)
50. Re: t.test : extracting Error (Uwe Ligges)
51. Re: Packages - a great resource, but hard to find the right
one. (Mike Prager)
52. Choosing the right model (Marc Bernard)
53. Re: Help Required in using cast (reshape package) function
(hadley wickham)
54. Re: uniq -c (Charles C. Berry)
55. Re: better curve (Julian Burgos)
56. Re: Reconstruct array dataset (Julian Burgos)
57. matrix elementwise average with NA's (Gregory Gentlemen)
58. ggplot2 axis labels (Felipe Carrillo)
59. Re: matrix elementwise average with NA's (Matthew Keller)
60. Re: Changing axis scale (Greg Snow)
61. Re: matrix elementwise average with NA's (Marc Schwartz)
62. fitting a line to a logaritmic plot (Joren Heit)
63. How can I save a plot ? (Maura E Monville)
64. Re: ggplot2 axis labels (hadley wickham)
65. R 2.6.0 Error in X11() : could not find X11 fonts (Correia, James)
66. Different freq returned by spec.ar() and spec.pgram()
(Eric Thompson)
67. Re: How can I save a plot ? (Bert Gunter)
68. Re: Different freq returned by spec.ar() and spec.pgram()
(Prof Brian Ripley)
69. Re: Frailty (Gad Abraham)
70. survest and survfit.coxph returned different confidence
intervals on estimation of survival probability at 5 year
(Xianqun (Wilson) Wang)
71. Re: How can I save a plot ? (Paulo Justiniano Ribeiro Jr)
72. Vanishing Font Path (Patrick Connolly)
73. Plotting + saving to file on Linux (Maura E Monville)
74. Re: if ( expr ) (Moshe Olshansky)
75. Heatmap problem (affy snp)
76. wujinja at yahoo.com.tw (wujinja at yahoo.com.tw)
77. Re: tapply, mean and subset (Moshe Olshansky)
78. Re: R and reading matlab compressed files (Suresh Krishna)
79. Re: Reg : using two different matrix : how to do t.test
(Moshe Olshansky)
80. Re: Reg : using two different matrix : how to do t.test
(Weiwei Shi)
81. dev.off() (amna khan)
82. Re: Displaying R, N, Z-symbols with expression (David Winsemius)
83. Re: dev.off() (Chung-hong Chan)
84. distance matrix to coordinate format for spatial stats
(Jesse D Lecy)
85. Re: distance matrix to coordinate format for spatial stats
(Prof Brian Ripley)
86. grDevices package (amna khan)
87. Re: Displaying R, N, Z-symbols with expression (Paul Murrell)
88. Naming elements of a list (Thomas L Jones, PhD)
89. Re: Displaying R, N, Z-symbols with expression (David Winsemius)
90. Re: How can I save a plot ? (John Wiedenhoeft)
91. Odp: t.test : extracting Error (Petr PIKAL)
92. Re: Naming elements of a list (Bernardo Rangel Tura)
93. Re: grDevices package (Uwe Ligges)
94. Re: Plotting + saving to file on Linux (peter360)
95. A installation problem that needs your supports.
(PING-SHAN_CHEN at promos.com.tw)
96. instalation problem WXP (Petr PIKAL)
97. Vectorize a correlation matrix (Serguei Kaniovski)
98. Matrix of dummies from a vector (Serguei Kaniovski)
99. Re: Heatmap problem (Jim Lemon)
100. manual parallel processing (jgarcia at ija.csic.es)
101. Re: Matrix of dummies from a vector (Dimitris Rizopoulos)
----------------------------------------------------------------------
Message: 1
Date: Wed, 21 Nov 2007 11:14:21 +0000
From: Alex Brown <alex at transitive.com>
Subject: Re: [R] shrink a dataframe for plotting
To: Thibaut Jombart <jombart at biomserv.univ-lyon1.fr>
Cc: R-help List <r-help at r-project.org>
Message-ID: <E611201E-7B64-4682-9A1E-8EEDCEE55ECA at transitive.com>
Content-Type: text/plain; charset=UTF-8; format=flowed; delsp=yes
For me the largest challenge with such data sets is the extra time
that it takes to develop the appropriate graph, given the time it
takes to plot each prototype. Once I have got the graph scale
decorations etc correct then the time for the final plot is almost
irrelevant.
For this reason I often take a random subset of the data rows using
sample and use this reduced set to develop the graph before switching
to the full dataset.
Since your data are monotonocally decreasing however I suggest that
you take every 100th row instead-this should produce a graph
indistinguishable from the original at that resolution.
-Alex Brown
On 21 Nov 2007, at 10:24, Thibaut Jombart <jombart at biomserv.univ-lyon1.fr
> wrote:
> Alexy Khrabrov wrote:
>
>> I get tables with millions of rows. For plotting to a screen-size
>> jpg, obviously just about 1000 points are enough. Instead of feeding
>> plot() the original millions of rows, I'd rather shrink the
original
>> dataframe, using some kind of the following interpolation:
>>
>> -- split dataframe into chunks of N rows each, e.g. 1000 rows each
>> -- compute average for each column
>> -- issue one new row of those averages into the shrunk result
>>
>> Is there any existing package to do that in R? Otherwise, which R
>> idioms are most effective to achieve that?
>>
>> Cheers,
>> Alexy
>>
>>
>>
>>
> Hi,
>
> if you want to extract relevant information from such a table,
> splitting
> rows in arbitrary chuncks may not solve your problem. Ordinations in
> reduced space are designed for that kind of task, but hierachical
> clustering may also help. See Legendre & Legendre (1998, Numerical
> Ecology, Elsevier) for examples of such methods in Ecology, and the R
> packages ade4, vegan and hclust.
>
> Regards,
>
> Thibaut.
>
> --
> ######################################
> Thibaut JOMBART
> CNRS UMR 5558 - Laboratoire de Biom?trie et Biologie Evolutive
> Universite Lyon 1
> 43 bd du 11 novembre 1918
> 69622 Villeurbanne Cedex
> T?l. : 04.72.43.29.35
> Fax : 04.72.43.13.88
> jombart at biomserv.univ-lyon1.fr
> http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en
> http://pbil.univ-lyon1.fr/software/adegenet/
>
> ______________________________________________
> 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.
------------------------------
Message: 2
Date: Wed, 21 Nov 2007 13:15:32 +0200
From: "Eleni Christodoulou" <elenichri at gmail.com>
Subject: [R] NA values
To: "r-help at r-project.org" <r-help at r-project.org>
Message-ID:
<2293b7660711210315k3c7f1a83v1ed7ff2d3f161adb at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Hi all!
I am new to R and I would like to ask you the following question:How
can I substitute the NA values with 0 in a data frame? I cannot find a
command to check if a value is NA...
Thank you very much!
Eleni
------------------------------
Message: 3
Date: Wed, 21 Nov 2007 12:25:35 +0100
From: Gabor Csardi <csardi at rmki.kfki.hu>
Subject: Re: [R] NA values
To: Eleni Christodoulou <elenichri at gmail.com>
Cc: "r-help at r-project.org" <r-help at r-project.org>
Message-ID: <20071121112535.GF24046 at localdomain>
Content-Type: text/plain; charset=us-ascii
Eleni, this question appears about every month on this list,
try using the RSiteSearch command before posting. Thanks.
RSiteSearch("replace NA")
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/109176.html
Gabor
On Wed, Nov 21, 2007 at 01:15:32PM +0200, Eleni Christodoulou
wrote:> Hi all!
>
> I am new to R and I would like to ask you the following question:How
> can I substitute the NA values with 0 in a data frame? I cannot find a
> command to check if a value is NA...
>
> Thank you very much!
> Eleni
>
> ______________________________________________
> 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.
--
Csardi Gabor <csardi at rmki.kfki.hu> MTA RMKI, ELTE TTK
------------------------------
Message: 4
Date: Wed, 21 Nov 2007 12:25:40 +0100
From: "Jared O'Connell" <jared.oconnell at gmail.com>
Subject: Re: [R] NA values
To: "Eleni Christodoulou" <elenichri at gmail.com>
Cc: "r-help at r-project.org" <r-help at r-project.org>
Message-ID:
<8c464e8f0711210325r220e7111u69126a6296e29e9a at mail.gmail.com>
Content-Type: text/plain
?is.na
On Nov 21, 2007 12:15 PM, Eleni Christodoulou <elenichri at gmail.com>
wrote:
> Hi all!
>
> I am new to R and I would like to ask you the following question:How
> can I substitute the NA values with 0 in a data frame? I cannot find a
> command to check if a value is NA...
>
> Thank you very much!
> Eleni
>
> ______________________________________________
> 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.
>
[[alternative HTML version deleted]]
------------------------------
Message: 5
Date: Wed, 21 Nov 2007 11:42:06 -0000
From: "Waterman, DG \(David\)" <david.waterman at diamond.ac.uk>
Subject: [R] normalised Voigt random numbers
To: <r-help at r-project.org>
Message-ID:
<DC69C90BD4A39249BF59689B2E06427804D54B74 at
exchange33.fed.cclrc.ac.uk>
Content-Type: text/plain; charset="us-ascii"
Dear list,
I would like to generate random numbers from a Voigt distribution,
hopefully in a way as simple as getting random numbers from a normal
distribution with 'rnorm'. Is there any package to do this? Speed is an
issue in this application. Or, as the Voigt distribution is a
convolution of a Gaussian and a Lorentzian, can I simply combine random
numbers from rnorm and rcauchy in some way (I'm not sure about the maths
of this)?
Best wishes,
David.
<DIV><FONT size="1" color="gray">This e-mail and
any attachments may contain confidential, copyright and or privileged material,
and are for the use of the intended addressee only. If you are not the intended
addressee or an authorised recipient of the addressee please notify us of
receipt by returning the e-mail and do not use, copy, retain, distribute or
disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not
necessarily of Diamond Light Source Ltd.
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments
are free from viruses and we cannot accept liability for any damage which you
may sustain as a result of software viruses which may be transmitted in or with
the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and
Wales with its registered office at Diamond House, Harwell Science and
Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
</FONT></DIV>
------------------------------
Message: 6
Date: Wed, 21 Nov 2007 12:59:42 +0100
From: Petr PIKAL <petr.pikal at precheza.cz>
Subject: [R] Odp: ave and sd
To: Patrick Hausmann <c18g at uni-bremen.de>
Cc: r-help at r-project.org
Message-ID:
<OF912463EB.5AFB29F4-ONC125739A.0040F30A-C125739A.0041E265 at
precheza.cz>
Content-Type: text/plain; charset="US-ASCII"
Hi
r-help-bounces at r-project.org napsal dne 21.11.2007 10:45:55:
> Dear list,
>
> I'm still trying to calculate the sd for V2 for
> each group in V1 if V3 is '0':
>
> > x
> V1 V2 V3
> 1 A01 2.40 0
> 2 A01 3.40 1
> 3 A01 2.80 0
> 4 A02 3.20 0
> 5 A02 4.20 0
> 6 A03 2.98 1
> 7 A03 2.31 0
> 8 A04 4.20 0
>
> # Work
> x$vmean <- ave(x$V2, x$V1, x$V3 == 0, FUN = mean)
>
> # Work
> x$vsd2 <- ave(x$V2, x$V1, FUN = sd)
>
> # Doesn't work
> x$vsd <- ave(x$V2, x$V1, x$V3 == 0, FUN = sd)
Problem comes from
lapply(split(x$V2, interaction(x$V1, x$V3)), sd)
specifically from
> split(x$V2, interaction(x$V1, x$V3))
<snip>
$A02.1
numeric(0)
$A03.1
[1] 2.98
$A04.1
numeric(0)
> sd(1)
[1] NA> sd(numeric(0))
Error in var(x, na.rm = na.rm) : 'x' is empty
I am not sure if what value shall sd, var or cov(x) return if x is empty.
You probably have 2 options
rewrite sd to handle empty vectors
use another aggregate function together with some reordering, see eg.
aggregate(x$V2, list(x$V1, x$V3 == 0), FUN = sd)
Regards
Petr
>
> Thank you for any help!
>
> Patrick
>
> ______________________________________________
> 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.
------------------------------
Message: 7
Date: Wed, 21 Nov 2007 12:03:37 -0000 (GMT)
From: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Subject: Re: [R] NA values
To: Eleni Christodoulou <elenichri at gmail.com>
Cc: "r-help at r-project.org" <r-help at r-project.org>
Message-ID: <XFMail.071121120337.Ted.Harding at manchester.ac.uk>
Content-Type: text/plain; charset=iso-8859-1
On 21-Nov-07 11:15:32, Eleni Christodoulou wrote:> Hi all!
> I am new to R and I would like to ask you the following question:
> How can I substitute the NA values with 0 in a data frame?
> I cannot find a command to check if a value is NA...
>
> Thank you very much!
> Eleni
As has been said, is.na() is the function which determines
whether something has "value" NA (result=TRUE) or not (result=FALSE).
is.na() will work nicely with dataframes (also, of course, with
structures such as vectors, matrices and arrays). Example:
dummy<-data.frame(X1=c(101,102,103,104,NA,106),
X2=c(201,202,203,NA,205,206))
dummy
# X1 X2
#1 101 201
#2 102 202
#3 103 203
#4 104 NA
#5 NA 205
#6 106 206
dummy[is.na(dummy)] <- 0
dummy
# X1 X2
#1 101 201
#2 102 202
#3 103 203
#4 104 0
#5 0 205
#6 106 206
Hoping this makes it clear!
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 21-Nov-07 Time: 12:03:33
------------------------------ XFMail ------------------------------
------------------------------
Message: 8
Date: Wed, 21 Nov 2007 13:06:22 +0100
From: "Kilian Schwab" <K.Schwab at delta-energy.ch>
Subject: [R] R as server application
To: <r-help at stat.math.ethz.ch>
Message-ID:
<3F37912598F7CC44964B8B9E337D20A9AAECA9 at srv02.delta-energy.loc>
Content-Type: text/plain; charset="us-ascii"
Is there a way to use R as a client server application?
Whitch means:
1. install R on a server (running as a service)
2. from client send R-scripts through IDE/Editor (TINN-R) to
"R-server"
3. receive R-output on client
All the Best
Kilian Schwab
------------------------------
Message: 9
Date: Wed, 21 Nov 2007 20:18:21 +0800
From: "Qiu Anqi" <bieqa at nus.edu.sg>
Subject: [R] question about multiple comparison in ANOVA
To: <r-help at stat.math.ethz.ch>
Message-ID:
<929F1767385B5847B3D584E35576A1B90355EEEB at MBX03.stf.nus.edu.sg>
Content-Type: text/plain
I am not sure whether there is a bug. When I tested the example given
for "glht" in the help, I entered the following error:
Running commands:
amod <- aov(minutes ~ blanket, data = recovery)
rht <- glht(amod, linfct = mcp(blanket = "Dunnett"),
alternative = "less")
Errors are:
Error in try(coef.(model)) : could not find function "coef."
Error in modelparm.default(model, ...) : no 'coef' method for
'model'
found!
Thanks!
Regards,
Anqi Qiu
Assistant Professor
Division of Bioengineering, Faculty of Engineering
National University of Singapore
Email: bieqa at nus.edu.sg
tel: +65 6516 7002
[[alternative HTML version deleted]]
------------------------------
Message: 10
Date: Wed, 21 Nov 2007 14:24:40 +0200
From: "Eleni Christodoulou" <elenichri at gmail.com>
Subject: Re: [R] NA values
To: ted.harding at manchester.ac.uk
Cc: "r-help at r-project.org" <r-help at r-project.org>
Message-ID:
<2293b7660711210424i18f9d0b2y457c95feeb7135b6 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Yes, thanks a lot! It works fine!
Eleni
On Nov 21, 2007 2:03 PM, Ted Harding <Ted.Harding at manchester.ac.uk>
wrote:>
> On 21-Nov-07 11:15:32, Eleni Christodoulou wrote:
> > Hi all!
> > I am new to R and I would like to ask you the following question:
> > How can I substitute the NA values with 0 in a data frame?
> > I cannot find a command to check if a value is NA...
> >
> > Thank you very much!
> > Eleni
>
> As has been said, is.na() is the function which determines
> whether something has "value" NA (result=TRUE) or not
(result=FALSE).
>
> is.na() will work nicely with dataframes (also, of course, with
> structures such as vectors, matrices and arrays). Example:
>
> dummy<-data.frame(X1=c(101,102,103,104,NA,106),
> X2=c(201,202,203,NA,205,206))
>
> dummy
> # X1 X2
> #1 101 201
> #2 102 202
> #3 103 203
> #4 104 NA
> #5 NA 205
> #6 106 206
>
> dummy[is.na(dummy)] <- 0
>
> dummy
> # X1 X2
> #1 101 201
> #2 102 202
> #3 103 203
> #4 104 0
> #5 0 205
> #6 106 206
>
> Hoping this makes it clear!
> Ted.
>
> --------------------------------------------------------------------
> E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
> Fax-to-email: +44 (0)870 094 0861
> Date: 21-Nov-07 Time: 12:03:33
> ------------------------------ XFMail ------------------------------
>
------------------------------
Message: 11
Date: Wed, 21 Nov 2007 15:27:14 +0300
From: Alexy Khrabrov <deliverable at gmail.com>
Subject: [R] uniq -c
To: r-help at r-project.org
Message-ID: <2B222DE6-A113-4DCD-8431-9710C5575031 at gmail.com>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
Is there an R analog of the Unix command uniq -c:
http://en.wikipedia.org/wiki/Uniq
Given an array x, uniq -c replaces each contiguous subsequence of
identical numbers with a tuple (count, number). E.g.
$ cat > usample
10
10
9
8
8
7
7
7
6
3
1
1
1
0
$ uniq -c usample
2 10
1 9
2 8
3 7
1 6
1 3
3 1
1 0
Cheers,
Alexy
------------------------------
Message: 12
Date: Wed, 21 Nov 2007 04:27:27 -0800 (PST)
From: mysimbaa <adel.tekari at sisltd.ch>
Subject: Re: [R] display basename
To: r-help at r-project.org
Message-ID: <13876120.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii
Thanks for help.
--
View this message in context:
http://www.nabble.com/display-basename-tf4846650.html#a13876120
Sent from the R help mailing list archive at Nabble.com.
------------------------------
Message: 13
Date: Wed, 21 Nov 2007 07:28:19 -0500 (EST)
From: "Anqi Qiu" <anqi at cis.jhu.edu>
Subject: [R] multiple comparison (glht) problem
To: r-help at r-project.org
Message-ID:
<1962.137.132.194.52.1195648099.squirrel at webmail.cis.jhu.edu>
Content-Type: text/plain;charset=iso-8859-1
I am not sure whether there is a bug. When I tested the example given for
"glht"
in the help, I entered the following error:
Running commands:
amod <- aov(minutes ~ blanket, data = recovery)
rht <- glht(amod, linfct = mcp(blanket = "Dunnett"),
alternative = "less")
Errors are:
Error in try(coef.(model)) : could not find function "coef."
Error in modelparm.default(model, ...) : no 'coef' method for
'model'
found!
Thanks!
Regards,
Anqi Qiu
Anqi Qiu
Center for Imaging Science
Johns Hopkins University
Email: anqi at cis.jhu.edu
tel: 410-516-8103
Anqi Qiu
Center for Imaging Science
Johns Hopkins University
Email: anqi at cis.jhu.edu
tel: 410-516-8103
------------------------------
Message: 14
Date: Wed, 21 Nov 2007 07:11:39 -0600
From: Marc Schwartz <marc_schwartz at comcast.net>
Subject: Re: [R] uniq -c
To: Alexy Khrabrov <deliverable at gmail.com>
Cc: r-help at r-project.org
Message-ID: <1195650699.3017.6.camel at Bellerophon.localdomain>
Content-Type: text/plain
On Wed, 2007-11-21 at 15:27 +0300, Alexy Khrabrov wrote:> Is there an R analog of the Unix command uniq -c:
>
> http://en.wikipedia.org/wiki/Uniq
>
> Given an array x, uniq -c replaces each contiguous subsequence of
> identical numbers with a tuple (count, number). E.g.
>
> $ cat > usample
> 10
> 10
> 9
> 8
> 8
> 7
> 7
> 7
> 6
> 3
> 1
> 1
> 1
> 0
> $ uniq -c usample
> 2 10
> 1 9
> 2 8
> 3 7
> 1 6
> 1 3
> 3 1
> 1 0
>
> Cheers,
> Alexy
Alexy,
See ?rle
> Vec
[1] 10 10 9 8 8 7 7 7 6 3 1 1 1 0
> rle(Vec)
Run Length Encoding
lengths: int [1:8] 2 1 2 3 1 1 3 1
values : num [1:8] 10 9 8 7 6 3 1 0
HTH,
Marc Schwartz
------------------------------
Message: 15
Date: Wed, 21 Nov 2007 11:14:04 -0200
From: "Henrique Dallazuanna" <wwwhsd at gmail.com>
Subject: Re: [R] uniq -c
To: "Alexy Khrabrov" <deliverable at gmail.com>
Cc: r-help at r-project.org
Message-ID:
<da79af330711210514v3df1b9f1r2544463a8a44ea1c at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
See ?table function.
On 21/11/2007, Alexy Khrabrov <deliverable at gmail.com>
wrote:> Is there an R analog of the Unix command uniq -c:
>
> http://en.wikipedia.org/wiki/Uniq
>
> Given an array x, uniq -c replaces each contiguous subsequence of
> identical numbers with a tuple (count, number). E.g.
>
> $ cat > usample
> 10
> 10
> 9
> 8
> 8
> 7
> 7
> 7
> 6
> 3
> 1
> 1
> 1
> 0
> $ uniq -c usample
> 2 10
> 1 9
> 2 8
> 3 7
> 1 6
> 1 3
> 3 1
> 1 0
>
> Cheers,
> Alexy
>
> ______________________________________________
> 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.
>
--
Henrique Dallazuanna
Curitiba-Paran?-Brasil
25? 25' 40" S 49? 16' 22" O
------------------------------
Message: 16
Date: Wed, 21 Nov 2007 14:19:16 +0100
From: Scionforbai <scionforbai at gmail.com>
Subject: Re: [R] R as server application
To: r-help at stat.math.ethz.ch
Cc: Kilian Schwab <K.Schwab at delta-energy.ch>
Message-ID:
<e9ee1f0a0711210519y736a76aas763b8cdb6b6038cf at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
Do you need something more than a simple ssh connection to a remote
host in which you run R (trivial when the server is Linux)?
My advice is to run R in a "screen" session on the remote host (it
protects from sudden disconnections). Then you have a window on your
screen with the R command line, which you can copy/paste your scripts
to (from whichever editor you want) as if it was running locally. Of
course, on-screen graphics works (if you forward X... if you see what
I mean) but it depends on connection speed (in LAN no problem, through
internet it can be a pain, I usually don't use it then) and you need
an X server running locally (if the 'client' is windows, cygwin highly
recommended).
A real R 'server' could be very useful though.
------------------------------
Message: 17
Date: Wed, 21 Nov 2007 08:26:09 -0500
From: Chuck Cleland <ccleland at optonline.net>
Subject: Re: [R] multiple comparison (glht) problem
To: anqi at cis.jhu.edu
Cc: r-help at r-project.org
Message-ID: <474431F1.1000302 at optonline.net>
Content-Type: text/plain; charset=UTF-8
Anqi Qiu wrote:> I am not sure whether there is a bug. When I tested the example given for
"glht"
> in the help, I entered the following error:
>
> Running commands:
>
> amod <- aov(minutes ~ blanket, data = recovery)
> rht <- glht(amod, linfct = mcp(blanket = "Dunnett"),
> alternative = "less")
>
> Errors are:
>
> Error in try(coef.(model)) : could not find function "coef."
>
> Error in modelparm.default(model, ...) : no 'coef' method for
'model'
> found!
>
> Thanks!
It works for me.
> library(multcomp)
Loading required package: mvtnorm
> amod <- aov(minutes ~ blanket, data = recovery)
> rht <- glht(amod, linfct = mcp(blanket = "Dunnett"),
+ alternative = "less")
> summary(rht)
Simultaneous Tests for General Linear Hypotheses
Multiple Comparisons of Means: Dunnett Contrasts
Fit: aov(formula = minutes ~ blanket, data = recovery)
Linear Hypotheses:
Estimate Std. Error t value p value
b1 - b0 >= 0 -2.1333 1.6038 -1.330 0.2412
b2 - b0 >= 0 -7.4667 1.6038 -4.656 <0.001 ***
b3 - b0 >= 0 -1.6667 0.8848 -1.884 0.0924 .
---
Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
(Adjusted p values reported)
> sessionInfo()
R version 2.6.1 RC (2007-11-20 r43507)
i386-pc-mingw32
locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] multcomp_0.992-6 mvtnorm_0.8-1
loaded via a namespace (and not attached):
[1] tools_2.6.1
> Regards,
>
> Anqi Qiu
>
> Anqi Qiu
> Center for Imaging Science
> Johns Hopkins University
> Email: anqi at cis.jhu.edu
> tel: 410-516-8103
>
> Anqi Qiu
> Center for Imaging Science
> Johns Hopkins University
> Email: anqi at cis.jhu.edu
> tel: 410-516-8103
> ______________________________________________
> 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.
--
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894
------------------------------
Message: 18
Date: Wed, 21 Nov 2007 14:38:54 +0100
From: Martin Maechler <maechler at stat.math.ethz.ch>
Subject: Re: [R] Logarithmic axis -- now in new version of 'sfsmisc'
To: "Gabor Grothendieck" <ggrothendieck at gmail.com>
Cc: r-help at r-project.org
Message-ID: <18244.13550.192715.839786 at stat.math.ethz.ch>
Content-Type: text/plain; charset=us-ascii
>>>>> "GaGr" == Gabor Grothendieck <ggrothendieck at
gmail.com>
>>>>> on Tue, 20 Nov 2007 13:35:34 -0500 writes:
GaGr> See:
GaGr> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/57255.html
Also, incidentally several weeks ago, I had added the following
to the 'ChangeLog' of my package "sfsmisc" :
2007-10-13 Martin Maechler <maechler at stat.math.ethz.ch>
* R/prettylab.R (eaxis): new function for nice (log) axis
labeling. (pretty10exp): drop.1: -10^k instead of -1*10^k
Here is the code -- which also needs package sfsmisc.
eaxis <- function(side, at = axTicks(side, log=log), labels = NULL, log =
NULL,
f.smalltcl = 3/5, at.small = NULL, small.mult = NULL,
outer.at = TRUE, drop.1 = TRUE)
{
## Purpose: "E"xtended, "E"ngineer-like (log-)axis
## ----------------------------------------------------------------------
## Author: Martin Maechler, Date: 13 Oct 2007
stopifnot(require("sfsmisc")) ## <<<--- just for the post to
R-help
is.x <- side%%2 == 1
if(is.null(log)) {
XY <- function(ch) paste(if (is.x) "x" else "y",
ch, sep = "")
log <- par(XY("log"))
}
## use expression (i.e. plotmath) if 'log' or exponential format:
use.expr <- log || format.info(as.numeric(at), digits=7)[3] > 0
if(is.null(labels))
labels <- if(use.expr) pretty10exp(at, drop.1=drop.1) else TRUE
else if(is.na(labels)) # no 'plotmath'
labels <- TRUE
axis(side, at = at, labels = labels)
if(is.null(at.small)) { ## create smart default, using small.mult
at.small <-
if(log) {
if(is.null(small.mult)) small.mult <- 9
at. <- at[log10(at) %% 1 < 1e-3] ## the 10^k ones:
if(length(at.))
outer(2:small.mult, c(if(outer.at) at.[1]/10, at.))
} else {
## assumes that 'at' is equidistant
d <- diff(at <- sort(at))
if(any(abs(diff(d)) > 1e-3 * (dd <- mean(d))))
stop("'at' is not equidistant")
if(is.null(small.mult)) {
## look at 'dd' , e.g. in {5, 50, 0.05, 0.02 ..}
d. <- dd / 10^floor(log10(dd))
small.mult <- {
if(d. %% 5 == 0) 5
else if(d. %% 4 == 0) 4
else if(d. %% 2 == 0) 2
else if(d. %% 3 == 0) 3
else if(d. %% 0.5 == 0) 5
else 2 }
}
outer(1:(small.mult-1)/small.mult * dd,
c(if(outer.at) at[1]-dd, at), "+")
}
##
if(outer.at) { # make sure 'at.small' remain inside
"usr"
p.u <- sort(par("usr")[if(is.x) 1:2 else 3:4])
if(log) p.u <- 10^p.u
at.small <- at.small[p.u[1] <= at.small & at.small <=
p.u[2]]
}
}
axis(side, at = at.small, label = FALSE,
tcl = f.smalltcl * par("tcl"))
}
A few example calls [ from example(eaxis) once you've got the
new version of package 'sfsmisc' ]:
x <- lseq(1e-10, 0.1, length = 201)
plot(x, pt(x, df=3), type = "l", xaxt = "n", log =
"x")
eaxis(1)
## If you like the ticks, but prefer traditional (non-"plotmath")
labels:
plot(x, gamma(x), type = "l", log = "x")
eaxis(1, labels=NA)
x <- lseq(.001, 0.1, length = 1000)
plot(x, sin(1/x)*x, type = "l", xaxt = "n", log =
"x")
eaxis(1)
## non- log-scale : draw small ticks, but no "10^k" if not needed:
x <- seq(-100, 100, length = 1000)
plot(x, sin(x)/x, type = "l", xaxt = "n")
eaxis(1)
----------------
Given the interest, I've now made sfsmisc ready for the next
release, version 0.96-01
and uploaded that to CRAN.
Feedback is highly appreciated.
The unpatient can it also get from
ftp://ftp.stat.math.ethz.ch/U/maechler/R/
both as source (*.tar.gz) or Windows-binary package (*.zip).
GaGr> On Nov 20, 2007 1:21 PM, John Wiedenhoeft <john at
nurfuerspam.de> wrote:
>> Hi there,
>>
>> I guess this must be a standard issue, but I'm starting to go
crazy with it. I
>> simply want a plot with the x axis being logarithmic, having labels
1, 10,
>> 100..., and ten unlabelled ticks between each of them - just as
they
>> introduce logarithmic axis at school. I've played around a bit
with log="x",
>> xlog=T (where exactly is the difference here?), xaxp, and xaxt
(unfortunately
>> xaxt="l" isn't implemented). The best I get is a plot
with an axis having a
>> single 100 and nothing else...
>>
>> here is what I've tried:
>>
>> pdf(file="kennlinien.pdf");
>> par(log="x", xlog=TRUE);
>> kennlinie1 <- c(8.0746909, 3.9916973, 9.9789444, 19.962869);
>> kennlinie2 <- c(6.0994206, 8.9661081, 19.924883, 31.879496);
>> reizstaerke <- c(76, 92, 108, 124);
>> #plot(reizstaerke, kennlinie1, ylim=c(0, max(kennlinie1,
kennlinie2)),
>> xlim=c(0, max(reizstaerke)), log="x", xlog=TRUE,
xaxp=c(1, 2, 1), type="b");
>> #plot(reizstaerke, kennlinie1, type="b",
log="x", xlog=TRUE, xaxp=c(1, 2, 3));
>> plot(reizstaerke, kennlinie1,
type="b",usr=c(min(reizstaerke),
>> max(reizstaerke), min(kennlinie1, kennlinie2), max(kennlinie1,
kennlinie2)),
>> log="x", xlog=TRUE, xaxp=c(1, 2, 3));
>> #points(reizstaerke, kennlinie2, xlog=TRUE, xaxp=c(1, 3, 3),
type="b");
>> dev.off();
>>
>> Certainly I've missed something, but I can't figure it out.
>>
>> Any help appreciated,
>> Cheers,
>> John
>>
>>
>>
>> platform i486-pc-linux-gnu
>> arch i486
>> os linux-gnu
>> system i486, linux-gnu
>> status
>> major 2
>> minor 4.1
>> year 2006
>> month 12
>> day 18
>> svn rev 40228
>> language R
>> version.string R version 2.4.1 (2006-12-18)
>>
>> ______________________________________________
>> 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.
>>
GaGr> ______________________________________________
GaGr> R-help at r-project.org mailing list
GaGr> https://stat.ethz.ch/mailman/listinfo/r-help
GaGr> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
GaGr> and provide commented, minimal, self-contained, reproducible code.
------------------------------
Message: 19
Date: Wed, 21 Nov 2007 05:46:04 -0800
From: "Henrik Bengtsson" <hb at stat.berkeley.edu>
Subject: Re: [R] R as server application
To: "Kilian Schwab" <K.Schwab at delta-energy.ch>
Cc: r-help at stat.math.ethz.ch
Message-ID:
<59d7961d0711210546v1cd4fa53le5caf8f3a353aa8c at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Hi,
tbe R.batch package (http://www.braju.com/R/) was written to run
multiple batch jobs on one or more hosts sharing the same file system.
It doesn't do everything you want but part of it. For details, see
r-help thread 'R.batch (Was: Re: [R] Calling R from R and specifying
"wait until script is finished")' on May 22, 2005:
http://tolstoy.newcastle.edu.au/R/help/05/05/5046.html
/Henrik
On 21/11/2007, Kilian Schwab <K.Schwab at delta-energy.ch>
wrote:> Is there a way to use R as a client server application?
>
> Whitch means:
> 1. install R on a server (running as a service)
> 2. from client send R-scripts through IDE/Editor (TINN-R) to
"R-server"
> 3. receive R-output on client
>
> All the Best
>
> Kilian Schwab
>
> ______________________________________________
> 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.
>
------------------------------
Message: 20
Date: Wed, 21 Nov 2007 05:46:04 -0800
From: "Henrik Bengtsson" <hb at stat.berkeley.edu>
Subject: Re: [R] R as server application
To: "Kilian Schwab" <K.Schwab at delta-energy.ch>
Cc: r-help at stat.math.ethz.ch
Message-ID:
<59d7961d0711210546v1cd4fa53le5caf8f3a353aa8c at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Hi,
tbe R.batch package (http://www.braju.com/R/) was written to run
multiple batch jobs on one or more hosts sharing the same file system.
It doesn't do everything you want but part of it. For details, see
r-help thread 'R.batch (Was: Re: [R] Calling R from R and specifying
"wait until script is finished")' on May 22, 2005:
http://tolstoy.newcastle.edu.au/R/help/05/05/5046.html
/Henrik
On 21/11/2007, Kilian Schwab <K.Schwab at delta-energy.ch>
wrote:> Is there a way to use R as a client server application?
>
> Whitch means:
> 1. install R on a server (running as a service)
> 2. from client send R-scripts through IDE/Editor (TINN-R) to
"R-server"
> 3. receive R-output on client
>
> All the Best
>
> Kilian Schwab
>
> ______________________________________________
> 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.
>
------------------------------
Message: 21
Date: Wed, 21 Nov 2007 15:08:10 +0100
From: "marcg" <mdgi at gmx.ch>
Subject: [R] Reconstruct array dataset
To: r-help at stat.math.ethz.ch
Message-ID: <20071121140810.279520 at gmx.net>
Content-Type: text/plain; charset="us-ascii"
Hi there
I have an interesting problem:
My csv file is of array dimensions [12,50], but it was saved the wrong way:
there should be only 11 colums. What happens now if I read it into R is that the
whole data set is shifted ( in the first row, the last column contains already
the first value of the supposed second row and so on...)
how can I tell R to switch after 11 read values to the next row, taking the
value from column 12 as first in the new row (for row 3 the two second last of
the upper row etc...)
Thanks for suggestions
marc
--
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten
------------------------------
Message: 22
Date: Wed, 21 Nov 2007 08:11:29 -0600 (CST)
From: elw at stderr.org
Subject: Re: [R] biocep project (R for the Web and the Virtual R
Workbench)
To: Karim Chine <kchine at ebi.ac.uk>
Cc: R-help at r-project.org
Message-ID: <Pine.LNX.4.64.0711210810390.13806 at illuminati.stderr.org>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Some of the bits and pieces in this look like very strong candidates for
breaking off into CRAN packages, if you haven't done so already.
This looks like very nice work - you should be proud! :-)
--elijah
On Mon, 19 Nov 2007, Karim Chine wrote:
> Date: Mon, 19 Nov 2007 19:44:51 +0000
> From: Karim Chine <kchine at ebi.ac.uk>
> To: R-help at r-project.org
> Subject: [R] biocep project (R for the Web and the Virtual R Workbench)
>
> Dear all,
>
> I have been writing during last year at the European Bioinformatics
> Institute a general unified open source solution for R integration. This
> work is now available via this link:
> http://www.ebi.ac.uk/microarray-srv/frontendapp/
> The different frameworks and tools of the biocep project are now robust
> enough for production use. The different APIs are finalized but the
> documentation is incomplete.
> the last version of the biocep README file can be found here :
> http://www.ebi.ac.uk/microarray-srv/frontendapp/BIOCEP_README.txt
>
> Here are the major use cases I dealt with :
>
> - Generate java mappings for R Objects (Standard/S4).
> - Generate java mappings for selected packages' functions
> (Generic/TypeInfoed).
> - Use R and the R packages as a Java Toolkit via a Rich, High level,
> Object-Oriented API.
> - Deploy and use R as a remote component.
> - Expose automatically R packages and the R API as JAX-WS stateless or
> statefull Web Services.
> - Use R within a resource pooling infrastructure for scalable, web
> oriented, data analysis applications.
> - Use the Remote Resources Pooling framework (RPF) to deploy and use
> distributed computational resources (non R based, native libraries with
> JNI support or java code)
> - Use R for parallel computing via a Java API or Web Services.
> - Create and use Remote R Instances from within R (snow' like fucntions
> : makeCluster, clusterEvalQ, clusterExport, clusterApply, stopCluster ..)
> - Use the R API from within an applet (book, use and release a Remote R
> Instance via HTTP Tunneling)
> - Use R to generate Graphics on the fly for thin web clients
> - Use R from within a Workbench that includes an advanced script
> editor, a Spreadsheet View fully connected to R data and functions, an
> R Object Inspector,
> composable and dockable Views, interactive R devices, clonable R
> Graphics..
> - Use the Workbench from within a browser or via Java Web Start to
> access a pool of Remote R Instances
> - Use the Workbench to control on demand any Remote R Instance
> - Provide a packaging for R Based Desktop applications that enables Web
> based, one click installation (Embedded R for Windows, detected R for
> other operating systems)
>
> This work uses extensively a large number of existing open source
> projects as is or patched.
>
> The public SVN url/login/pasword for the biocep project are in the
> README file
>
> You may want to try the Virtual R Workbench on your local machine, use
> the following link :
> http://www.ebi.ac.uk/microarray-srv/frontendapp/rworkbench.jnlp
> or type 'javaws
> http://www.ebi.ac.uk/microarray-srv/frontendapp/rworkbench.jnlp' from
> the command line.
> This is a one click installation process for Windows and Mac OS X. (You
> need to preinstall R on Mac OS X while on Widows an embedded R 2.6 can
> be deployed and used)
> The Java Web Start installer creates an RWorkbench directory in your
> home dir with all the files required. You may continue launching the
> application via the url (good for fetching updates automatically)
> or use the RWorkbench/VRWorkbench.txt to Run the application off line.
> rename it to VRWorkbench.bat on Windows or type 'source
VRWorkbench.txt'
> on Mac OS X command line.
> use the sources of biocep to run the R Workbench on Unix-like operating
> systems.
>
> Best wishes,
>
> Karim
>
> ______________________________________________
> 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.
>
------------------------------
Message: 23
Date: Wed, 21 Nov 2007 09:24:14 -0500
From: "John Sorkin" <jsorkin at grecc.umaryland.edu>
Subject: [R] Packages - a great resource, but hard to find the right
one.
To: <r-help at stat.math.ethz.ch>
Message-ID: <4743F93E020000CB0000B40A at medicine.umaryland.edu>
Content-Type: text/plain; charset=US-ASCII
Fellow Rers,
Please forgive me if I have posted this to the wrong R list serve.
Over the course of the years that I have used R and participated in this list
server, I have noted a large number of questions and answers that direct people
to specific packages. The multitude of packages is one of the great strengths of
R. Unfortunately there is no (or at least I am not aware of) any single source
that lists all available packages and gives a synopsis of what each package
does. One can install and load packages one-by-one and look at the help pages
to see what each package does, but this is at best an inefficient and a worst a
very frustrating task. Might there be a way to put together a searchable
database that will allow a user to easily search for a given function or
technique in all contributed packages?
Thanks,
John
P.S. Many thanks to the writers and maintainers of R packages and the many
people who contribute to the R list server.
John Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
Baltimore VA Medical Center GRECC,
University of Maryland School of Medicine Claude D. Pepper OAIC,
University of Maryland Clinical Nutrition Research Unit, and
Baltimore VA Center Stroke of Excellence
University of Maryland School of Medicine
Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)
jsorkin at grecc.umaryland.edu
Confidentiality Statement:
This email message, including any attachments, is for th...{{dropped:6}}
------------------------------
Message: 24
Date: Wed, 21 Nov 2007 08:29:17 -0600 (CST)
From: Terry Therneau <therneau at mayo.edu>
Subject: Re: [R] plotting coxph results using survfit() function
To: shoaaib at gmail.com
Cc: r-help at stat.math.ethz.ch
Message-ID: <200711211429.lALETHF13249 at hsrnfs-101.mayo.edu>
Content-Type: TEXT/plain; charset=us-ascii
The survfit function, when applied to the results of a Cox model, will give
the predicted survival curve for any particular combination of covariates in the
model. You cannot get what you are asking for, i.e., distinct levels of X while
ignoring Y, from survfit. What you need to do is create a data frame containing
values for the curves that you want, e.g.,
mydata <- data.frame(X=c(1,2,3,4), y=c(8,8,8,8))
cfit <- survfit(mod.phm, newdata=mydata)
plot(cfit, lty=1:4)
People often choose a 'common' value of y for the plot.
Arguably the better approach is to average over the levels of y. For this, I
would recommend that you read chapter 10 of Therneau and Grambsch, Modeling
Survival Data. The discussion really does take a whole chapter, and is too long
for a help-list synopsis.
Terry Therneau
------------------------------------------------------------
begin included message
Thanks for your help. I want to draw a plot which shows separate
survival curves for each category of X on the same plot(same set of
axes). Your code produces a separate curve for each combination of X
and Y but I don't want curves for combinations of X and Y since Y has
many levels and also the values of Y don't have any significance in my
case. Is there a way of doing what i want to do i.e. getting separate
survival curves for each level of X using the function survfit() on an
object mod.phm which is a coxph object such that:
mod.phm<-coxph(formula=Surv(time,Flag_Death)~X+Y, data= datFrame)
------------------------------
Message: 25
Date: Wed, 21 Nov 2007 15:31:31 +0100
From: Gabor Csardi <csardi at rmki.kfki.hu>
Subject: Re: [R] Packages - a great resource, but hard to find the
right one.
To: John Sorkin <jsorkin at grecc.umaryland.edu>
Cc: r-help at stat.math.ethz.ch
Message-ID: <20071121143130.GG24046 at localdomain>
Content-Type: text/plain; charset=us-ascii
John, what about
http://cran.r-project.org/src/contrib/PACKAGES.html
Isn't this good enough? You might also take a look at
http://cran.r-project.org/src/contrib/Views/
Gabor
On Wed, Nov 21, 2007 at 09:24:14AM -0500, John Sorkin
wrote:> Fellow Rers,
>
> Please forgive me if I have posted this to the wrong R list serve.
>
> Over the course of the years that I have used R and participated in
> this list server, I have noted a large number of questions and
> answers that direct people to specific packages. The multitude of
> packages is one of the great strengths of R. Unfortunately there is
> no (or at least I am not aware of) any single source that lists all
> available packages and gives a synopsis of what each package
> does. One can install and load packages one-by-one and look at the
> help pages to see what each package does, but this is at best an
> inefficient and a worst a very frustrating task. Might there be a
> way to put together a searchable database that will allow a user to
> easily search for a given function or technique in all contributed
> packages?
>
> Thanks,
> John
>
> P.S. Many thanks to the writers and maintainers of R packages and
> the many people who contribute to the R list server.
>
> John Sorkin M.D., Ph.D.
> Chief, Biostatistics and Informatics
> Baltimore VA Medical Center GRECC,
> University of Maryland School of Medicine Claude D. Pepper OAIC,
> University of Maryland Clinical Nutrition Research Unit, and
> Baltimore VA Center Stroke of Excellence
>
> University of Maryland School of Medicine
> Division of Gerontology
> Baltimore VA Medical Center
> 10 North Greene Street
> GRECC (BT/18/GR)
> Baltimore, MD 21201-1524
>
> (Phone) 410-605-7119
> (Fax) 410-605-7913 (Please call phone number above prior to faxing)
> jsorkin at grecc.umaryland.edu
>
> Confidentiality Statement:
> This email message, including any attachments, is for ...{{dropped:11}}
------------------------------
Message: 26
Date: Wed, 21 Nov 2007 09:43:44 -0500
From: "John Sorkin" <jsorkin at grecc.umaryland.edu>
Subject: Re: [R] Packages - a great resource, but hard to find the
right one.
To: "Gabor Csardi" <csardi at rmki.kfki.hu>
Cc: r-help at stat.math.ethz.ch
Message-ID: <4743FDD0020000CB0000B40E at medicine.umaryland.edu>
Content-Type: text/plain; charset=US-ASCII
Gabor,
The URL you cited is helpful, but it is not searchable. It can not be used, for
example, to easily determine that MASS can be used for boxcox tranforms.
John
John Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
Baltimore VA Medical Center GRECC,
University of Maryland School of Medicine Claude D. Pepper OAIC,
University of Maryland Clinical Nutrition Research Unit, and
Baltimore VA Center Stroke of Excellence
University of Maryland School of Medicine
Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)
jsorkin at grecc.umaryland.edu
>>> Gabor Csardi <csardi at rmki.kfki.hu> 11/21/07 9:31 AM
>>>
John, what about
http://cran.r-project.org/src/contrib/PACKAGES.html
Isn't this good enough? You might also take a look at
http://cran.r-project.org/src/contrib/Views/
Gabor
On Wed, Nov 21, 2007 at 09:24:14AM -0500, John Sorkin
wrote:> Fellow Rers,
>
> Please forgive me if I have posted this to the wrong R list serve.
>
> Over the course of the years that I have used R and participated in
> this list server, I have noted a large number of questions and
> answers that direct people to specific packages. The multitude of
> packages is one of the great strengths of R. Unfortunately there is
> no (or at least I am not aware of) any single source that lists all
> available packages and gives a synopsis of what each package
> does. One can install and load packages one-by-one and look at the
> help pages to see what each package does, but this is at best an
> inefficient and a worst a very frustrating task. Might there be a
> way to put together a searchable database that will allow a user to
> easily search for a given function or technique in all contributed
> packages?
>
> Thanks,
> John
>
> P.S. Many thanks to the writers and maintainers of R packages and
> the many people who contribute to the R list server.
>
> John Sorkin M.D., Ph.D.
> Chief, Biostatistics and Informatics
> Baltimore VA Medical Center GRECC,
> University of Maryland School of Medicine Claude D. Pepper OAIC,
> University of Maryland Clinical Nutrition Research Unit, and
> Baltimore VA Center Stroke of Excellence
>
> University of Maryland School of Medicine
> Division of Gerontology
> Baltimore VA Medical Center
> 10 North Greene Street
> GRECC (BT/18/GR)
> Baltimore, MD 21201-1524
>
> (Phone) 410-605-7119
> (Fax) 410-605-7913 (Please call phone number above prior to faxing)
> jsorkin at grecc.umaryland.edu
>
> Confidentiality Statement:
> This email message, including any attachments, is for ...{{dropped:19}}
------------------------------
Message: 27
Date: Wed, 21 Nov 2007 15:45:18 +0100
From: "marcg" <mdgi at gmx.ch>
Subject: Re: [R] Reconstruct array dataset
To: r-help at stat.math.ethz.ch
Message-ID: <20071121144518.279480 at gmx.net>
Content-Type: text/plain; charset="iso-8859-1"
This was my intention, but I'm not able to read it in as a vector (because i
don't know the function, neither I can convert the read in table to a vector
and then to matrix or directly.
What did I miss or where do I have to look up?
thanks alot
marc
-------- Original-Nachricht --------> Datum: Wed, 21 Nov 2007 14:17:41 -0000
> Von: "Rob Robinson" <rob.robinson at bto.org>
> An: "\'marcg\'" <mdgi at gmx.ch>
> CC: r-help-bounces at r-project.org
> Betreff: RE: [R] Reconstruct array dataset
> Can you not read it into a single vector and then use as.matrix to shape
> it
> into a an appropriate sized matrix?
> Cheers
> rob
>
> *** Want to know about Britain's birds? Try www.bto.org/birdfacts ***
>
> Dr Rob Robinson, Senior Population Biologist
> British Trust for Ornithology, The Nunnery, Thetford, Norfolk, IP24 2PU
> Ph: +44 (0)1842 750050 E: rob.robinson at bto.org
> Fx: +44 (0)1842 750030 W: http://www.bto.org
>
> ==== "How can anyone be enlightened, when truth is so poorly lit"
====>
>
> > -----Original Message-----
> > From: r-help-bounces at r-project.org
> > [mailto:] On Behalf Of marcg
> > Sent: 21 November 2007 14:08
> > To: r-help at stat.math.ethz.ch
> > Subject: [R] Reconstruct array dataset
> >
> > Hi there
> >
> > I have an interesting problem:
> >
> > My csv file is of array dimensions [12,50], but it was saved
> > the wrong way: there should be only 11 colums. What happens
> > now if I read it into R is that the whole data set is shifted
> > ( in the first row, the last column contains already the
> > first value of the supposed second row and so on...)
> >
> > how can I tell R to switch after 11 read values to the next
> > row, taking the value from column 12 as first in the new row
> > (for row 3 the two second last of the upper row etc...)
> >
> > Thanks for suggestions
> >
> > marc
> > --
> > Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten
> >
> > ______________________________________________
> > 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.
> >
--
------------------------------
Message: 28
Date: Wed, 21 Nov 2007 06:53:21 -0800 (PST)
From: mysimbaa <adel.tekari at sisltd.ch>
Subject: [R] Changing axis scale
To: r-help at r-project.org
Message-ID: <13878705.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii
Hello R users,
Is it possible after making a plot(x,y) to change axis scale?
For example : I have a range of 0 to 3000 in my y-axis and I want to make a
zoom between 2000 and 3000.
Thanks for any help.
--
View this message in context:
http://www.nabble.com/Changing-axis-scale-tf4850633.html#a13878705
Sent from the R help mailing list archive at Nabble.com.
------------------------------
Message: 29
Date: Wed, 21 Nov 2007 06:57:54 -0800 (PST)
From: aaront <aaront at uniserve.com>
Subject: Re: [R] Changing axis scale
To: r-help at r-project.org
Message-ID: <13878723.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii
xlim(),ylim()
so, ylim(2000,3000)
mysimbaa wrote:>
> Hello R users,
>
> Is it possible after making a plot(x,y) to change axis scale?
> For example : I have a range of 0 to 3000 in my y-axis and I want to make
> a zoom between 2000 and 3000.
>
>
> Thanks for any help.
>
--
View this message in context:
http://www.nabble.com/Changing-axis-scale-tf4850633.html#a13878723
Sent from the R help mailing list archive at Nabble.com.
------------------------------
Message: 30
Date: Wed, 21 Nov 2007 06:58:41 -0800 (PST)
From: aaront <aaront at uniserve.com>
Subject: Re: [R] Changing axis scale
To: r-help at r-project.org
Message-ID: <13878723.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii
xlim(),ylim()
so, ylim(2000,3000)
Aaron Trowbridge
Junior Researcher
BV Research Centre
www.bvcentre.ca
mysimbaa wrote:>
> Hello R users,
>
> Is it possible after making a plot(x,y) to change axis scale?
> For example : I have a range of 0 to 3000 in my y-axis and I want to make
> a zoom between 2000 and 3000.
>
>
> Thanks for any help.
>
--
View this message in context:
http://www.nabble.com/Changing-axis-scale-tf4850633.html#a13878723
Sent from the R help mailing list archive at Nabble.com.
------------------------------
Message: 31
Date: Wed, 21 Nov 2007 15:00:44 +0000 (GMT)
From: Prof Brian Ripley <ripley at stats.ox.ac.uk>
Subject: Re: [R] Packages - a great resource, but hard to find the
right one.
To: John Sorkin <jsorkin at grecc.umaryland.edu>
Cc: r-help at stat.math.ethz.ch
Message-ID: <Pine.LNX.4.64.0711211449290.14657 at gannet.stats.ox.ac.uk>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
On Wed, 21 Nov 2007, John Sorkin wrote:
> Gabor,
> The URL you cited is helpful, but it is not searchable. It can not be
> used, for example, to easily determine that MASS can be used for boxcox
> tranforms.
It is searchable (use your browser's search facilities), and that is often
helpful. But you can do your search at search.r-project.org (thanks to
Jonathan Baron): select 'Complete list of all packages', select a
package
and browse its help.
If you are looking for a way to do Box-Cox, or the function boxcox(),
search on that site, or for packages you already have installed, use
help.search(). One reason we find it useful to have a system with all
packages installed (that do install) is to make it easy for our users to
search for what they want, and then use it.
See also http://www.r-project.org/search.html
> John
>
> John Sorkin M.D., Ph.D.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
------------------------------
Message: 32
Date: Wed, 21 Nov 2007 14:53:25 +0000 (UTC)
From: Ken Knoblauch <knoblauch at lyon.inserm.fr>
Subject: Re: [R] Packages - a great resource, but hard to find
theright one.
To: r-help at stat.math.ethz.ch
Message-ID: <loom.20071121T144841-576 at post.gmane.org>
Content-Type: text/plain; charset=utf-8
> >>> Gabor Csardi <csardi <at> rmki.kfki.hu> 11/21/07
9:31 AM >>>
> http://cran.r-project.org/src/contrib/PACKAGES.html
> Isn't this good enough? You might also take a look at
> http://cran.r-project.org/src/contrib/Views/
> On Wed, Nov 21, 2007 at 09:24:14AM -0500, John Sorkin wrote:
> > Over the course of the years that I have used R and participated in
> > this list server, I have noted a large number of questions and
> > answers that direct people to specific packages. The multitude of
> > packages is one of the great strengths of R. Unfortunately there is
> > no (or at least I am not aware of) any single source that lists all
> > available packages and gives a synopsis of what each package
> > does. One can install and load packages one-by-one and look at the
> > help pages to see what each package does, but this is at best an
> > inefficient and a worst a very frustrating task. Might there be a
> > way to put together a searchable database that will allow a user to
> > easily search for a given function or technique in all contributed
> > packages?
> > John
Then what about
http://finzi.psych.upenn.edu/R/doc/html/packages.html
which allows you to go in a little deeper and see the help pages of each
function
and
http://cged.genes.nig.ac.jp/RGM2/index.php
HTH
ken
--
Ken Knoblauch
Inserm U846
Institut Cellule Souche et Cerveau
D?partement Neurosciences Int?gratives
18 avenue du Doyen L?pine
69500 Bron
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: +33 (0)6 84 10 64 10
http://www.lyon.inserm.fr/846/english.html
------------------------------
Message: 33
Date: Tue, 20 Nov 2007 01:25:03 -0800 (PST)
From: Bartjoosen <bartjoosen at hotmail.com>
Subject: Re: [R] any measure for curvature
To: r-help at r-project.org
Message-ID: <13853341.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii
You mean non-linearity?
You can use a lack of fit test by using:
anova(lm(y ~ x+factor(x), data))
The F-value of factor(x) is the lack of fit test, and when lineair, the p
value should be <0.05 when using 0.95% significance.
Bart
Wensui Liu wrote:>
> in statistics, is there a measure for curvature? how to detect and
> quantify the curvature between 2 variales instead of using
> visualization?
> thank you so much!
>
> ______________________________________________
> 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.
>
>
--
View this message in context:
http://www.nabble.com/any-measure-for-curvature-tf4837912.html#a13853341
Sent from the R help mailing list archive at Nabble.com.
------------------------------
Message: 34
Date: Wed, 21 Nov 2007 01:28:44 +0100 (CET)
From: David <david at clyde66.wanadoo.co.uk>
Subject: [R] Frailty
To: "R-help at lists.R-project.org" <R-help at
stat.math.ethz.ch>
Message-ID: <22256000.882271195604923634.JavaMail.www at wwinf3207>
Content-Type: text/plain
Hi
Which package(s) is R fit frailty models to univariate survival data, i.e.
simple data with one survival time per person.
David
[[alternative HTML version deleted]]
------------------------------
Message: 35
Date: Tue, 20 Nov 2007 14:18:45 +0000
From: "Peter Tait" <petertait at sympatico.ca>
Subject: [R] randomForest() question
To: r-help at stat.math.ethz.ch
Message-ID: <BAY117-F251A167B3B2119A2818286CF7F0 at phx.gbl>
Content-Type: text/plain; format=flowed
Hi,
I am trying to find some information on the strata option in randomForest().
I am hoping to make predictions from some clustered data (many predictors
measured repeatedly on the same subject over time). I would like to apply
random forests or gradient boosting ( gbm() ) to this problem but I have not
found a way for these methods to account for the natural clustering in my
data.
Any help would be greatly appreciated.
Cheers
Peter
------------------------------
Message: 36
Date: Wed, 21 Nov 2007 10:23:19 +0530
From: "Kushal M Shah" <kushal.shah at evalueserve.com>
Subject: [R] Help Required
To: <r-help at r-project.org>
Message-ID:
<C46A2EF893A00044BD602BDDB2824F4F9D1361 at EVSMAIL.Evalueserve.com>
Content-Type: text/plain
Hi Friends
I am working on a Financial Model project in R and require help in
writing code for Moving Averages. Since I am very new to R, it would be
good if any seniors in the group can guide me on a proper moving average
code.
Thanks & Best Regards,
Kushal
The information in this e-mail is the property of Evalue...{{dropped:11}}
------------------------------
Message: 37
Date: Wed, 21 Nov 2007 15:07:13 +0000
From: Gavin Simpson <gavin.simpson at ucl.ac.uk>
Subject: Re: [R] Packages - a great resource, but hard to find the
right one.
To: John Sorkin <jsorkin at grecc.umaryland.edu>
Cc: r-help at stat.math.ethz.ch
Message-ID: <1195657633.14669.24.camel at gsimpson.geog.ucl.ac.uk>
Content-Type: text/plain
On Wed, 2007-11-21 at 09:24 -0500, John Sorkin wrote:> Fellow Rers,
>
> Please forgive me if I have posted this to the wrong R list serve.
>
> Over the course of the years that I have used R and participated in
> this list server, I have noted a large number of questions and answers
> that direct people to specific packages. The multitude of packages is
> one of the great strengths of R. Unfortunately there is no (or at
> least I am not aware of) any single source that lists all available
> packages and gives a synopsis of what each package does. One can
> install and load packages one-by-one and look at the help pages to
> see what each package does, but this is at best an inefficient and a
> worst a very frustrating task. Might there be a way to put together a
> searchable database that will allow a user to easily search for a
> given function or technique in all contributed packages?
You can get a synopsis from CRAN if the package description has been
filled in in sufficient detail.
Also, you can try ?RSiteSearch and give it terms for something you are
looking for, or view Jonathan Baron's web site directly:
http://finzi.psych.upenn.edu/search.html
which includes CRAN packages, R functions (base and other packages in
distribution) and a few other sources, inc. Bioconductor.
There are also Task Views, which try to pool information for specific
fields:
http://cran.r-project.org/src/contrib/Views/
HTH
G
>
> Thanks,
> John
>
> P.S. Many thanks to the writers and maintainers of R packages and the
> many people who contribute to the R list server.
>
> John Sorkin M.D., Ph.D.
> Chief, Biostatistics and Informatics
> Baltimore VA Medical Center GRECC,
> University of Maryland School of Medicine Claude D. Pepper OAIC,
> University of Maryland Clinical Nutrition Research Unit, and
> Baltimore VA Center Stroke of Excellence
>
> University of Maryland School of Medicine
> Division of Gerontology
> Baltimore VA Medical Center
> 10 North Greene Street
> GRECC (BT/18/GR)
> Baltimore, MD 21201-1524
>
> (Phone) 410-605-7119
> (Fax) 410-605-7913 (Please call phone number above prior to faxing)
> jsorkin at grecc.umaryland.edu
>
> Confidentiality Statement:
> This email message, including any attachments, is for th...{{dropped:6}}
>
> ______________________________________________
> 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.
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Dr. Gavin Simpson [t] +44 (0)20 7679 0522
ECRC, UCL Geography, [f] +44 (0)20 7679 0565
Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/
UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
------------------------------
Message: 38
Date: Tue, 20 Nov 2007 00:36:32 -0800 (PST)
From: mogra <funnymoody999 at yahoo.com>
Subject: [R] t.test : extracting Error
To: r-help at r-project.org
Message-ID: <13845405.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii
Hi Thanks for the reply.
I implemented your solution to my problem but ...
For some of my column there is not enough data to do t-test so it gives me
error and stops the for loop, is any graceful way to check for error msg and
say ok if there is no $p.value continue to the next column
Once again thx for help.
sata pinal wrote:>
> I have two matrix with same dimensions. I want to do t.test using each
> column from 2 different matrix.
> Row n Column names in both matrix are same.
>
> e.g.
> Matrix1
> id VC1 VC2 VC3
> R 1 2 3
> R1 4 5 6
> R3 7 8 9
>
>
> Matrix2
> id VC1 VC2 VC3
> R 10 11 12
> R1 13 14 15
> R3 16 17 18
>
> want to do t.test using each column (with same name ) using Matrix1 and
> Matrix2
>
> for eg t.test(Matrix1$VC1, Matrix2$VC1)$p.value
>
> What is the best way to do it. I have dataset with 4000 columns for each
> matrix with same row and column names.
>
> Thanks a lot.
>
> ---------------------------------
> Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try
> it now.
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>
>
--
View this message in context:
http://www.nabble.com/Reg-%3A-%09using-two-different-matrix-%3A-how-to-do-t.test-tf4834072.html#a13845405
Sent from the R help mailing list archive at Nabble.com.
------------------------------
Message: 39
Date: Wed, 21 Nov 2007 10:10:59 -0500
From: "Christos Hatzis" <christos at nuverabio.com>
Subject: Re: [R] Packages - a great resource, but hard to find the
right one.
To: "'John Sorkin'" <jsorkin at grecc.umaryland.edu>
Cc: r-help at stat.math.ethz.ch
Message-ID:
<000d01c82c50$ba1fef40$0e010a0a at headquarters.silicoinsights>
Content-Type: text/plain; charset="us-ascii"
Another useful search facility is
http://www.rseek.org
The nice thing is that it categorizes results by help-list items, R function
etc.
It might be closer to what you are looking for.
-Christos
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel: 781-938-3830
www.nuverabio.com
> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of Prof Brian Ripley
> Sent: Wednesday, November 21, 2007 10:01 AM
> To: John Sorkin
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] Packages - a great resource, but hard to
> find the right one.
>
> On Wed, 21 Nov 2007, John Sorkin wrote:
>
> > Gabor,
>
> > The URL you cited is helpful, but it is not searchable. It
> can not be
> > used, for example, to easily determine that MASS can be used for
> > boxcox tranforms.
>
> It is searchable (use your browser's search facilities), and
> that is often helpful. But you can do your search at
> search.r-project.org (thanks to Jonathan Baron): select
> 'Complete list of all packages', select a package and browse its
help.
>
> If you are looking for a way to do Box-Cox, or the function
> boxcox(), search on that site, or for packages you already
> have installed, use help.search(). One reason we find it
> useful to have a system with all packages installed (that do
> install) is to make it easy for our users to search for what
> they want, and then use it.
>
> See also http://www.r-project.org/search.html
>
> > John
> >
> > John Sorkin M.D., Ph.D.
>
>
> --
> Brian D. Ripley, ripley at stats.ox.ac.uk
> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel: +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UK Fax: +44 1865 272595
>
> ______________________________________________
> 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.
>
>
------------------------------
Message: 40
Date: Wed, 21 Nov 2007 10:56:29 -0500 (EST)
From: John Kane <jrkrideau at yahoo.ca>
Subject: Re: [R] Reconstruct array dataset
To: marcg <mdgi at gmx.ch>, r-help at stat.math.ethz.ch
Message-ID: <585689.608.qm at web32813.mail.mud.yahoo.com>
Content-Type: text/plain; charset=iso-8859-1
I seem to be missing something. How can you have a
rectanglar data.frame of 12* 50 and convert it into 11
* x? 600/11 is not an integer.
However leaving that minor detail aside: Let xx be the
data.frame that you have read in:
yy <- unlist(xx)
zz <- t(matrix(yy, nrow=11))
might work.
--- marcg <mdgi at gmx.ch> wrote:
> Hi there
>
> I have an interesting problem:
>
> My csv file is of array dimensions [12,50], but it
> was saved the wrong way: there should be only 11
> colums. What happens now if I read it into R is that
> the whole data set is shifted ( in the first row,
> the last column contains already the first value of
> the supposed second row and so on...)
>
> how can I tell R to switch after 11 read values to
> the next row, taking the value from column 12 as
> first in the new row (for row 3 the two second last
> of the upper row etc...)
>
> Thanks for suggestions
>
> marc
> --
> Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten
>
> ______________________________________________
> 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.
>
------------------------------
Message: 41
Date: Wed, 21 Nov 2007 10:57:48 -0500
From: "jim holtman" <jholtman at gmail.com>
Subject: Re: [R] shrink a dataframe for plotting
To: "Alexy Khrabrov" <alexy.khrabrov at gmail.com>
Cc: r-help at r-project.org
Message-ID:
<644e1f320711210757ged98bebm57c4295d4c7250cd at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Try 'hexbin' for plotting this many points.
On Nov 21, 2007 5:05 AM, Alexy Khrabrov <alexy.khrabrov at gmail.com>
wrote:> I get tables with millions of rows. For plotting to a screen-size
> jpg, obviously just about 1000 points are enough. Instead of feeding
> plot() the original millions of rows, I'd rather shrink the original
> dataframe, using some kind of the following interpolation:
>
> -- split dataframe into chunks of N rows each, e.g. 1000 rows each
> -- compute average for each column
> -- issue one new row of those averages into the shrunk result
>
> Is there any existing package to do that in R? Otherwise, which R
> idioms are most effective to achieve that?
>
> Cheers,
> Alexy
>
> ______________________________________________
> 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.
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem you are trying to solve?
------------------------------
Message: 42
Date: Wed, 21 Nov 2007 11:11:05 -0500
From: "jim holtman" <jholtman at gmail.com>
Subject: Re: [R] Help Required
To: "Kushal M Shah" <kushal.shah at evalueserve.com>
Cc: r-help at r-project.org
Message-ID:
<644e1f320711210811t62f2812fjda134f952d3ec40b at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
There is code for moving averages already in R. There is some
information in the 'zoo' package.
?filter
What specifically are you looking for?
On Nov 20, 2007 11:53 PM, Kushal M Shah <kushal.shah at evalueserve.com>
wrote:> Hi Friends
>
>
>
> I am working on a Financial Model project in R and require help in
> writing code for Moving Averages. Since I am very new to R, it would be
> good if any seniors in the group can guide me on a proper moving average
> code.
>
>
>
> Thanks & Best Regards,
>
> Kushal
>
>
>
>
>
> The information in this e-mail is the property of Eval...{{dropped:18}}
------------------------------
Message: 43
Date: Wed, 21 Nov 2007 11:20:48 -0500
From: "Punit Anand" <punit.anand at lusight.com>
Subject: [R] Help Required in using cast (reshape package) function
To: <r-help at r-project.org>
Message-ID:
<3F37C67A105D1C46879D27A0EC72DF5A01C52804 at cx48.800onemail.com>
Content-Type: text/plain; charset="US-ASCII"
Hello everyone,
I am new to R. I have data in the form of excel pivot table format and I
want to cast it into a format which can make it compatible with
computation.
Since I already have the package in pivot format; I avoid melt function
and use the cast directly.
I inspect the
dataread <- read.csv(".....", header=TRUE)
Data in the format
Id Region Country Industry
Period variable value
"Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
"2002:FY" "account payable" 10000
"Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
"2002:FY" "account receivable" 50000
"Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
"2002:FY" "XXXX" 70000
"Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
"2002:FY" "YYYY" "NA"
"Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
"2002:FY" "ZZZZ"
"Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
"2002:FY" "AAAA" 10000
"Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
"2002:FY" "ccccccc" 10000
# I want to arrange data in the format
Id Region Country Industry
Period "account payable" "account receivable"
XXXX" "YYYYY"
"ZZZZ" "AAAA" "CCCCC"
"Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
"2002:FY" 10000 50000 70000 "NA"
10000
10000
# casting the data
cast <- cast(dataread, ID + Period ~ variable)
When I do that the data is casted as a pivot with a warning "Aggregation
requires fun.aggregate: length used as default", and the casted data
gives me the count of variables (as suggested by the warning )
Id Region Country Industry
Period "account payable" "account receivable"
XXXX" "YYYYY"
"ZZZZ" "AAAA" "CCCCC"
"Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
"2002:FY" 1 1 1 NA NA 10000
10000
How do I use the fun.aggregate feature of the cast function to obtain
the desired result?
Moreover, I want to subdivide the casted data into subsets based on ids.
How do I achieve that?
Thanks in advance,
Punit Anand
------------------------------
Message: 44
Date: Wed, 21 Nov 2007 08:26:33 -0800 (PST)
From: mysimbaa <adel.tekari at sisltd.ch>
Subject: [R] better curve
To: r-help at r-project.org
Message-ID: <13880048.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii
http://www.nabble.com/file/p13880048/Fluctuation.jpeg
Hi R users,
I have collected data which I plot(x,y).The problem it has oscillations.
Now i'm trying to "make better" this curve with a smooth line. And
then
collect my new datas.
But I don't know how doing this.
Perhaps a linear regression ??
See .jpeg foto.
Thanks for any help it will be given.
--
View this message in context:
http://www.nabble.com/better-curve-tf4851053.html#a13880048
Sent from the R help mailing list archive at Nabble.com.
------------------------------
Message: 45
Date: Wed, 21 Nov 2007 08:28:11 -0800 (PST)
From: mysimbaa <adel.tekari at sisltd.ch>
Subject: [R] better curve
To: r-help at r-project.org
Message-ID: <13880048.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii
Hi R users,
I have collected data which I plot(x,y).The problem it has oscillations.
Now i'm trying to "make better" this curve with a smooth line. And
then
collect my new datas.
But I don't know how doing this.
Perhaps a linear regression ??
See .jpeg foto.
Thanks for any help it will be given.
http://www.nabble.com/file/p13880048/Fluctuation.jpeg
--
View this message in context:
http://www.nabble.com/better-curve-tf4851053.html#a13880048
Sent from the R help mailing list archive at Nabble.com.
------------------------------
Message: 46
Date: Wed, 21 Nov 2007 08:29:00 -0800 (PST)
From: mysimbaa <adel.tekari at sisltd.ch>
Subject: [R] better curve
To: r-help at r-project.org
Message-ID: <13880048.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii
Hi R users,
I have collected data which I plot(x,y).The problem it has oscillations.
Now i'm trying to "make better" this curve with a smooth line
starting let's
say @x=300 s.
And then collect my new datas.
But I don't know how doing this.
Perhaps a linear regression ??
See .jpeg foto.
Thanks for any help it will be given.
http://www.nabble.com/file/p13880048/Fluctuation.jpeg
--
View this message in context:
http://www.nabble.com/better-curve-tf4851053.html#a13880048
Sent from the R help mailing list archive at Nabble.com.
------------------------------
Message: 47
Date: Wed, 21 Nov 2007 17:32:13 +0100
From: Uwe Ligges <ligges at statistik.uni-dortmund.de>
Subject: Re: [R] How do I import packages with the package I've built?
To: "Nutter, Benjamin" <NutterB at ccf.org>
Cc: r-help at stat.math.ethz.ch
Message-ID: <47445D8D.6060707 at statistik.uni-dortmund.de>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Nutter, Benjamin wrote:> So if I understand you correctly, if I include in my namespace file the
> command importFrom(MASS, stepAIC), whenever stepAIC is called from
> my package, it will still run even if I haven't explicitly imported the
> MASS package?
Yes.
> Or if I use the command import(survival) then the functions in
> the survival package will work within my functions even without
> explicitly loading the package?
Yes.
Uwe Ligges
> Thanks for the help.
>
> Benjamin
>
> -----Original Message-----
> From: Uwe Ligges [mailto:ligges at statistik.uni-dortmund.de]
> Sent: Saturday, November 17, 2007 12:04 PM
> To: Nutter, Benjamin
> Cc: r-help at stat.math.ethz.ch
> Subject: Re: [R] How do I import packages with the package I've built?
>
> There is a difference between importing a namespace and loading a
> package:
>
> If you import functions from a namespace into your package, these
> functions are known within that namespace, i.e. functions from your
> package's namespace know the other functions and can use them. The user
> still won't see those imported functions while working on the top
level.
> If you want the latter, you have to load the other package explicitly,
> e.g. in your .onLoad directives.
>
> Uwe Ligges
>
>
> Nutter, Benjamin wrote:
>> I have successfully completed building a package to contain the
>> functions I commonly use. However, I need to have other packages
>> installed in order for some of my functions to work. I've been
> studying
>> the instructions on installing packages for about a month now, but
> still
>> haven't figured this one out. From what I do understand, to import
>> additional packages I need some combination of commands in my
>> DESCRIPTION and NAMESPACE files. Currently, these are what mine look
>> like:
>>
>> DESCRIPTION
>> Package: myPackage
>> Type: Package
>> Title: Commonly used functions.
>> Version: 1.0
>> Date: 2007-11-08
>> Author: My Name
>> Maintainer: My Name <myfault at somewhere.net>
>> Description: Blah Blah Blah
>> License: R 2.3.0
>> Depends: MASS, survival
>>
>>
>> NAMESPACE
>> export(func1, func2, ... , funcx)
>>
>> import(MASS, survival)
>>
>>
>> These pass all the checks, and the package installs just fine, but it
>> doesn't load MASS and survival when I load myPackage. What am I
doing
>> wrong?
>>
>> Benjamin
>>
>>
>> P Please consider the environment before printing this e-mail
>>
>> Cleveland Clinic is ranked one of the top hospitals
>> in America by U.S. News & World Report (2007).
>> Visit us online at http://www.clevelandclinic.org for
>> a complete listing of our services, staff and
>> locations.
>>
>>
>> Confidentiality Note: This message is intended for
> use\...{{dropped:13}}
>> ______________________________________________
>> 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.
>
>
> ==================================>
> P Please consider the environment before printing this e-mail
>
> Cleveland Clinic is ranked one of the top hospitals
> in America by U.S. News & World Report (2007).
> Visit us online at http://www.clevelandclinic.org for
> a complete listing of our services, staff and
> locations.
>
>
> Confidentiality Note: This message is intended for use
> only by the individual or entity to which it is addressed
> and may contain information that is privileged,
> confidential, and exempt from disclosure under applicable
> law. If the reader of this message is not the intended
> recipient or the employee or agent responsible for
> delivering the message to the intended recipient, you are
> hereby notified that any dissemination, distribution or
> copying of this communication is strictly prohibited. If
> you have received this communication in error, please
> contact the sender immediately and destroy the material in
> its entirety, whether electronic or hard copy. Thank you.
>
------------------------------
Message: 48
Date: Wed, 21 Nov 2007 16:51:03 +0000
From: "Mark Wardle" <mark at wardle.org>
Subject: Re: [R] question about multiple comparison in ANOVA
To: "Qiu Anqi" <bieqa at nus.edu.sg>
Cc: r-help at stat.math.ethz.ch
Message-ID:
<b59a37130711210851q159fee08mbd36c6c1b822ffd7 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Hello.
I'm replying because you haven't had a reply. You haven't said which
system you are running or which version of different packages you have
installed.
On my system (see below for the results from running sessionInfo())
that code runs fine with no errors at all.
library(multcomp)
# Loading required package: mvtnorm
amod <- aov(minutes ~ blanket, data=recovery)
rht <- glht(amod, linfct = mcp(blanket = "Dunnett"),
alternative = "less")
rht
produces:
General Linear Hypotheses
Multiple Comparisons of Means: Dunnett Contrasts
Linear Hypotheses:
Estimate
b1 - b0 >= 0 -2.133
b2 - b0 >= 0 -7.467
b3 - b0 >= 0 -1.667
On 21/11/2007, Qiu Anqi <bieqa at nus.edu.sg>
wrote:> I am not sure whether there is a bug. When I tested the example given
> for "glht" in the help, I entered the following error:
>
>
>
> Running commands:
>
> amod <- aov(minutes ~ blanket, data = recovery)
> rht <- glht(amod, linfct = mcp(blanket = "Dunnett"),
> alternative = "less")
>
>
> Errors are:
>
> Error in try(coef.(model)) : could not find function "coef."
>
> Error in modelparm.default(model, ...) : no 'coef' method for
'model'
> found!
>
This all sounds a bit odd, and (although I am not an R expert by any
means) therefore wonder whether you have an installation problem of
some form?
my sessionInfo():
R version 2.6.0 (2007-10-03)
i386-apple-darwin8.10.1
locale:
en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
attached base packages:
[1] stats graphics grDevices datasets utils methods base
other attached packages:
[1] multcomp_0.992-6 mvtnorm_0.8-1 lattice_0.16-5 RODBC_1.2-2
loaded via a namespace (and not attached):
[1] grid_2.6.0
--
Dr. Mark Wardle
Specialist registrar, Neurology
Cardiff, UK
------------------------------
Message: 49
Date: Wed, 21 Nov 2007 11:55:45 -0500
From: "Punit Anand" <punit.anand at lusight.com>
Subject: Re: [R] Help Required in using cast (reshape package)
function
To: <r-help at r-project.org>
Message-ID:
<3F37C67A105D1C46879D27A0EC72DF5A01C52907 at cx48.800onemail.com>
Content-Type: text/plain; charset="US-ASCII"
Hello everyone,
Since the fields in variables column are unique with respect to ID and
fiscal year; any function like
sum,min,max,mean etc will lead to the desired result
Therefore cast(dataread, ID + Period ~ variable,sum)
Will lead to the desired result in my case;
Thanks,
Punit
-----Original Message-----
From: Punit Anand
Sent: Wednesday, November 21, 2007 11:21 AM
To: 'r-help at r-project.org'
Subject: Help Required in using cast (reshape package) function
Hello everyone,
I am new to R. I have data in the form of excel pivot table format and I
want to cast it into a format which can make it compatible with
computation.
Since I already have the package in pivot format; I avoid melt function
and use the cast directly.
I inspect the
dataread <- read.csv(".....", header=TRUE)
Data in the format
Id Region Country Industry
Period variable value
"Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
"2002:FY" "account payable" 10000
"Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
"2002:FY" "account receivable" 50000
"Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
"2002:FY" "XXXX" 70000
"Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
"2002:FY" "YYYY" "NA"
"Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
"2002:FY" "ZZZZ"
"Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
"2002:FY" "AAAA" 10000
"Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
"2002:FY" "ccccccc" 10000
# I want to arrange data in the format
Id Region Country Industry
Period "account payable" "account receivable"
XXXX" "YYYYY"
"ZZZZ" "AAAA" "CCCCC"
"Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
"2002:FY" 10000 50000 70000 "NA"
10000
10000
# casting the data
cast <- cast(dataread, ID + Period ~ variable)
When I do that the data is casted as a pivot with a warning "Aggregation
requires fun.aggregate: length used as default", and the casted data
gives me the count of variables (as suggested by the warning )
Id Region Country Industry
Period "account payable" "account receivable"
XXXX" "YYYYY"
"ZZZZ" "AAAA" "CCCCC"
"Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
"2002:FY" 1 1 1 NA NA 10000
10000
How do I use the fun.aggregate feature of the cast function to obtain
the desired result?
Moreover, I want to subdivide the casted data into subsets based on ids.
How do I achieve that?
Thanks in advance,
Punit Anand
------------------------------
Message: 50
Date: Wed, 21 Nov 2007 18:04:23 +0100
From: Uwe Ligges <ligges at statistik.uni-dortmund.de>
Subject: Re: [R] t.test : extracting Error
To: mogra <funnymoody999 at yahoo.com>
Cc: r-help at r-project.org
Message-ID: <47446517.30306 at statistik.uni-dortmund.de>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
mogra wrote:> Hi Thanks for the reply.
>
> I implemented your solution to my problem but ...
>
> For some of my column there is not enough data to do t-test so it gives me
> error and stops the for loop, is any graceful way to check for error msg
and
> say ok if there is no $p.value continue to the next column
See ?try
Uwe Ligges
> Once again thx for help.
>
>
>
> sata pinal wrote:
>> I have two matrix with same dimensions. I want to do t.test using each
>> column from 2 different matrix.
>> Row n Column names in both matrix are same.
>>
>> e.g.
>> Matrix1
>> id VC1 VC2 VC3
>> R 1 2 3
>> R1 4 5 6
>> R3 7 8 9
>>
>>
>> Matrix2
>> id VC1 VC2 VC3
>> R 10 11 12
>> R1 13 14 15
>> R3 16 17 18
>>
>> want to do t.test using each column (with same name ) using Matrix1 and
>> Matrix2
>>
>> for eg t.test(Matrix1$VC1, Matrix2$VC1)$p.value
>>
>> What is the best way to do it. I have dataset with 4000 columns for
each
>> matrix with same row and column names.
>>
>> Thanks a lot.
>>
>> ---------------------------------
>> Be a better sports nut! Let your teams follow you with Yahoo Mobile.
Try
>> it now.
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> 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.
>>
>>
>
------------------------------
Message: 51
Date: Wed, 21 Nov 2007 11:47:35 -0500
From: Mike Prager <mike.prager at noaa.gov>
Subject: Re: [R] Packages - a great resource, but hard to find the
right one.
To: r-help at stat.math.ethz.ch
Message-ID: <cun8k3hfc39fcvjoke1cieqtanvh6qnuhm at 4ax.com>
Content-Type: text/plain; charset=us-ascii
"John Sorkin" <jsorkin at grecc.umaryland.edu> wrote:
>>> The multitude of packages is one of the great strengths of R.
Unfortunately
there is no (or at least I am not aware of) any single source
that lists all available packages and gives a synopsis of what
each package does. One can install and load packages one-by-one
and look at the help pages to see what each package does, but
this is at best an inefficient and a worst a very frustrating
task. Might there be a way to put together a searchable database
that will allow a user to easily search for a given function or
technique in all contributed packages? <<<
Besides the excellent answers already given, don't overlook
Google. Searching on "r statistics box-cox transform" turns up
a reference to MASS as the third entry.
When programming in any language, I now find it quicker to
search for syntax (and other) help by Googling than to pull the
reference manual off the shelf or start up an online help file.
--
Mike Prager, NOAA, Beaufort, NC
* Opinions expressed are personal and not represented otherwise.
* Any use of tradenames does not constitute a NOAA endorsement.
------------------------------
Message: 52
Date: Wed, 21 Nov 2007 18:16:46 +0100 (CET)
From: Marc Bernard <bernarduse1 at yahoo.fr>
Subject: [R] Choosing the right model
To: r-help at stat.math.ethz.ch
Message-ID: <638001.73786.qm at web23409.mail.ird.yahoo.com>
Content-Type: text/plain
Dear All,
Sorry if this question may not be appropriate to this list. I have the
following question about the significance of effects in NLME. I fitted data with
nlme using the SSlogis as a specification for the conditional mean of my
dependent variable Y. When xmid and scal were considered as random, my covarite
of interest X was found to have a significant effect on xmid but not on scal.
However, when I assume that only xmid is random, the effect of my covariate X
was found to have a significant effect on both xmid and scal. Of course the AIC
and the residuals were both smaller in the firts model. Thus my question: Which
model should I select: the one that fits better to the data (i.e Model 1) or
the one that shows significant effects of my covariate (Model2). Or in another
way, Is it legitimate to use model 2?
Many thanks in advance,
Bernard
---------------------------------
[[alternative HTML version deleted]]
------------------------------
Message: 53
Date: Wed, 21 Nov 2007 11:22:03 -0600
From: "hadley wickham" <h.wickham at gmail.com>
Subject: Re: [R] Help Required in using cast (reshape package)
function
To: "Punit Anand" <punit.anand at lusight.com>
Cc: r-help at r-project.org
Message-ID:
<f8e6ff050711210922jd35e416m55b801cc2ae55677 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
On 11/21/07, Punit Anand <punit.anand at lusight.com>
wrote:> Hello everyone,
>
> Since the fields in variables column are unique with respect to ID and
> fiscal year; any function like
> sum,min,max,mean etc will lead to the desired result
You should probably check that, as the warning only occurs when
aggregation is definitely occurring.
> Therefore cast(dataread, ID + Period ~ variable,sum)
> Will lead to the desired result in my case;
If you want a list of data frames by ID, you might also want to try:
cast(dataread, Period ~ variable | ID, sum)
Hadley
> Thanks,
> Punit
>
>
>
> -----Original Message-----
> From: Punit Anand
> Sent: Wednesday, November 21, 2007 11:21 AM
> To: 'r-help at r-project.org'
> Subject: Help Required in using cast (reshape package) function
>
> Hello everyone,
>
> I am new to R. I have data in the form of excel pivot table format and I
> want to cast it into a format which can make it compatible with
> computation.
>
> Since I already have the package in pivot format; I avoid melt function
> and use the cast directly.
> I inspect the
>
> dataread <- read.csv(".....", header=TRUE)
>
> Data in the format
> Id Region Country Industry
> Period variable value
> "Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
> "2002:FY" "account payable" 10000
> "Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
> "2002:FY" "account receivable" 50000
> "Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
> "2002:FY" "XXXX" 70000
> "Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
> "2002:FY" "YYYY" "NA"
> "Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
> "2002:FY" "ZZZZ"
> "Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
> "2002:FY" "AAAA" 10000
> "Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
> "2002:FY" "ccccccc" 10000
>
> # I want to arrange data in the format
> Id Region Country Industry
> Period "account payable" "account receivable"
XXXX" "YYYYY"
> "ZZZZ" "AAAA" "CCCCC"
> "Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
> "2002:FY" 10000 50000 70000 "NA"
10000
> 10000
>
> # casting the data
> cast <- cast(dataread, ID + Period ~ variable)
>
> When I do that the data is casted as a pivot with a warning
"Aggregation
> requires fun.aggregate: length used as default", and the casted data
> gives me the count of variables (as suggested by the warning )
>
> Id Region Country Industry
> Period "account payable" "account receivable"
XXXX" "YYYYY"
> "ZZZZ" "AAAA" "CCCCC"
> "Aaa11 xx" "Latin America" "Mexico"
"food & beverages"
> "2002:FY" 1 1 1 NA NA 10000
> 10000
>
> How do I use the fun.aggregate feature of the cast function to obtain
> the desired result?
>
> Moreover, I want to subdivide the casted data into subsets based on ids.
> How do I achieve that?
>
>
> Thanks in advance,
>
> Punit Anand
>
> ______________________________________________
> 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.
>
--
http://had.co.nz/
------------------------------
Message: 54
Date: Wed, 21 Nov 2007 09:51:36 -0800
From: "Charles C. Berry" <cberry at tajo.ucsd.edu>
Subject: Re: [R] uniq -c
To: Henrique Dallazuanna <wwwhsd at gmail.com>
Cc: r-help at r-project.org
Message-ID: <Pine.LNX.4.64.0711210938550.8417 at tajo.ucsd.edu>
Content-Type: text/plain; charset="iso-8859-1"
A further tip:
subset(as.data.frame(xtabs( ~. , dat )), Freq != 0 )
Comes very close to generating output along the lines of what
'sort | uniq -c'
provides (if this is what was wanted rather than rle() ) and works for
multiple columns of data. The count becomes the last column (labelled
'Freq'); it is trivial to reorder columns if needed.
HTH,
Chuck
On Wed, 21 Nov 2007, Henrique Dallazuanna wrote:
> See ?table function.
>
> On 21/11/2007, Alexy Khrabrov <deliverable at gmail.com> wrote:
>> Is there an R analog of the Unix command uniq -c:
>>
>> http://en.wikipedia.org/wiki/Uniq
>>
>> Given an array x, uniq -c replaces each contiguous subsequence of
>> identical numbers with a tuple (count, number). E.g.
>>
>> $ cat > usample
>> 10
>> 10
>> 9
>> 8
>> 8
>> 7
>> 7
>> 7
>> 6
>> 3
>> 1
>> 1
>> 1
>> 0
>> $ uniq -c usample
>> 2 10
>> 1 9
>> 2 8
>> 3 7
>> 1 6
>> 1 3
>> 3 1
>> 1 0
>>
>> Cheers,
>> Alexy
>>
>> ______________________________________________
>> 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.
>>
>
>
> --
> Henrique Dallazuanna
> Curitiba-Paran?-Brasil
> 25? 25' 40" S 49? 16' 22" O
>
> ______________________________________________
> 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.
>
Charles C. Berry (858) 534-2098
Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901
------------------------------
Message: 55
Date: Wed, 21 Nov 2007 09:57:09 -0800
From: Julian Burgos <jmburgos at u.washington.edu>
Subject: Re: [R] better curve
To: mysimbaa <adel.tekari at sisltd.ch>
Cc: r-help at r-project.org
Message-ID: <47447175.8080301 at u.washington.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hello Mysimbaa,
If you want to fit a smooth line to your data, there are many ways to do
it. One option is to use splines. See the smooth.spline() function.
If you only want to add a line to highlight the trend in your data, that
should be enough. But if you want to do more serious analytical work,
it is probably a good idea to learn about the different methods, its
assumptions and limitations.
Julian
mysimbaa wrote:> http://www.nabble.com/file/p13880048/Fluctuation.jpeg
>
> Hi R users,
>
> I have collected data which I plot(x,y).The problem it has oscillations.
> Now i'm trying to "make better" this curve with a smooth
line. And then
> collect my new datas.
> But I don't know how doing this.
>
> Perhaps a linear regression ??
>
> See .jpeg foto.
>
> Thanks for any help it will be given.
------------------------------
Message: 56
Date: Wed, 21 Nov 2007 10:35:32 -0800
From: Julian Burgos <jmburgos at u.washington.edu>
Subject: Re: [R] Reconstruct array dataset
To: marcg <mdgi at gmx.ch>
Cc: r-help at stat.math.ethz.ch
Message-ID: <47447A74.4060604 at u.washington.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hey Marc,
You can use the function scan() directly to read your file as a single
vector. Then, as Rob suggested, use the matrix function to give it the
dimensions you want.
Other option (perhaps less elegant) is to do something like this.
x=read.table (myfile,...etc.etc.)
x=as.vector(as.matrix(x))
x=matrix(x,ncol=11,byrow=T)
Julian
marcg wrote:> This was my intention, but I'm not able to read it in as a vector
(because i don't know the function, neither I can convert the read in table
to a vector and then to matrix or directly.
>
> What did I miss or where do I have to look up?
>
> thanks alot
>
> marc
> -------- Original-Nachricht --------
>> Datum: Wed, 21 Nov 2007 14:17:41 -0000
>> Von: "Rob Robinson" <rob.robinson at bto.org>
>> An: "\'marcg\'" <mdgi at gmx.ch>
>> CC: r-help-bounces at r-project.org
>> Betreff: RE: [R] Reconstruct array dataset
>
>> Can you not read it into a single vector and then use as.matrix to
shape
>> it
>> into a an appropriate sized matrix?
>> Cheers
>> rob
>>
>> *** Wan==t to know about Britain's birds? Try
www.bto.org/birdfacts ***
>>
>> Dr Rob Robinson, Senior Population Biologist
>> British Trust for Ornithology, The Nunnery, Thetford, Norfolk, IP24 2PU
>> Ph: +44 (0)1842 750050 E: rob.robinson at bto.org
>> Fx: +44 (0)1842 750030 W: http://www.bto.org
>>
>> ==== "How can anyone be enlightened, when truth is so poorly
lit" ====>>
>>
>>> -----Original Message-----
>>> From: r-help-bounces at r-project.org
>>> [mailto:] On Behalf Of marcg
>>> Sent: 21 November 2007 14:08
>>> To: r-help at stat.math.ethz.ch
>>> Subject: [R] Reconstruct array dataset
>>>
>>> Hi there
>>>
>>> I have an interesting problem:
>>>
>>> My csv file is of array dimensions [12,50], but it was saved
>>> the wrong way: there should be only 11 colums. What happens
>>> now if I read it into R is that the whole data set is shifted
>>> ( in the first row, the last column contains already the
>>> first value of the supposed second row and so on...)
>>>
>>> how can I tell R to switch after 11 read values to the next
>>> row, taking the value from column 12 as first in the new row
>>> (for row 3 the two second last of the upper row etc...)
>>>
>>> Thanks for suggestions
>>>
>>> marc
>>> --
>>> Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten
>>>
>>> ______________________________________________
>>> 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.
>>>
>
> --
>
> ______________________________________________
> 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.
------------------------------
Message: 57
Date: Wed, 21 Nov 2007 14:30:41 -0500 (EST)
From: Gregory Gentlemen <gregory_gentlemen at yahoo.ca>
Subject: [R] matrix elementwise average with NA's
To: r-help at r-project.org
Message-ID: <465850.116.qm at web63505.mail.re1.yahoo.com>
Content-Type: text/plain
Hello fellow R users,
I have a matrix computation that I imagine should be relatively easy to do,
however I cannot figure out a nice way to do it. I have two matrices, for
example
mat1 <- matrix(c(1:5,rep(NA,5), 6:10), nrow=3, byrow=T)
mat2 <- matrix(c(2:6, 6:10, rep(NA,5)), nrow=3, byrow=T)
I'd like to compute the element-wise average for non-NA entries. Of course
(mat1+mat2)/2
does not work for the final two rows because of the NA's. Are there any
elegant ways to accopmlish this without writing a loop with indices?
Thanks in advance for any assistance.
Greg
---------------------------------
[[alternative HTML version deleted]]
------------------------------
Message: 58
Date: Wed, 21 Nov 2007 11:53:36 -0800 (PST)
From: Felipe Carrillo <mazatlanmexico at yahoo.com>
Subject: [R] ggplot2 axis labels
To: r-help at stat.math.ethz.ch
Message-ID: <526606.40259.qm at web56610.mail.re3.yahoo.com>
Content-Type: text/plain; charset=iso-8859-1
Hi:
Does anyone(Hadley?)know how to change the axis labels
with the new version of ggplot2? With the old version
I used the code below:
grid.gedit("label", gp=gpar(fontsize=10, col="blue"))
Thanks
Felipe D. Carrillo
Fishery Biologist
US Fish & Wildlife Service
California, USA
____________________________________________________________________________________
Be a better sports nut! Let your teams follow you
------------------------------
Message: 59
Date: Wed, 21 Nov 2007 13:01:16 -0700
From: "Matthew Keller" <mckellercran at gmail.com>
Subject: Re: [R] matrix elementwise average with NA's
To: "Gregory Gentlemen" <gregory_gentlemen at yahoo.ca>
Cc: r-help at r-project.org
Message-ID:
<3f547caa0711211201i1ee40001s545d98314d827b7f at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
Maybe there is a more elegant solution, but here is one possibility:
mat1[is.na(mat1)]<-mat2[is.na(mat1)]
mat2[is.na(mat2)]<-mat1[is.na(mat2)]
(mat1+mat2)/2
On Nov 21, 2007 12:30 PM, Gregory Gentlemen <gregory_gentlemen at
yahoo.ca> wrote:> Hello fellow R users,
>
> I have a matrix computation that I imagine should be relatively easy to do,
however I cannot figure out a nice way to do it. I have two matrices, for
example
>
> mat1 <- matrix(c(1:5,rep(NA,5), 6:10), nrow=3, byrow=T)
> mat2 <- matrix(c(2:6, 6:10, rep(NA,5)), nrow=3, byrow=T)
>
> I'd like to compute the element-wise average for non-NA entries. Of
course
>
> (mat1+mat2)/2
>
> does not work for the final two rows because of the NA's. Are there any
elegant ways to accopmlish this without writing a loop with indices?
>
> Thanks in advance for any assistance.
>
> Greg
>
>
>
> ---------------------------------
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>
--
Matthew C Keller
Asst. Professor of Psychology
University of Colorado at Boulder
www.matthewckeller.com
------------------------------
Message: 60
Date: Wed, 21 Nov 2007 13:10:26 -0700
From: "Greg Snow" <Greg.Snow at intermountainmail.org>
Subject: Re: [R] Changing axis scale
To: "mysimbaa" <adel.tekari at sisltd.ch>, r-help at
r-project.org
Message-ID:
<07E228A5BE53C24CAD490193A7381BBBD13AD1 at LP-EXCHVS07.CO.IHC.COM>
Content-Type: text/plain; charset=us-ascii
The zoomplot function in the TeachingDemos package does this. Note
however that it is a quick and dirty kludge that should only be used for
quick exploring. If you plan to use the graph for anything more than
suggesting the next graph to make, then you should rerun the graphics
command setting the xlim or ylim parameters to what you want (and in my
opinion any plot command more than 1 line long (and even some 1 liners)
should be copied into a script window/file so that it is easy to edit
and rerun them (the plot2script function in TeachingDemos (another
kludge) or the history function in base (better) can help create the
script)).
Hope this helps,
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at intermountainmail.org
(801) 408-8111
> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of mysimbaa
> Sent: Wednesday, November 21, 2007 7:53 AM
> To: r-help at r-project.org
> Subject: [R] Changing axis scale
>
>
> Hello R users,
>
> Is it possible after making a plot(x,y) to change axis scale?
> For example : I have a range of 0 to 3000 in my y-axis and I
> want to make a zoom between 2000 and 3000.
>
>
> Thanks for any help.
> --
> View this message in context:
> http://www.nabble.com/Changing-axis-scale-tf4850633.html#a13878705
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>
------------------------------
Message: 61
Date: Wed, 21 Nov 2007 14:14:32 -0600
From: Marc Schwartz <marc_schwartz at comcast.net>
Subject: Re: [R] matrix elementwise average with NA's
To: Gregory Gentlemen <gregory_gentlemen at yahoo.ca>
Cc: r-help at r-project.org
Message-ID: <1195676072.2942.27.camel at Bellerophon.localdomain>
Content-Type: text/plain
On Wed, 2007-11-21 at 14:30 -0500, Gregory Gentlemen
wrote:> Hello fellow R users,
>
> I have a matrix computation that I imagine should be relatively easy
> to do, however I cannot figure out a nice way to do it. I have two
> matrices, for example
>
> mat1 <- matrix(c(1:5,rep(NA,5), 6:10), nrow=3, byrow=T)
> mat2 <- matrix(c(2:6, 6:10, rep(NA,5)), nrow=3, byrow=T)
>
> I'd like to compute the element-wise average for non-NA entries. Of
> course
>
> (mat1+mat2)/2
>
> does not work for the final two rows because of the NA's. Are there
> any elegant ways to accopmlish this without writing a loop with
> indices?
>
> Thanks in advance for any assistance.
>
> Greg
Is this what you want?
> matrix(colMeans(rbind(as.vector(mat1), as.vector(mat2)),
na.rm = TRUE), dim(mat1))
[,1] [,2] [,3] [,4] [,5]
[1,] 1.5 2.5 3.5 4.5 5.5
[2,] 6.0 7.0 8.0 9.0 10.0
[3,] 6.0 7.0 8.0 9.0 10.0
?
HTH,
Marc Schwartz
------------------------------
Message: 62
Date: Wed, 21 Nov 2007 21:37:37 +0100
From: "Joren Heit" <jorenheit at gmail.com>
Subject: [R] fitting a line to a logaritmic plot
To: r-help at r-project.org
Message-ID:
<1ec68d8f0711211237j6c4787ecy8511624bf51608b7 at mail.gmail.com>
Content-Type: text/plain
Hi,
I have processed measurements of a rough surface to a heigh-height
correlation plot. What the meaning of this exactly is, is not important.
Only that it is a plot that had two (almost ) linear parts when plotted on a
logaritmic scale. In this plot, I want to draw the best fitting lines for
these linear parts but I just can't get it done. It is easy when the scales
are linear but as you might have imagined, the scales being logarithmic
don't add to the simplicity of my problem.
Thanks in advance!
Joren
[[alternative HTML version deleted]]
------------------------------
Message: 63
Date: Wed, 21 Nov 2007 14:45:38 -0600
From: "Maura E Monville" <maura.monville at gmail.com>
Subject: [R] How can I save a plot ?
To: r-help at stat.math.ethz.ch
Message-ID:
<36d691950711211245k515494dft8ccaa5a22fff254c at mail.gmail.com>
Content-Type: text/plain
I recently installed R 2.6 on Linux/SuSE
When I was running the previous version on Windows I was able to save my
plots from a script.
There was a command "savePlot" that is no more retrieved in the last
version.
In this scenario, how can I tell R to save the currently displayed plot to a
file ?
The "save" command is generic and do not know how to tell R that the
plot is
to be saved using this command.
In addition, is it possible with R to have more than one plot, that is more
than one graphic window opened at the same time ?
Thank you so much.
Regards,
--
Maura E.M
[[alternative HTML version deleted]]
------------------------------
Message: 64
Date: Wed, 21 Nov 2007 14:49:11 -0600
From: "hadley wickham" <h.wickham at gmail.com>
Subject: Re: [R] ggplot2 axis labels
To: "Felipe Carrillo" <mazatlanmexico at yahoo.com>
Cc: r-help at stat.math.ethz.ch
Message-ID:
<f8e6ff050711211249l4da22fw88ab383c89edda0c at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
That should still work? If it doesn't, you should be able to figure
out what the new element name is by following the recipe in the last
chapter of the ggplot book.
Hadley
On 11/21/07, Felipe Carrillo <mazatlanmexico at yahoo.com>
wrote:> Hi:
> Does anyone(Hadley?)know how to change the axis labels
> with the new version of ggplot2? With the old version
> I used the code below:
> grid.gedit("label", gp=gpar(fontsize=10, col="blue"))
> Thanks
>
> Felipe D. Carrillo
> Fishery Biologist
> US Fish & Wildlife Service
> California, USA
>
>
>
>
____________________________________________________________________________________
> Be a better sports nut! Let your teams follow you
>
> ______________________________________________
> 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.
>
--
http://had.co.nz/
------------------------------
Message: 65
Date: Wed, 21 Nov 2007 13:10:08 -0800
From: "Correia, James" <james.correia at pnl.gov>
Subject: [R] R 2.6.0 Error in X11() : could not find X11 fonts
To: <r-help at r-project.org>
Message-ID: <A8E8BC8BEF32F74DB9DF2AC069BC470DAA5266 at EMAIL01.pnl.gov>
Content-Type: text/plain; charset="iso-8859-1"
All-
I have rhel4 and just installed R2.6.0. The error suggests it cant find the font
library. I have failed to trouble shoot. Can anyone help me?
Thanks
James Correia Jr
Post Doc
PH: 372-6463
james.correia at pnl.gov
"Wisdom. Strength. Courage. Generosity. Each of us are born with one of
these. We must find the other three inside of us."
-from "Into the West"
------------------------------
Message: 66
Date: Wed, 21 Nov 2007 16:12:14 -0500
From: "Eric Thompson" <ericthompso at gmail.com>
Subject: [R] Different freq returned by spec.ar() and spec.pgram()
To: r-help at r-project.org
Message-ID:
<e603d4040711211312n154e2225q5610840b938f50f3 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Dear list,
I've recently become interested in comparing the spectral estimates
using the different methods ("pgram" and "ar") in the
spectrum()
function in the stats package.
With many thanks to the authors of these complicated functions, I
would like to point out what looks to me like a bit of an
inconsistency -- but I would not be surprised if there is good
reasoning that justifies it that I am just not seeing right now. If we
use the lh data, the two methods return similar results:
> spectrum(lh, col = "blue")
> spec.ar(lh, add = TRUE)
But using the ldeaths data:
> spectrum(ldeaths, col = "blue")
> spec.ar(ldeaths, add = TRUE)
the resulting plots do not compare over the same frequency range. This
results because spec.ar defines frequency as
> freq <- seq.int(0, 0.5, length.out = n.freq)
whereas spec.pgram uses
> xfreq <- frequency(x)
> N <- nrow(x)
> Nspec <- floor(N/2)
> freq <- seq.int(from = xfreq/N, by = xfreq/N, length.out = Nspec)
And so the reason the spectral estimates of lh are similar is that
frequency(lh) = 1, whereas frequency(ldeaths) = 12.
The documentation seems more extensive for spec.pgram (and the
pertinent section in MASS focuses on spec.pgram), and I realize that
there is a warning in ?spec.ar that AR spectra can be misleading. But
is there a reason that I am not aware of that the frequencies of the
AR spectra are defined in this way? It seems to me that it would be
desirable for frequency to be defined over the same range as in
spec.pgram. All that would need to be added would be a line to scale
the freq vector using the sampling frequency before it is returned.
Eric Thompson
Graduate Student
Dept. of Civil & Env. Eng.
Tufts University
> sessionInfo()
R version 2.6.0 (2007-10-03)
i686-pc-linux-gnu
locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C
attached base packages:
[1] datasets utils stats graphics grDevices methods base
other attached packages:
[1] MASS_7.2-37
loaded via a namespace (and not attached):
[1] rcompgen_0.1-17
------------------------------
Message: 67
Date: Wed, 21 Nov 2007 13:14:02 -0800
From: Bert Gunter <gunter.berton at gene.com>
Subject: Re: [R] How can I save a plot ?
To: "'Maura E Monville'" <maura.monville at gmail.com>,
<r-help at stat.math.ethz.ch>
Message-ID: <00a601c82c83$70f9dbe0$3a0b2c0a at gne.windows.gene.com>
Content-Type: text/plain; charset="us-ascii"
Maura:
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On
Behalf Of Maura E Monville
Sent: Wednesday, November 21, 2007 12:46 PM
To: r-help at stat.math.ethz.ch
Subject: [R] How can I save a plot ?
I recently installed R 2.6 on Linux/SuSE
When I was running the previous version on Windows I was able to save my
plots from a script.
There was a command "savePlot" that is no more retrieved in the last
version.
-- Only in Windows devices, AFAIK.
In this scenario, how can I tell R to save the currently displayed plot to a
file ?
see (e.g) ?pdf, ?dev.copy and other ?dev.xxx Help.
The "save" command is generic and do not know how to tell R that the
plot is
to be saved using this command.
-- This saves the workspace, not graphs
In addition, is it possible with R to have more than one plot, that is more
than one graphic window opened at the same time ?
-- Yes. ?dev.cur, etc.
Thank you so much.
Regards,
--
Maura E.M
[[alternative HTML version deleted]]
______________________________________________
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.
------------------------------
Message: 68
Date: Wed, 21 Nov 2007 22:03:46 +0000 (GMT)
From: Prof Brian Ripley <ripley at stats.ox.ac.uk>
Subject: Re: [R] Different freq returned by spec.ar() and spec.pgram()
To: Eric Thompson <ericthompso at gmail.com>
Cc: r-help at r-project.org
Message-ID: <Pine.LNX.4.64.0711212143530.25098 at gannet.stats.ox.ac.uk>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Frequency has units (1/wavelength), and this is just a question of using
different units. For monthly series, is this per month or per year?
The functions were written for R at different times by different people:
it would seem to make sense to alter spec.ar to use the per year
interpretation. It would be unusual to use spec.ar on a series with known
frequency (I have never seen it done), and it is arguable that the per-lag
interpretation is more natural for that method.
On Wed, 21 Nov 2007, Eric Thompson wrote:
> Dear list,
>
> I've recently become interested in comparing the spectral estimates
> using the different methods ("pgram" and "ar") in the
spectrum()
> function in the stats package.
>
> With many thanks to the authors of these complicated functions, I
> would like to point out what looks to me like a bit of an
> inconsistency -- but I would not be surprised if there is good
> reasoning that justifies it that I am just not seeing right now. If we
> use the lh data, the two methods return similar results:
>
>> spectrum(lh, col = "blue")
>> spec.ar(lh, add = TRUE)
>
> But using the ldeaths data:
>
>> spectrum(ldeaths, col = "blue")
>> spec.ar(ldeaths, add = TRUE)
>
> the resulting plots do not compare over the same frequency range. This
> results because spec.ar defines frequency as
>
>> freq <- seq.int(0, 0.5, length.out = n.freq)
>
> whereas spec.pgram uses
>
>> xfreq <- frequency(x)
>> N <- nrow(x)
>> Nspec <- floor(N/2)
>> freq <- seq.int(from = xfreq/N, by = xfreq/N, length.out = Nspec)
>
> And so the reason the spectral estimates of lh are similar is that
> frequency(lh) = 1, whereas frequency(ldeaths) = 12.
>
> The documentation seems more extensive for spec.pgram (and the
> pertinent section in MASS focuses on spec.pgram), and I realize that
> there is a warning in ?spec.ar that AR spectra can be misleading. But
> is there a reason that I am not aware of that the frequencies of the
> AR spectra are defined in this way? It seems to me that it would be
> desirable for frequency to be defined over the same range as in
> spec.pgram. All that would need to be added would be a line to scale
> the freq vector using the sampling frequency before it is returned.
>
> Eric Thompson
> Graduate Student
> Dept. of Civil & Env. Eng.
> Tufts University
>
>> sessionInfo()
> R version 2.6.0 (2007-10-03)
> i686-pc-linux-gnu
>
> locale:
>
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C
>
> attached base packages:
> [1] datasets utils stats graphics grDevices methods base
>
> other attached packages:
> [1] MASS_7.2-37
>
> loaded via a namespace (and not attached):
> [1] rcompgen_0.1-17
>
> ______________________________________________
> 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.
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
------------------------------
Message: 69
Date: Thu, 22 Nov 2007 09:47:45 +1100
From: Gad Abraham <g.abraham at ms.unimelb.edu.au>
Subject: Re: [R] Frailty
To: david at clyde66.wanadoo.co.uk
Cc: "R-help at lists.R-project.org" <R-help at
stat.math.ethz.ch>
Message-ID: <4744B591.3090805 at ms.unimelb.edu.au>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
David wrote:> Hi
> Which package(s) is R fit frailty models to univariate survival data, i.e.
simple data with one survival time per person.
I haven't used it myself, but have a look at ?frailty in the survival
package.
--
Gad Abraham
Department of Mathematics and Statistics
The University of Melbourne
Parkville 3010, Victoria, Australia
email: g.abraham at ms.unimelb.edu.au
web: http://www.ms.unimelb.edu.au/~gabraham
------------------------------
Message: 70
Date: Wed, 21 Nov 2007 14:55:04 -0800
From: "Xianqun (Wilson) Wang" <xwang at aviaradx.com>
Subject: [R] survest and survfit.coxph returned different confidence
intervals on estimation of survival probability at 5 year
To: <r-help at stat.math.ethz.ch>
Message-ID:
<425B10826271C048A4F65FC6C810F5D638E60A at mail.arcturusag.local>
Content-Type: text/plain
I wonder if anyone know why survest (a function in Design package) and
standard survfit.coxph (survival) returned different confidence
intervals on survival probability estimation (say 5 year).
I am trying to estimate the 5-year survival probability on a continuous
predictor (e.g. Age in this case). Here is what I did based on an
example in "help cph". The 95% confidence intervals returned by
survfit.coxph and survest seem different.
### Create example dataset
n <- 1000
set.seed(731)
age <- 50 + 12*rnorm(n)
label(age) <- "Age"
sex <- factor(sample(c('Male','Female'), n, TRUE))
cens <- 15*runif(n)
h <- .02*exp(.04*(age-50)+.8*(sex=='Female'))
dt <- -log(runif(n))/h
label(dt) <- 'Follow-up Time'
e <- ifelse(dt <= cens,1,0)
dt <- pmin(dt, cens)
units(dt) <- "Year"
dd <- datadist(age, sex)
options(datadist='dd')
Srv <- Surv(dt,e)
### Use Design package cph and survest to estimate 5-year survival and
its 95% CI.
library(Design)
par(mfrow=c(1,2), pty="s")
fd <- cph(Srv ~ age, x=TRUE, y=TRUE, surv=T)
tmp <- survest(fd, newdata= age, times=5)
dd.plot <- data.frame(age=age, lower=tmp$lower[,1], surv=tmp$surv[,1],
upper=tmp$upper[,1])
oo <- order(age)
dd.plot <- dd.plot[oo,]
matplot(dd.plot$age, dd.plot[,-1], col=c(2,1,2), type="l",
lty=c(4,1,4),
xlab="Age", ylab="Survival Prob", main="Use cph,
survest")
### Use coxph and survfit to estimate 5-year survival and its 95% CI.
detach(package:Design)
fs <- coxph(Srv ~ age, x=T, y=T)
tmp <- survfit(fs, newdata= data.frame(age=age))
tm <- max((1:length(tmp$time))[tmp$time <= 5 + 1e-6])
ds.plot <- data.frame(age=age, lower=tmp$lower[tm, ], surv=tmp$surv[tm,
], upper=tmp$upper[tm, ])
oo <- order(age)
ds.plot <- ds.plot[oo,]
matplot(ds.plot$age, ds.plot[,-1], col=c(2,1,2), type="l",
lty=c(4,1,4),
xlab="Age", ylab="Survival Prob", main="Use coxph,
survfit")
#### The estimated 95% CI are different between survfit.coxph and
survest
> ii=(1:nrow(dd.plot))[(dd.plot$age>58 & dd.plot$age<59)]
> dd.plot[ii,] ### Estimation by cph + survest
age lower surv upper
95 58.18543 0.8098515 0.8144546 0.8189590
719 58.23063 0.8094270 0.8141218 0.8187143
573 58.34560 0.8083436 0.8132730 0.8180904
763 58.37432 0.8080720 0.8130605 0.8179343
33 58.51589 0.8067287 0.8120095 0.8171628
560 58.54394 0.8064616 0.8118006 0.8170096
11 58.56214 0.8062881 0.8116650 0.8169102
269 58.56323 0.8062777 0.8116569 0.8169042
993 58.60200 0.8059077 0.8113677 0.8166922
506 58.67991 0.8051621 0.8107854 0.8162654
433 58.72130 0.8047651 0.8104754 0.8160384
583 58.72179 0.8047604 0.8104717 0.8160357
958 58.72254 0.8047532 0.8104661 0.8160316
125 58.73593 0.8046245 0.8103657 0.8159581
42 58.76653 0.8043304 0.8101361 0.8157900
992 58.78134 0.8041878 0.8100249 0.8157086
988 58.85797 0.8034489 0.8094486 0.8152869
618 58.93011 0.8027511 0.8089047 0.8148891
199 58.94150 0.8026407 0.8088186 0.8148262
475 58.97280 0.8023370 0.8085821 0.8146533
### Estimation by coxph + survfit> ds.plot[ii,]
age lower surv upper
95 58.18543 0.7844845 0.8144546 0.8455696
719 58.23063 0.7840935 0.8141218 0.8453001
573 58.34560 0.7830952 0.8132730 0.8446138
763 58.37432 0.7828450 0.8130605 0.8444422
33 58.51589 0.7816067 0.8120095 0.8435949
560 58.54394 0.7813603 0.8118006 0.8434268
11 58.56214 0.7812004 0.8116650 0.8433177
269 58.56323 0.7811908 0.8116569 0.8433112
993 58.60200 0.7808496 0.8113677 0.8430786
506 58.67991 0.7801619 0.8107854 0.8426109
433 58.72130 0.7797957 0.8104754 0.8423622
583 58.72179 0.7797913 0.8104717 0.8423592
958 58.72254 0.7797847 0.8104661 0.8423547
125 58.73593 0.7796660 0.8103657 0.8422742
42 58.76653 0.7793946 0.8101361 0.8420902
992 58.78134 0.7792630 0.8100249 0.8420011
988 58.85797 0.7785811 0.8094486 0.8415397
618 58.93011 0.7779371 0.8089047 0.8411050
199 58.94150 0.7778352 0.8088186 0.8410363
475 58.97280 0.7775549 0.8085821 0.8408474
Wilson Wang
AviaraDx Inc.
xwang at aviaradx.com
[[alternative HTML version deleted]]
------------------------------
Message: 71
Date: Wed, 21 Nov 2007 20:58:48 -0200 (BRST)
From: Paulo Justiniano Ribeiro Jr <paulojus at c3sl.ufpr.br>
Subject: Re: [R] How can I save a plot ?
To: Maura E Monville <maura.monville at gmail.com>
Cc: r-help at stat.math.ethz.ch
Message-ID: <Pine.LNX.4.58.0711212056170.27554 at bowmore.c3sl.ufpr.br>
Content-Type: TEXT/PLAIN; charset=US-ASCII
have a look at:
help(dev.print)
(there are a few functions documented there and you can choose which one
suits better your needs)
concerning multiple graphics devices just open another one,
for instance with
x11()
havina a look at
help(dev.set)
will provide further usrful information on the control of the gra[phical
windows
Paulo Justiniano Ribeiro Jr
LEG (Laboratorio de Estatistica e Geoinformacao)
Universidade Federal do Parana
Caixa Postal 19.081
CEP 81.531-990
Curitiba, PR - Brasil
Tel: (+55) 41 3361 3573
Fax: (+55) 41 3361 3141
e-mail: paulojus AT ufpr br
http://www.leg.ufpr.br/~paulojus
-------------------------------------------------------------------------
53a Reuniao Anual da Regiao Brasileira da Soc. Internacional de Biometria
14 a 16/05/2008, UFLA, Lavras,MG
http://www.centenario.ufla.br/
-------------------------------------------------------------------------
On Wed, 21 Nov 2007, Maura E Monville wrote:
> I recently installed R 2.6 on Linux/SuSE
> When I was running the previous version on Windows I was able to save my
> plots from a script.
> There was a command "savePlot" that is no more retrieved in the
last
> version.
> In this scenario, how can I tell R to save the currently displayed plot to
a
> file ?
> The "save" command is generic and do not know how to tell R that
the plot is
> to be saved using this command.
>
> In addition, is it possible with R to have more than one plot, that is more
> than one graphic window opened at the same time ?
>
> Thank you so much.
>
> Regards,
> --
> Maura E.M
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>
------------------------------
Message: 72
Date: Thu, 22 Nov 2007 12:19:11 +1300
From: "Patrick Connolly" <PConnolly at hortresearch.co.nz>
Subject: [R] Vanishing Font Path
To: <r-help at r-project.org>
Message-ID: <332ce420001aabb4 at hortresearch.co.nz>
Content-Type: text/plain; charset="us-ascii"
platform i686-pc-linux-gnu
arch i686
os linux-gnu
system i686, linux-gnu
status
major 2
minor 6.0
year 2007
month 10
day 03
svn rev 43063
language R
version.string R version 2.6.0 (2007-10-03)
Linux version: RHEL3
This worked happily for quite some time but suddenly, I received
this message:
> x11()
Error in x11() :
could not find any X11 fonts
Check that the Font Path is correct.
I can't think of what could have happened to have changed anything.
So I tried this:
$ /usr/sbin/chkfontpath -l
Current directories in font path:
1: /usr/X11R6/lib/X11/fonts/misc:unscaled
2: /usr/X11R6/lib/X11/fonts/75dpi:unscaled
3: /usr/X11R6/lib/X11/fonts/100dpi:unscaled
4: /usr/X11R6/lib/X11/fonts/misc
5: /usr/X11R6/lib/X11/fonts/Type1
6: /usr/X11R6/lib/X11/fonts/Speedo
7: /usr/X11R6/lib/X11/fonts/cyrillic
8: /usr/X11R6/lib/X11/fonts/TTF
9: /usr/share/fonts/default/Type1
10:
I don't know what one would normally expect to see there, so I don't
know
if that's strange or not. The space after the 10: looks suspicious I
must
admit but it might be as it should.
I notice in the archives that some people had a problem getting the font
path set in the first place, but that can't be the case here.
Someone had a problem with Gentoo but doesn't seem to have any
responses.
Either that or the threading not working at
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/71651.html makes it
tricky to find one. In any case that one doesn't appear to have worked
previously anyway.
The only thing I can think of which might have made a difference is my
addition to my .Rprofile to change the default device. However,
removing that change did not fix the problem.
Nothing else has a problem (including the pdf plotting device), so it's
not exactly a disaster, but I'd like to know how it could have arisen.
TIA
Patrick Connolly
------------------------------
Message: 73
Date: Wed, 21 Nov 2007 17:42:28 -0600
From: "Maura E Monville" <maura.monville at gmail.com>
Subject: [R] Plotting + saving to file on Linux
To: r-help at stat.math.ethz.ch
Message-ID:
<36d691950711211542u450f5c57v2fb5c97f486ec5f1 at mail.gmail.com>
Content-Type: text/plain
Thanks to all those of you who answered my question about how to save a plot
to a file.
But now I have another problem. That is I wish to see / examine the plot on
the screen in advance of saving it to a file. If I launch X11() or pdf() or
Poscript() the plot does not appear on my screen .. So I have to save it
blindly ??
Thank you again
--
Maura E.M
[[alternative HTML version deleted]]
------------------------------
Message: 74
Date: Wed, 21 Nov 2007 16:56:46 -0800 (PST)
From: Moshe Olshansky <m_olshansky at yahoo.com>
Subject: Re: [R] if ( expr )
To: Gregory Wall <gdwall at ucdavis.edu>, r-help at r-project.org
Message-ID: <839148.20357.qm at web32209.mail.mud.yahoo.com>
Content-Type: text/plain; charset=iso-8859-1
How about
if (is.na(c(x,1))[1]) .......
--- Gregory Wall <gdwall at ucdavis.edu> wrote:
>
> Hello,
>
> I've searched the list but haven't found anything
> really applicable to my
> question. Any advice would be super.
>
> I'm working on a snippet of R code and I have a
> function with a prototype
> like this:
>
> foo <- function( x, ... ){
> if( is.na(x)[1] ) {etc...}
> }
>
> Where x is typically a vector of bools.
>
> At times, however, x can be NA, and yet at other
> super rare times x can be
> the result of this type of comparison:
>
> c(4,5,13,2,3,4,5,7) == numeric(0)
>
> which produces logical(0). When this is the case,
> if( is.na(x)[1] ) isn't
> happy.
>
> I'm trying to create a condition to my "if"
> statement inside foo that only
> is true when x is NA but that doesn't die when its a
> logical(0).
>
> Any suggestions on how best to approach this?
>
> As always, thanks a bunch,
>
> Greg
>
> ______________________________________________
> 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.
>
------------------------------
Message: 75
Date: Wed, 21 Nov 2007 21:43:07 -0500
From: "affy snp" <affysnp at gmail.com>
Subject: [R] Heatmap problem
To: r-help at r-project.org
Message-ID:
<5032046e0711211843y2eebdb9eia0ab282a63a3a8ff at mail.gmail.com>
Content-Type: text/plain
Hi friends,
I used heatmap(as.matrix(y2),col=rainbow(256),scale = "column") to
generate the heatmap. But it did not show the code that which
color correspond the value. Is there any parameter for this in
heatmap()?
Thanks a lot!
Allen
[[alternative HTML version deleted]]
------------------------------
Message: 76
Date: Thu, 22 Nov 2007 10:50:59 +0800 (CST)
From: <wujinja at yahoo.com.tw>
Subject: [R] wujinja at yahoo.com.tw
To: r-help at r-project.org
Message-ID: <283458.45059.qm at web73005.mail.tp2.yahoo.com>
Content-Type: text/plain
Welcome to the R-help at r-project.org mailing list! To post to this list,
send your email to: r-help at r-project.org General information about
the mailing list is at: https://stat.ethz.ch/mailman/listinfo/r-help If
you ever want to unsubscribe or change your options (eg, switch to or from
digest mode, change your password, etc.), visit your subscription page at:
https://stat.ethz.ch/mailman/options/r-help/wujinja%40yahoo.com.tw You can
also make such adjustments via email by sending a message to:
R-help-request at r-project.org with the word `help' in the subject or
body (don't include the quotes), and you will get back a message with
instructions. You must know your password to change your options (including
changing the password, itself) or to unsubscribe. It is: wi6092
Normally, Mailman will remind you of your r-project.org mailing list passwords
once every month, although you can disable this if you
prefer. This reminder
will also include instructions on how to unsubscribe or change your account
options. There is also a button on your options page that will email your
current password to you.
var callCount = 0; function rmvScroll( msg ) { if ( ++callCount > 10 ) {
msg.style.visibility = "visible"; } if ( callCount
msg.clientHeight ) { newHeight = msg.scrollHeight + delta; } delta =
msg.offsetWidth - msg.clientWidth; delta = ( isNaN( delta )? 1 : delta + 1 );
if ( msg.scrollWidth > msg.clientWidth ) { newWidth = msg.scrollWidth +
delta; } msg.style.overflow = "visible"; msg.style.visibility =
"visible"; if ( newWidth > 0 || newHeight > 0 ) { var
ssxyzzy = document.getElementById( "ssxyzzy" ); var cssAttribs =
['#' + msg.id + '{']; if ( newWidth > 0 ) cssAttribs.push(
'width:' + newWidth + 'px;' ); if ( newHeight > 0 )
cssAttribs.push( ' height:' + newHeight + 'px;' );
cssAttribs.push( '}' ); try { ssxyzzy.sheet.deleteRule( 0 );
ssxyzzy.sheet.insertRule( cssAttribs.join(""), 0 ); } catch( e ){} }
} function imgsDone( msg ) // for Firefox, we need to scan for images that
haven't set their width yet { var
imgList msg.getElementsByTagName( "IMG" ); var len = ((imgList ==
null)? 0 : imgList.length); for ( var i = 0; i
___________________________________________________________________
????Yahoo!??????2.0 - ?????
[[alternative HTML version deleted]]
------------------------------
Message: 77
Date: Wed, 21 Nov 2007 19:15:27 -0800 (PST)
From: Moshe Olshansky <m_olshansky at yahoo.com>
Subject: Re: [R] tapply, mean and subset
To: c18g at uni-bremen.de, r-help at r-project.org
Message-ID: <460224.21700.qm at web32211.mail.mud.yahoo.com>
Content-Type: text/plain; charset=iso-8859-1
One possibility is:
a<-" V1 V2 F1
+ 1 A 2 0
+ 2 A 3 0
+ 3 A 4 1
+ 4 B 3 0
+ 5 B 2 1
+ 6 C 6 0
+ 7 C 2 0
+ 8 C 6 0
+ "
b<-read.table(textConnection(a),header=TRUE)
f<-rep(0,dim(b)[1])
f[b$F1==0] <- ave(b$V2[b$F1==0],b$V1[b$F1==0])
cbind(b,f)
V1 V2 F1 f
1 A 2 0 2.500000
2 A 3 0 2.500000
3 A 4 1 0.000000
4 B 3 0 3.000000
5 B 2 1 0.000000
6 C 6 0 4.666667
7 C 2 0 4.666667
8 C 6 0 4.666667
--- c18g at uni-bremen.de wrote:
> Dear list,
>
> I have this dataframe
>
> V1 V2 F1
> 1 A 2 0
> 2 A 3 0
> 3 A 4 1
> 4 B 3 0
> 5 B 2 1
> 6 C 6 0
> 7 C 2 0
> 8 C 6 0
>
> and would like to calculate a new column
> with mean-values, following this rule
>
> 1. If F1 = 0 calculate the mean from V2
> for each factor in V1.
>
> 2. If F1 = 1, then F1_mean = 0
>
> So, the new DF should look like this
>
> V1 V2 F1 F1_mean
> 1 A 2 0 2.5
> 2 A 3 0 2.5
> 3 A 4 1 0.0
> 4 B 3 0 3.0
> 5 B 2 1 0.0
> 6 C 6 0 7.0
> 7 C 2 0 7.0
> 8 C 6 0 7.0
>
> Thank you for any help!
>
> Patrick Hausmann
>
> ______________________________________________
> 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.
>
------------------------------
Message: 78
Date: Wed, 21 Nov 2007 22:16:09 -0500
From: "Suresh Krishna" <ssk2031 at columbia.edu>
Subject: Re: [R] R and reading matlab compressed files
To: r-help at r-project.org
Message-ID: <op.t16bc7qvcrygw3 at xyz-fk9zmm6y5kd>
Content-Type: text/plain; format=flowed; delsp=yes;
charset=iso-8859-15
One possibility is to save in ASCII format from Matlab (save -ascii)
Suresh
> On 17/11/2007, Prof Leslie Smith <lss at cs.stir.ac.uk> wrote:
>> Is there any way to read these files (standard .mat files, created by
>> matlab version 7 onwards are compressed)? I know that R.matlab
doesn't
>> read them (it even says in the file MatlabServer.m "Matlab v7
saves
>> compressed files, which is not recognized by R.matlab's
readMat()"
>> (lines
>> 47-8)).
>>
>> I know I should be able to make R call Matlab and transfer data (not
>> that
>> I managed to make it work yet!), but I'd rather not run Matlab
& R
>> together: I'd like to use R to read matlab files on machines not
>> licensed
>> for matlab!
>>
>> Are there any ways to make this work?
>>
>> --Leslie Smith
>>
>> --
>> Prof Leslie Smith
>> Computing Science and Maths
>> University of Stirling FK9 4LA
>> Scotland
>> Tel (44) 1786 467435
>>
>> --
>> The University of Stirling is a university established
>> i...{{dropped:11}}
>>
>> ______________________________________________
>> 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.
>>
>
>
------------------------------
Message: 79
Date: Wed, 21 Nov 2007 19:42:37 -0800 (PST)
From: Moshe Olshansky <m_olshansky at yahoo.com>
Subject: Re: [R] Reg : using two different matrix : how to do t.test
To: sata pinal <satapinal at yahoo.com>, R-help at stat.math.ethz.ch
Message-ID: <873913.81339.qm at web32212.mail.mud.yahoo.com>
Content-Type: text/plain; charset=iso-8859-1
Since t.test takes much more time than parsing loop, I
won't hesitate to do a loop on the columns.
--- sata pinal <satapinal at yahoo.com> wrote:
> I have two matrix with same dimensions. I want to do
> t.test using each column from 2 different matrix.
> Row n Column names in both matrix are same.
>
> e.g.
> Matrix1
> id VC1 VC2 VC3
> R 1 2 3
> R1 4 5 6
> R3 7 8 9
>
>
> Matrix2
> id VC1 VC2 VC3
> R 10 11 12
> R1 13 14 15
> R3 16 17 18
>
> want to do t.test using each column (with same name
> ) using Matrix1 and Matrix2
>
> for eg t.test(Matrix1$VC1, Matrix2$VC1)$p.value
>
> What is the best way to do it. I have dataset with
> 4000 columns for each matrix with same row and
> column names.
>
> Thanks a lot.
>
> ---------------------------------
> Be a better sports nut! Let your teams follow you
> with Yahoo Mobile. Try it now.
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>
------------------------------
Message: 80
Date: Wed, 21 Nov 2007 22:57:26 -0500
From: "Weiwei Shi" <helprhelp at gmail.com>
Subject: Re: [R] Reg : using two different matrix : how to do t.test
To: "sata pinal" <satapinal at yahoo.com>
Cc: R-help at stat.math.ethz.ch
Message-ID:
<cdf817830711211957k778ade6ax8992c32125122b32 at mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
sapply(1:4000, function(k){
t.test(Matrix1[,k], Matrix2[,k])$p.value
})
I did not test, though.
HTH,
Weiwei
On 11/19/07, sata pinal <satapinal at yahoo.com>
wrote:> I have two matrix with same dimensions. I want to do t.test using each
column from 2 different matrix.
> Row n Column names in both matrix are same.
>
> e.g.
> Matrix1
> id VC1 VC2 VC3
> R 1 2 3
> R1 4 5 6
> R3 7 8 9
>
>
> Matrix2
> id VC1 VC2 VC3
> R 10 11 12
> R1 13 14 15
> R3 16 17 18
>
> want to do t.test using each column (with same name ) using Matrix1 and
Matrix2
>
> for eg t.test(Matrix1$VC1, Matrix2$VC1)$p.value
>
> What is the best way to do it. I have dataset with 4000 columns for each
matrix with same row and column names.
>
> Thanks a lot.
>
> ---------------------------------
> Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it
now.
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>
--
Weiwei Shi, Ph.D
Research Scientist
GeneGO, Inc.
"Did you always know?"
"No, I did not. But I believed..."
---Matrix III
------------------------------
Message: 81
Date: Thu, 22 Nov 2007 09:24:39 +0500
From: "amna khan" <amnakhan493 at gmail.com>
Subject: [R] dev.off()
To: r-help at stat.math.ethz.ch
Message-ID:
<3ffd3bb60711212024u70254697u2459009b14f5793f at mail.gmail.com>
Content-Type: text/plain
Dear Sir
Sir when I use "png" function to save graph. At last it is written
dev.off().
it does not produce any postscript file.
Please help in this regard
Thank you
--
AMINA SHAHZADI
Department of Statistics
GC University Lahore, Pakistan.
[[alternative HTML version deleted]]
------------------------------
Message: 82
Date: Thu, 22 Nov 2007 03:02:58 +0000 (UTC)
From: David Winsemius <dwinsemius at comcast.net>
Subject: Re: [R] Displaying R, N, Z-symbols with expression
To: r-help at stat.math.ethz.ch
Message-ID: <Xns99EFE050E2E30dNOTwinscomcast at 80.91.229.13>
"C.J.Albers" <C.J.Albers at open.ac.uk> wrote in
news:2DB62B9891E94943806FE03F1C50DC99BB96B7 at SHERWOOD.open.ac.uk:
> Hi all,
>
> (Apologies if this has been asked before; I tried to search for it in
> the archives, but searching for terms like 'N' yields too many
hits)
>
> Is it possible to display symbols like 'R' (the set of real
numbers,
> so with an additional vertical line on the left) in plots using
> expression/plotmath? Getting bounced by the LISTSERV so trying Gmane:
Install the Hershey vector fonts and then use something like:
plot(0,0)
text(0.25.0.25, "\\Re", vfont = c("serif symbol", "bold
italic"), cex =
1.5)
It's more "Gothic" than what you described, but it may be an
acceptable
substitute.
--
David Winsemius
------------------------------
Message: 83
Date: Thu, 22 Nov 2007 13:42:15 +0800
From: "Chung-hong Chan" <chainsawtiney at gmail.com>
Subject: Re: [R] dev.off()
To: r-help at stat.math.ethz.ch
Message-ID:
<30d7ea360711212142m2a938746s5ae2a92b47a0ff96 at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
png function is used for producing png format (Portable Network
Graphics) of image.
you need to use the postscript() function to generate a ps graph.
Refer to:
http://stat.ethz.ch/R-manual/R-patched/library/grDevices/html/postscript.html
On 11/22/07, amna khan <amnakhan493 at gmail.com>
wrote:> Dear Sir
>
> Sir when I use "png" function to save graph. At last it is
written dev.off().
> it does not produce any postscript file.
>
> Please help in this regard
>
>
>
> Thank you
>
> --
> AMINA SHAHZADI
> Department of Statistics
> GC University Lahore, Pakistan.
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>
--
CH Chan
Research Assistant - KWH
http://www.macgrass.com
------------------------------
Message: 84
Date: Thu, 22 Nov 2007 00:52:18 -0500
From: "Jesse D Lecy" <jdlecy at maxwell.syr.edu>
Subject: [R] distance matrix to coordinate format for spatial stats
To: <r-help at r-project.org>
Message-ID:
<7663C7E01D8E094989CA62F0B0D21CD977FD67 at SUEXCL-02.ad.syr.edu>
Content-Type: text/plain
Greetings,
I would like to use some of the spatial statistics functions in R, but I am
having trouble entering data. My data is already in a distance matrix format,
not an X Y coordinate format (each Xij cell in the matrix represens the distance
from point i to j). Does anyone know of a way to convert a distance matrix to a
ppp object in spatstat, or an X,Y coordinate system for other packages?
Thanks,
Jesse
[[alternative HTML version deleted]]
------------------------------
Message: 85
Date: Thu, 22 Nov 2007 06:56:15 +0000 (GMT)
From: Prof Brian Ripley <ripley at stats.ox.ac.uk>
Subject: Re: [R] distance matrix to coordinate format for spatial
stats
To: Jesse D Lecy <jdlecy at maxwell.syr.edu>
Cc: r-help at r-project.org
Message-ID: <Pine.LNX.4.64.0711220654220.30950 at gannet.stats.ox.ac.uk>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
You can't do this uniquely (shifts, rotations and reflection do not change
the distances), but cmdscale() will produce one reconstruction.
On Thu, 22 Nov 2007, Jesse D Lecy wrote:
> Greetings,
>
> I would like to use some of the spatial statistics functions in R, but I am
having trouble entering data. My data is already in a distance matrix format,
not an X Y coordinate format (each Xij cell in the matrix represens the distance
from point i to j). Does anyone know of a way to convert a distance matrix to a
ppp object in spatstat, or an X,Y coordinate system for other packages?
>
> Thanks,
> Jesse
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
------------------------------
Message: 86
Date: Thu, 22 Nov 2007 12:27:30 +0500
From: "amna khan" <amnakhan493 at gmail.com>
Subject: [R] grDevices package
To: r-help at stat.math.ethz.ch
Message-ID:
<3ffd3bb60711212327v27aead7dp590f3dbd47399f9a at mail.gmail.com>
Content-Type: text/plain
Dear Sir
grDevices package is not found in packages list?????
Thank You
--
AMINA SHAHZADI
Department of Statistics
GC University Lahore, Pakistan.
[[alternative HTML version deleted]]
------------------------------
Message: 87
Date: Thu, 22 Nov 2007 09:02:18 +0100
From: Paul Murrell <paul at stat.auckland.ac.nz>
Subject: Re: [R] Displaying R, N, Z-symbols with expression
To: David Winsemius <dwinsemius at comcast.net>
Cc: r-help at stat.math.ethz.ch
Message-ID: <4745378A.8070607 at stat.auckland.ac.nz>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hi
David Winsemius wrote:> "C.J.Albers" <C.J.Albers at open.ac.uk> wrote in
> news:2DB62B9891E94943806FE03F1C50DC99BB96B7 at SHERWOOD.open.ac.uk:
>
>> Hi all,
>>
>> (Apologies if this has been asked before; I tried to search for it in
>> the archives, but searching for terms like 'N' yields too many
hits)
>>
>> Is it possible to display symbols like 'R' (the set of real
numbers,
>> so with an additional vertical line on the left) in plots using
>> expression/plotmath? Getting bounced by the LISTSERV so trying Gmane:
>
>
> Install the Hershey vector fonts and then use something like:
> plot(0,0)
> text(0.25.0.25, "\\Re", vfont = c("serif symbol",
"bold italic"), cex =
> 1.5)
>
> It's more "Gothic" than what you described, but it may be an
acceptable
> substitute.
I think that symbol is referred to as "R fraktur"; you can also get
that via the symbol font, e.g., ...
library(grid)
grid.text(expression(symbol("\302")))
If you want an R fraktur that looks more like a Latex one, see
http://www.stat.auckland.ac.nz/~paul/R/CM/CMR.html
If you want the so-called "bold blackboard" fonts, for some devices at
least, you should be able to access the font from your Latex
distribution. For example, the following code grabs the psyb font from
the pxfonts package and uses it with R's PDF device (the paths to the
font .afm and .pfb files may be different on your system) ...
# Tell R where the font .afm files are
pdfFonts(pxfonts=Type1Font("pxfonts",
paste("/usr/share/texmf-tetex/fonts/afm/public/pxfonts/",
rep("pxsyb.afm", 4), sep="")))
pdf("pxfonttest.pdf")
# Use the pxfont
grid.text("R", gp=gpar(fontfamily="pxfonts"))
dev.off()
# Embed the pxfont so that readers and printers will
# not substitute a different font
embedFonts("pxfonttest.pdf",
fontpaths="/usr/share/texmf-tetex/fonts/type1/public/pxfonts/")
Paul
p.s. There's no need to "install" the Hershey fonts; they come
as part
of R.
--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/
------------------------------
Message: 88
Date: Thu, 22 Nov 2007 03:16:01 -0500
From: "Thomas L Jones, PhD" <jones3745 at verizon.net>
Subject: [R] Naming elements of a list
To: "R-project help" <r-help at stat.math.ethz.ch>
Message-ID: <000301c82cdf$ebdb3500$2f01a8c0 at dell2400>
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
reply-type=original
I have a numeric vector of lenth 1. I am trying to use it inside
a function just by giving its name, rather than specifying it as
an argument to the function. I am aware that there is an attach
function which you need to call. The attach function will accept a
list. However, I don't seem to be able to create the list properly. (Or
should I use a frame instead?)
free_driver <- function (){
i <- numeric (1)
attach (as.list (i))
i <- 25
free_test ()
}
free_test <- function (){
print ("i =")
print (i)
return ()
}
Anyway, here is the output, starting with the load operation:
------------------------------------------------------------------
> free_driver <- function (){
+ i <- numeric (1)
+ attach (as.list (i))
+ i <- 25
+
+ free_test ()
+
+ }> free_test <- function (){
+ print ("i =")
+ print (i)
+ return ()
+
+ }> free_driver ()
Error in attach(as.list(i)) : all elements of a list must be
named>
--------------------------------------------------------------
Is there an easy way to name all elements of a list?
Your advice?
Tom Jones
------------------------------
Message: 89
Date: Wed, 21 Nov 2007 11:24:08 -0500
From: David Winsemius <dwinsemius at comcast.net>
Subject: Re: [R] Displaying R, N, Z-symbols with expression
To: "C.J.Albers" <C.J.Albers at open.ac.uk>, r-help at
r-project.org
Message-ID: <47445BA8.2 at comcast.net>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
C.J.Albers wrote:> Hi all,
>
> (Apologies if this has been asked before; I tried to search for it in the
archives, but searching for terms like 'N' yields too many hits)
>
> Is it possible to display symbols like 'R' (the set of real
numbers, so with an additional vertical line on the left) in plots using
expression/plotmath?
Install the Hershey vector fonts and then use something like:
text(x,y, "\\Re", vfont = c("serif symbol", "bold
italic"), cex = 1.5)
It's more "Gothic" that what you described, but it may be an
acceptable
substitute.
--
David Winsemius
------------------------------
Message: 90
Date: Wed, 21 Nov 2007 21:56:36 +0100
From: John Wiedenhoeft <john at nurfuerspam.de>
Subject: Re: [R] How can I save a plot ?
To: r-help at r-project.org
Message-ID: <200711212156.36645.john at nurfuerspam.de>
Content-Type: text/plain; charset="iso-8859-1"
Try something like:
pdf(file="filename.pdf")
plot(...)
dev.off();
works with other formats as well. Type ?Devices
Hope that helps,
John
On Wednesday 21 November 2007 21:45:38 Maura E Monville
wrote:> I recently installed R 2.6 on Linux/SuSE
> When I was running the previous version on Windows I was able to save my
> plots from a script.
> There was a command "savePlot" that is no more retrieved in the
last
> version.
> In this scenario, how can I tell R to save the currently displayed plot to
> a file ?
> The "save" command is generic and do not know how to tell R that
the plot
> is to be saved using this command.
>
> In addition, is it possible with R to have more than one plot, that is more
> than one graphic window opened at the same time ?
>
> Thank you so much.
>
> Regards,
------------------------------
Message: 91
Date: Thu, 22 Nov 2007 09:36:09 +0100
From: Petr PIKAL <petr.pikal at precheza.cz>
Subject: [R] Odp: t.test : extracting Error
To: mogra <funnymoody999 at yahoo.com>
Cc: r-help at r-project.org
Message-ID:
<OFB9D095CD.A883B10F-ONC125739B.002EE5F0-C125739B.002F4103 at
precheza.cz>
Content-Type: text/plain; charset="US-ASCII"
Hi
r-help-bounces at r-project.org napsal dne 20.11.2007 09:36:32:
>
> Hi Thanks for the reply.
>
> I implemented your solution to my problem but ...
>
> For some of my column there is not enough data to do t-test so it gives
me> error and stops the for loop, is any graceful way to check for error msg
and> say ok if there is no $p.value continue to the next column
You need at least 2 values for x and 2 values for y so you can just put an
if clause in your for loop. Something like:
for (whatever) {
if(sum(!is.na(x)>1 & sum(!is.na(y)>1) do your t.test
}
Regards
Petr
>
> Once again thx for help.
>
>
>
> sata pinal wrote:
> >
> > I have two matrix with same dimensions. I want to do t.test using each
> > column from 2 different matrix.
> > Row n Column names in both matrix are same.
> >
> > e.g.
> > Matrix1
> > id VC1 VC2 VC3
> > R 1 2 3
> > R1 4 5 6
> > R3 7 8 9
> >
> >
> > Matrix2
> > id VC1 VC2 VC3
> > R 10 11 12
> > R1 13 14 15
> > R3 16 17 18
> >
> > want to do t.test using each column (with same name ) using Matrix1
and> > Matrix2
> >
> > for eg t.test(Matrix1$VC1, Matrix2$VC1)$p.value
> >
> > What is the best way to do it. I have dataset with 4000 columns for
each> > matrix with same row and column names.
> >
> > Thanks a lot.
> >
> > ---------------------------------
> > Be a better sports nut! Let your teams follow you with Yahoo Mobile.
Try> > it now.
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > 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.
> >
> >
>
> --
> View this message in context:
http://www.nabble.com/Reg-%3A-%09using-two-> different-matrix-%3A-how-to-do-t.test-tf4834072.html#a13845405
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
------------------------------
Message: 92
Date: Thu, 22 Nov 2007 06:44:48 -0200
From: Bernardo Rangel Tura <tura at centroin.com.br>
Subject: Re: [R] Naming elements of a list
To: "Thomas L Jones, PhD" <jones3745 at verizon.net>
Cc: R-project help <r-help at stat.math.ethz.ch>
Message-ID: <1195721088.2068.57.camel at R3-Thux>
Content-Type: text/plain
On Thu, 2007-11-22 at 03:16 -0500, Thomas L Jones, PhD
wrote:> I have a numeric vector of lenth 1. I am trying to use it inside
> a function just by giving its name, rather than specifying it as
> an argument to the function. I am aware that there is an attach
> function which you need to call. The attach function will accept a
> list. However, I don't seem to be able to create the list properly. (Or
> should I use a frame instead?)
>
> free_driver <- function (){
> i <- numeric (1)
> attach (as.list (i))
> i <- 25
>
> free_test ()
>
> }
> free_test <- function (){
> print ("i =")
> print (i)
> return ()
>
> }
>
> Anyway, here is the output, starting with the load operation:
>
> ------------------------------------------------------------------
>
> > free_driver <- function (){
> + i <- numeric (1)
> + attach (as.list (i))
> + i <- 25
> +
> + free_test ()
> +
> + }
> > free_test <- function (){
> + print ("i =")
> + print (i)
> + return ()
> +
> + }
> > free_driver ()
> Error in attach(as.list(i)) : all elements of a list must be named
> >
> --------------------------------------------------------------
>
> Is there an easy way to name all elements of a list?
>
> Your advice?
Hi Tom,
If I understand your question is possible solve yours problem with this
code
free_driver <- function (){
i<-as.numeric(25)
i <- list(i)
free_test (i)
}
free_test <- function (i){
cat ("i =",i[[1]],"\n")
}
free_driver()
--
Bernardo Rangel Tura, M.D,Ph.D
National Institute of Cardiology
Brazil
------------------------------
Message: 93
Date: Thu, 22 Nov 2007 09:57:05 +0100
From: Uwe Ligges <ligges at statistik.uni-dortmund.de>
Subject: Re: [R] grDevices package
To: amna khan <amnakhan493 at gmail.com>
Cc: r-help at stat.math.ethz.ch
Message-ID: <47454461.5050208 at statistik.uni-dortmund.de>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
amna khan wrote:> Dear Sir
>
> grDevices package is not found in packages list?????
It is a base package that ships with R.
Uwe Ligges
> Thank You
>
------------------------------
Message: 94
Date: Thu, 22 Nov 2007 01:21:53 -0800 (PST)
From: peter360 <peter360 at fastmail.us>
Subject: Re: [R] Plotting + saving to file on Linux
To: r-help at r-project.org
Message-ID: <13893420.post at talk.nabble.com>
Content-Type: text/plain; charset=us-ascii
Maura,
The following worked for me. Hope it helps.
I did a plot, the graphics showed up on my screen. Then I did
dev.copy2eps(), the graphics was saved to a file called Rplot.eps.
I tried dev.copy(pdf) or dev.copy(png), but for some reason they generated 0
sized files for me. I didn't figure out what happened for these formats.
Peter
--
View this message in context:
http://www.nabble.com/Plotting-%2B-saving-to-file-on-Linux-tf4853743.html#a13893420
Sent from the R help mailing list archive at Nabble.com.
------------------------------
Message: 95
Date: Thu, 22 Nov 2007 17:30:44 +0800
From: PING-SHAN_CHEN at promos.com.tw
Subject: [R] A installation problem that needs your supports.
To: R-help at stat.math.ethz.ch
Message-ID: <OF5150FA23.0DBFEFA3-ON4825739B.002DFE1F at promos.com.tw>
Content-Type: text/plain; charset=US-ASCII
Hi Sirs:
This is Ping-Shan Chen from ProMOS Technologies in Taiwan.
I have a installation problem that needs your supports.
Some error messages as follows occured while installing R on Unix server.
Anyone could tell me how to fix this issue?
The OS version is Enterprise Linux AS release 4 (Nahant Update 4).
-c complex.c -o complex.o
gcc -I. -I../../src/include -I../../src/include -I/usr/local/include
-DHAVE_CONFIG_H -D__NO_MATH_INLINES -mieee-fp -g -O2 -c connections.c -o
connections.o
connections.c: In function `con_close1':
connections.c:1963: error: `Rgzconn' undeclared (first use in this
function)
connections.c:1963: error: (Each undeclared identifier is reported only
once
connections.c:1963: error: for each function it appears in.)
connections.c:1963: error: syntax error before "priv"
connections.c:1964: error: `priv' undeclared (first use in this function)
connections.c: In function `gzcon_open':
connections.c:3140: error: `Rgzconn' undeclared (first use in this
function)
connections.c:3140: error: syntax error before "priv"
connections.c:3141: error: `priv' undeclared (first use in this function)
connections.c: In function `gzcon_close':
connections.c:3233: error: `Rgzconn' undeclared (first use in this
function)
connections.c:3233: error: syntax error before "priv"
connections.c:3234: error: `priv' undeclared (first use in this function)
connections.c: In function `gzcon_read':
connections.c:3276: error: `Rgzconn' undeclared (first use in this
function)
connections.c:3276: error: syntax error before "priv"
connections.c:3277: error: `priv' undeclared (first use in this function)
connections.c: In function `gzcon_write':
connections.c:3335: error: `Rgzconn' undeclared (first use in this
function)
connections.c:3335: error: syntax error before "priv"
connections.c:3336: error: `priv' undeclared (first use in this function)
connections.c: In function `do_gzcon':
connections.c:3417: error: invalid application of `sizeof' to incomplete
type `gzconn'
connections.c:3422: error: `Rgzconn' undeclared (first use in this
function)
make[3]: *** [connections.o] Error 1
make[3]: Leaving directory `/opt/R/R-1.7.1/src/main'
make[2]: *** [R] Error 2
make[2]: Leaving directory `/opt/R/R-1.7.1/src/main'
make[1]: *** [R] Error 1
make[1]: Leaving directory `/opt/R/R-1.7.1/src'
make: *** [R] Error 1
Best regards,
Ping-Shan Chen
=======================================AP development section/EIM
ProMOS Technologies, Inc.
Tel : 886-3-5798308 ext 3575
Email :ping-shan_chen at promos.com.tw
---------------------
U
om: Petr PIKAL <petr.pikal at precheza.cz>
Subject: [R] instalation problem WXP
To: r-help at stat.math.ethz.ch
Message-ID:
<OF8B0DD4CC.52560778-ONC125739B.0035A5A5-C125739B.003646AE at
precheza.cz>
Content-Type: text/plain; charset="US-ASCII"
Dear R developers
I encountered a slight problem with instalation of new R versions. Up to
2.6.0 allwas OK. R 2.6.1rc and 2.7.0dev do not install due to inability to
write C:\Documents..\PikalP\*.tmp file. I am not sure if it is a change of
some MS instalation routines or if it is a change in R.
My question is if this will be a standard procedure during installation of
new versoions and I shall persuade our IT people to act accordingly.
Thank you
Petr Pikal
petr.pikal at precheza.cz
------------------------------
Message: 97
Date: Thu, 22 Nov 2007 10:58:51 +0100
From: Serguei Kaniovski <Serguei.Kaniovski at wifo.ac.at>
Subject: [R] Vectorize a correlation matrix
To: r-help at stat.math.ethz.ch
Message-ID:
<OFB14DF227.496AA0D7-ONC125739B.0036D3B0-C125739B.0036D3B3 at
wsr.ac.at>
Content-Type: text/plain
Hello
I can construct a correlation matrix from an (ordered) vector of
correlation coefficients as follows:
x <- c(0.1,0.2,0.3,0.4,0.5)
n <- length(x)
cmat <- diag(rep(0.5,n))
cmat[lower.tri(cmat,diag=0)] <- x
cmat <- cmat+t(cmat)
But how to do the reverse operation, i.e. produce x from cmat?
Thanks for help,
Serguei Kaniovski
[[alternative HTML version deleted]]
------------------------------
Message: 98
Date: Thu, 22 Nov 2007 11:14:44 +0100
From: Serguei Kaniovski <Serguei.Kaniovski at wifo.ac.at>
Subject: [R] Matrix of dummies from a vector
To: r-help at stat.math.ethz.ch
Message-ID:
<OFBEE2522A.C99A504F-ONC125739B.0038482A-C125739B.0038482D at
wsr.ac.at>
Content-Type: text/plain
Hallo
>From a variable "x" that defines, say, four classes, I would like
to define
the matrix "mat" of dummy variables indicating the classes, i.e.
x <- c(1,1,1,1,2,2,2,3,3,3,4,4)
mat <- matrix(c(1,0,0,0,
1,0,0,0,
1,0,0,0,
1,0,0,0,
0,1,0,0,
0,1,0,0,
0,1,0,0,
0,0,1,0,
0,0,1,0,
0,0,1,0,
0,0,0,1,
0,0,0,1), ncol=4, byrow=T)
Thank you for your help,
Serguei
[[alternative HTML version deleted]]
------------------------------
Message: 99
Date: Thu, 22 Nov 2007 21:21:15 +1100
From: Jim Lemon <jim at bitwrit.com.au>
Subject: Re: [R] Heatmap problem
To: affy snp <affysnp at gmail.com>
Cc: r-help at r-project.org
Message-ID: <4745581B.2090708 at bitwrit.com.au>
Content-Type: text/plain; charset=us-ascii; format=flowed
affy snp wrote:> Hi friends,
>
> I used heatmap(as.matrix(y2),col=rainbow(256),scale = "column")
to
> generate the heatmap. But it did not show the code that which
> color correspond the value. Is there any parameter for this in
> heatmap()?
>
Hi Allen,
If you want colors corresponding to the values with a color legend, have
a look at color2D.matplot in the plotrix package.
Jim
------------------------------
Message: 100
Date: Thu, 22 Nov 2007 11:28:58 +0100 (CET)
From: jgarcia at ija.csic.es
Subject: [R] manual parallel processing
To: r-help at r-project.org
Message-ID:
<43798.80.73.159.217.1195727338.squirrel at paleo.ija.csic.es>
Content-Type: text/plain;charset=iso-8859-1
Hi;
I have a R script that includes a call to genoud(); genoud process lasts
about 4 seconds, what would be OK if I hadn't have to call it about 2000
times. This yields about 2 hours of processing.
And I would like to use this script operationally; so that it should be
run twice a day. It seems to me that the parallel processing option
included in genoud() divides the task inside the function among the
computers included in the cluster. On the other hand, my consecutive calls
to genoud() are independent of each other, but all depend on objects
stored in the R workspace. I think that communication time among computer
for a 4 second task, repeated 2000 times should be slower that to divide
the calls to genoud among the number of available computers. So, perhaps a
viable option to speed up the process could be something as:
1) Somehow make a copy from the workspace on the fly (I mean put some
command, before the loop that call genoud(), to export the workspace in
its actual state to other computers)
2) divide the task in the number of available computers in the
network;e.g, if I've got my "localhost" and 3 computers more:
n.comp <- 4
nsteps <- 1987
steps.c <- trunc(nsteps/n.comp)
steps.c <- (1:n.comp)*steps.c
steps.c <- c(steps.c[1:(n.comp-1)],nsteps)
steps.i <- c(1,steps.c[-n.comp]+1)
for(ic in 1:n.comp){
Somehow start remotely R, read the copied workspace and execute in
computer ic for(i in
steps.i[ic]:steps.c[ic]){something[i];genoud(f(i));somethin.else[i]}
and somehow get back results from ic
}
3) concacenate results in my "localhost" workspace
You can see I'm rather lost with this. Could you help with this?
Regards,
Javier
------------------------------
Message: 101
Date: Thu, 22 Nov 2007 11:39:18 +0100
From: "Dimitris Rizopoulos" <dimitris.rizopoulos at
med.kuleuven.be>
Subject: Re: [R] Matrix of dummies from a vector
To: "Serguei Kaniovski" <Serguei.Kaniovski at wifo.ac.at>
Cc: r-help at stat.math.ethz.ch
Message-ID: <010b01c82cf3$ef870ee0$0540210a at www.domain>
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
reply-type=original
you can use model.matrix(), e.g.,
model.matrix(~ x - 1, data = data.frame(x = factor(x)))
I hope it helps.
Best,
Dimitris
----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http://www.student.kuleuven.be/~m0390867/dimitris.htm
----- Original Message -----
From: "Serguei Kaniovski" <Serguei.Kaniovski at wifo.ac.at>
To: <r-help at stat.math.ethz.ch>
Sent: Thursday, November 22, 2007 11:14 AM
Subject: [R] Matrix of dummies from a vector
>
> Hallo
>
>>From a variable "x" that defines, say, four classes, I would
like to
>>define
> the matrix "mat" of dummy variables indicating the classes, i.e.
>
> x <- c(1,1,1,1,2,2,2,3,3,3,4,4)
> mat <- matrix(c(1,0,0,0,
> 1,0,0,0,
> 1,0,0,0,
> 1,0,0,0,
> 0,1,0,0,
> 0,1,0,0,
> 0,1,0,0,
> 0,0,1,0,
> 0,0,1,0,
> 0,0,1,0,
> 0,0,0,1,
> 0,0,0,1), ncol=4, byrow=T)
>
> Thank you for your help,
> Serguei
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
------------------------------
_______________________________________________
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.
End of R-help Digest, Vol 57, Issue 22
**************************************
___________________________________________________________
Want ideas for reducing your carbon footprint? Visit Yahoo! For Good
http://uk.promotions.yahoo.com/forgood/environment.html