John Horton
Senior Statistician - DCRI
2400 Pratt Street Room 0311 Terrace Level
Durham NC  27705
919-668-8048 (p), 919-668-7049 (f)



r-help-request@r-project.org 
Sent by: r-help-bounces@r-project.org
11/29/2008 06:05 AM
Please respond to
r-help@r-project.org


To
r-help@r-project.org
cc

Subject
R-help Digest, Vol 69, Issue 30






Send R-help mailing list submissions to
                 r-help@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@r-project.org

You can reach the person managing the list at
                 r-help-owner@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: question involving loops from intro level R programming
      class (Gustaf Rydevik)
   2. editor for MacOS X (Bunny, lautloscrew.com)
   3. Re: editor for MacOS X (Michael Zak)
   4. Re: Question involving loops (Tom Backer Johnsen)
   5. Re: optimization problem (axionator)
   6. Re: specifications windows pc (seanpor)
   7. Re: editor for MacOS X (Mike Lawrence)
   8. Re: regexp help needed (Gabor Grothendieck)
   9. Re: editor for MacOS X (Philippe Grosjean)
  10. Re: editor for MacOS X (John Fox)
  11. Re: 1-Pearson's R Distance (Rodrigo Aluizio)
  12. confidence interval for glm (Gerard M. Keogh)
  13. Re: More than doubling performance with snow (Luke Tierney)
  14. [R-pkgs] version 2.0-0 of the effects package (John Fox)
  15.  Transpose and replicate (Alex99)
  16. Re: R help (C.H.)
  17. Examples of advanced data visualization (Hans W. Borchers)
  18. Re: editor for MacOS X (Blanchette, Marco)
  19.  problem with function plm (valeria pedrina)
  20. Contrast SS (Ista Zahn)
  21. Re: optimization problem (John C Nash)
  22. Re: Request for Assistance in R with NonMem (Douglas Bates)
  23. Re: Contrast SS (Gabor Grothendieck)
  24. Re: Examples of advanced data visualization (David Winsemius)
  25. Re: Contrast SS (Richard M. Heiberger)
  26. Re: Contrast SS (Ista Zahn)
  27. side by side boxplots (Phillip Porter)
  28. ranking the results of a questionnaire (Wolfgang Lindner)
  29. Re: optimization problem (tedzzx)
  30.  Help: "mean" and "replicate" (Alex99)
  31. Regarding posting a package to R-forge (with one of the
      dependent packages not in CRAN) (Marcelo Perlin)
  32.  R window lines limit (Rthoughts)
  33. Re: R window lines limit (hadley wickham)
  34. Re: side by side boxplots (Dylan Beaudette)
  35. Re: R window lines limit (Gabor Grothendieck)
  36. Re: R window lines limit (Duncan Murdoch)
  37. save single image when using plot(lm(y~x)) (Schreiber, Stefan)
  38. Re: Examples of advanced data visualization (Tom Backer Johnsen)
  39. NA and logical indexes (Sebastian P. Luque)
  40. Re: save single image when using plot(lm(y~x)) (Juliet Hannah)
  41. Re: save single image when using plot(lm(y~x)) (Schreiber, Stefan)
  42. Re: NA and logical indexes ( (Ted Harding))
  43. RODBC - problems connecting to oracle through linux
      (Simon Collins)
  44. Re: NA and logical indexes (Sebastian P. Luque)
  45. Re: save single image when using plot(lm(y~x)) (Paul Hiemstra)
  46. error message when using strptime (Kara Przeczek)
  47. Re: error message when using strptime (jim holtman)
  48. Re: error message when using strptime (Gabor Grothendieck)
  49. Re: save single image when using plot(lm(y~x)) (Schreiber, Stefan)
  50. Re: Help processing large data (jim holtman)
  51. Re: editor for MacOS X (C.H.)
  52. Re: NA and logical indexes (Berwin A Turlach)
  53.  Error in check(itp) :   ?object? does not  represent a K
      sample problem with censored data (Bob Green)
  54. Subset by string name? (Ophelia Wang)
  55. Re: Subset by family name? (Ophelia Wang)
  56. Re: Examples of advanced data visualization (Johannes Huesing)

----- Message from "Gustaf Rydevik" <gustaf.rydevik@gmail.com> on Fri, 28 
Nov 2008 12:14:01 +0100 -----
To:
"Heidi Wong" <hungryhungryheidi@gmail.com>
cc:
r-help@r-project.org
Subject:
Re: [R] question involving loops from intro level R programming class
On Fri, Nov 28, 2008 at 8:35 AM, Heidi Wong <hungryhungryheidi@gmail.com> 
wrote:
> a. Write a R function zerdiag.v1(m) using loop to output a square matrix
> whose diagonal elements are zero and the other elements are filled in by
> consecutive integers from 1 to m row-wise.
>
> For example,
> zerdiag.v1(6) =  [0, 1, 2]
>                          [3, 0, 4]
>                          [5, 6, 0]
>
> This function should have error checking ability. If the input m cannot 
form
> a square matrix, then the function will return an error message: "Input
> number is incorrect."
>
> b. Write a R function zerdiag.v2(m) to produce the same output as in 
part
> (a) without using a loop.
>
> c. Test your functions in part (a) and (b) using m=12 and m=14 
respectively.
>
> I'd appreciate any help with this problem... I've spent a lot of time
> staring at it, and I'm still not sure where to start. Thanks!
>
>        [[alternative HTML version deleted]]
>



Hi,

Nice little brain teaser! Not too difficult, but requires a bit of
creative thinking...
You might wanna have a look at, for example, ?diag, ?uniroot, or 
?polyroot.

regards,

Gustaf




-- 
Gustaf Rydevik, M.Sci.
tel: +46(0)703 051 451
address:Essingetorget 40,112 66 Stockholm, SE
skype:gustaf_rydevik



----- Message from "Bunny, lautloscrew.com" <bunny@lautloscrew.com> on 
Fri, 28 Nov 2008 12:15:41 +0100 -----
To:
r-help@r-project.org
Subject:
[R] editor for MacOS X
Hi all,

just wondered again, if there is some R editor for Mac OS X comparable 
to TINN-R on windows.

thx in advance..



----- Message from Michael Zak <zakdump@gmail.com> on Fri, 28 Nov 2008 
12:17:39 +0100 -----
To:
"Bunny, lautloscrew.com" <bunny@lautloscrew.com>
cc:
r-help@r-project.org
Subject:
Re: [R] editor for MacOS X
Why don't you use the bult-in editor from R under OS X? It's much 
better as the windows pendant.

Take care, Michael

On 28.11.2008, at 12:15, Bunny, lautloscrew.com wrote:

> Hi all,
>
> just wondered again, if there is some R editor for Mac OS X 
> comparable to TINN-R on windows.
>
> thx in advance..
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



----- Message from Tom Backer Johnsen <backer@psych.uib.no> on Fri, 28 Nov 
2008 12:20:51 +0100 -----
To:
hwong1 <hungryhungryheidi@gmail.com>
cc:
r-help@r-project.org
Subject:
Re: [R] Question involving loops
hwong1 wrote:
> a. Write a R function zerdiag.v1(m) using loop to output a square matrix
> whose diagonal elements are zero and the other elements are filled in by
> consecutive integers from 1 to m row-wise.
> For example, 
> zerdiag.v1(6) =  [0, 1, 2]
>                          [3, 0, 4]
>                          [5, 6, 0]
> This function should have error checking ability. If the input m cannot 
form
> a square matrix, then the function will return an error message: "Input
> number is incorrect."
> 
> b. Write a R function zerdiag.v2(m) to produce the same output as in 
part
> (a) without using a loop.
> 
> c. Test your functions in part (a) and (b) using m=12 and m=14 
respectively.
> 
> Any help with this question would be much appreciated. Thank you!

This looks like an assignment to me.

Tom


-- 
+----------------------------------------------------------------+
| Tom Backer Johnsen, Psychometrics Unit,  Faculty of Psychology |
| University of Bergen, Christies gt. 12, N-5015 Bergen,  NORWAY |
| Tel : +47-5558-9185                        Fax : +47-5558-9879 |
| Email : backer@psych.uib.no    URL : http://www.galton.uib.no/ |
+----------------------------------------------------------------+



----- Message from axionator <axionator@gmail.com> on Fri, 28 Nov 2008 
12:48:45 +0100 -----
To:
tedzzx <zengzhenxing@gmail.com>
cc:
r-help@r-project.org
Subject:
Re: [R] optimization problem
Hi,
I guess your function has several local minima and depending on where
you start, i.e. your initial variables, you get into another mimimum.

HTH
Armin



----- Message from seanpor <seanpor@acm.org> on Fri, 28 Nov 2008 03:59:21 
-0800 (PST) -----
To:
r-help@r-project.org
Subject:
Re: [R] specifications windows pc

Good morning Ruud,

What sort of tasks are you going to be doing in R?  Some tasks will be
faster on a single core extreme type processor, and other tasks can 
benefit
from a multi-core processor (which run at slower clock speeds than extreme
single-core).  If you're working with large matrices, then an optimized 
BLAS
can help.

Do the problems you'll be working on require more than 1500mb of RAM?  If 
so
then you should consider looking at a 64-bit linux on a 64-bit CPU.

The more performance you're looking for - the more work you have to do to
get it!

As an aside - I don't know whether AMD or Intel processors are faster -
clock-speed for clock-speed or / bang-for-buck... doing R-ish tasks (int /
float etc)

Kind Regards,
Sean


R.H. Koning wrote:
> 
> Hello, I am about to order a new workstation at my university that will 
be
> used for R (and other research related tasks). I would appreciate any
> feedback on the specifications of a very fast machine. The machine 
should
> run windows (XP probably better than vista). Which chip, memory size and
> specification, etc should I be looking for? Thanks, Ruud
> 
> 
>                [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/specifications-windows-pc-tp20730325p20733228.html
Sent from the R help mailing list archive at Nabble.com.



----- Message from "Mike Lawrence" <mike@thatmike.com> on Fri, 28 Nov 2008 
08:01:04 -0400 -----
To:
"Michael Zak" <zakdump@gmail.com>
cc:
r-help@r-project.org, "Bunny, lautloscrew.com" <bunny@lautloscrew.com>
Subject:
Re: [R] editor for MacOS X
I personally have found the built-in editor rather buggy and have switched
to TextMate (which I also use for my python programming).

On Fri, Nov 28, 2008 at 7:17 AM, Michael Zak <zakdump@gmail.com> wrote:

> Why don't you use the bult-in editor from R under OS X? It's much better 
as
> the windows pendant.
>
> Take care, Michael
>
>
> On 28.11.2008, at 12:15, Bunny, lautloscrew.com wrote:
>
>  Hi all,
>>
>> just wondered again, if there is some R editor for Mac OS X comparable 
to
>> TINN-R on windows.
>>
>> thx in advance..
>>
>> ______________________________________________
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> ______________________________________________
> R-help@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.
>



-- 
Mike Lawrence
Graduate Student
Department of Psychology
Dalhousie University
www.thatmike.com

Looking to arrange a meeting? Do so at:
http://www.timetomeet.info/with/mike/

~ Certainty is folly... I think. ~

                 [[alternative HTML version deleted]]



----- Message from "Gabor Grothendieck" <ggrothendieck@gmail.com> on Fri, 
28 Nov 2008 07:40:32 -0500 -----
To:
"Peter Dalgaard" <P.Dalgaard@biostat.ku.dk>
cc:
r-help@stat.math.ethz.ch, Lauri Nikkinen <lauri.nikkinen@iki.fi>
Subject:
Re: [R] regexp help needed
On Fri, Nov 28, 2008 at 5:51 AM, Peter Dalgaard
<P.Dalgaard@biostat.ku.dk> wrote:
> Lauri Nikkinen wrote:
>> Hello,
>>
>> I have a vector of dates and I would like to grep the year component
>> from this vector (= all digits
>> after the last punctuation character)
>>
>> dates <- c("28.7.08","28.7.2008","28/7/08", "28/7/2008", "28/07/2008",
>> "28-07-2008", "28-07-08")
>>
>> the resulting vector should look like
>>
>> "08" "2008" "08" "2008" "2008" "2008" "08"
>>
>> I tried something like (Perl style) with no success
>>
>> grep("[[:punct:]]?\\d", dates, value=T, perl=T)
>>
>> Any ideas?
>
>> sub(".*[[:punct:]]([0-9]*$)", "\\1", dates)
> [1] "08"   "2008" "08"   "2008" "2008" "2008" "08"
>> sub(".*[[:punct:]](.*)$", "\\1", dates)
> [1] "08"   "2008" "08"   "2008" "2008" "2008" "08"
>> sub(".*[[:punct:]]", "", dates)
> [1] "08"   "2008" "08"   "2008" "2008" "2008" "08"
>> substring(dates,regexpr("[0-9]*$", dates))
> [1] "08"   "2008" "08"   "2008" "2008" "2008" "08"
>

Here are a one more.  This uses strapply from gsubfn
which returns the matches directly.  The simplify = c
causes it to return them as a character vector instead
of a list:

library(gsubfn)
strapply(dates, "[0-9]+$", simplify = c)



----- Message from Philippe Grosjean <phgrosjean@sciviews.org> on Fri, 28 
Nov 2008 13:47:06 +0100 -----
To:
Mike Lawrence <mike@thatmike.com>
cc:
r-help@r-project.org, "Bunny, lautloscrew.com" <bunny@lautloscrew.com>
Subject:
Re: [R] editor for MacOS X
Hello,

There is also Komodo Edit + SciViews-K 
(http://www.sciviews.org/SciViews-K), rather close to Tinn-R 
functionnalities. Please; note that SciViews-K is not compatible yet 
with Komodo 5.0 and you must install version 4.4.
Best,

Philippe Grosjean
..............................................<°}))><........
  ) ) ) ) )
( ( ( ( (    Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (    Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..............................................................

Mike Lawrence wrote:
> I personally have found the built-in editor rather buggy and have 
switched
> to TextMate (which I also use for my python programming).
> 
> On Fri, Nov 28, 2008 at 7:17 AM, Michael Zak <zakdump@gmail.com> wrote:
> 
>> Why don't you use the bult-in editor from R under OS X? It's much 
better as
>> the windows pendant.
>>
>> Take care, Michael
>>
>>
>> On 28.11.2008, at 12:15, Bunny, lautloscrew.com wrote:
>>
>>  Hi all,
>>> just wondered again, if there is some R editor for Mac OS X comparable 
to
>>> TINN-R on windows.
>>>
>>> thx in advance..
>>>
>>> ______________________________________________
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>> ______________________________________________
>> R-help@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 from "John Fox" <jfox@mcmaster.ca> on Fri, 28 Nov 2008 
08:55:24 -0500 -----
To:
"'Bunny, lautloscrew.com'" <bunny@lautloscrew.com>
cc:
r-help@r-project.org
Subject:
Re: [R] editor for MacOS X
Dear Bunny,

I've been using Eclipse with the StatET plug-in
<http://www.walware.de/goto/statet> under both Windows and Mac OS X. 
Eclipse
+ StatET provides much more than a code editor, such as the ability to 
check
and build packages and to interact with an svn archive. On the downside, 
it
requires quite a bit of configuration.

I hope this helps,
 John

------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox


> -----Original Message-----
> From: r-help-bounces@r-project.org [mailto:r-help-bounces@r-project.org]
On
> Behalf Of Bunny, lautloscrew.com
> Sent: November-28-08 6:16 AM
> To: r-help@r-project.org
> Subject: [R] editor for MacOS X
> 
> Hi all,
> 
> just wondered again, if there is some R editor for Mac OS X comparable
> to TINN-R on windows.
> 
> thx in advance..
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



----- Message from "Rodrigo Aluizio" <r.aluizio@gmail.com> on Fri, 28 Nov
2008 12:21:09 -0200 -----
To:
<r-help@r-project.org>
Subject:
Re: [R] 1-Pearson's R Distance
Claudia, Thomas and William thank you all so much.
It's exactly what we needed.
Works perfectly.

Rodrigo.

-----Mensagem original-----
De: r-help-bounces@r-project.org [mailto:r-help-bounces@r-project.org] Em
nome de Claudia Beleites
Enviada em: quinta-feira, 27 de novembro de 2008 14:01
Para: r-help@r-project.org
Assunto: Re: [R] 1-Pearson's R Distance

Hi Rodrigo, 

afaik, (1 - r_Pearson)/2 is used rather than 1 - r_Pearson. This gives a 
distance measure ranging between 0 and 1 rather than 0 and 2. But after 
all, 
dies does not change anything substantial.
see e.g. Theodoridis & Koutroumbas: Pattern Recognition. 

I didn't know of the proxy package, but the calculation it straightforward

(though a bit wasteful I suspect: first the whole matrix is produced, and
as.dist cuts it down again to a triangular matrix):

as.dist (0.5 - cor (t(x) / 2)) 

Take care wheter you want to use x or t(x).

HTH Claudia



-- 
Claudia Beleites
Dipartimento dei Materiali e delle Risorse Naturali
Università degli Studi di Trieste
Via Alfonso Valerio 6/a
I-34127 Trieste

phone: +39 (0 40) 5 58-34 47
email: cbeleites@units.it

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



----- Message from "Gerard M. Keogh" <GMKeogh@justice.ie> on 28-Nov-2008 
14:29:05 GMT -----
To:
<r-help@r-project.org>
Subject:
[R] confidence interval for glm

Hi all,

simple Q:

how do I extract the upper and lower CI for predicted probabilities
directly for a glm - I'm sure there's a one line to do it but I can't find
it.
the predicted values I get with the predict (.. "response")

Thanks

Gerard


**********************************************************************************
The information transmitted is intended only for the person or entity to 
which it is addressed and may contain confidential and/or privileged 
material. Any review, retransmission, dissemination or other use of, or 
taking of any action in reliance upon, this information by persons or 
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from any
computer.  It is the policy of the Department of Justice, Equality and Law
Reform and the Agencies and Offices using its IT services to disallow the
sending of offensive material.
Should you consider that the material contained in this message is 
offensive you should contact the sender immediately and also 
mailminder[at]justice.ie.

Is le haghaidh an duine nó an eintitis ar a bhfuil sí dírithe, agus le 
haghaidh an duine nó an eintitis sin amháin, a bheartaítear an fhaisnéis a 
tarchuireadh agus féadfaidh sé go bhfuil ábhar faoi rún agus/nó faoi 
phribhléid inti. Toirmisctear aon athbhreithniú, atarchur nó leathadh a 
dhéanamh ar an bhfaisnéis seo, aon úsáid eile a bhaint aisti nó aon 
ghníomh a dhéanamh ar a hiontaoibh, ag daoine nó ag eintitis seachas an 
faighteoir beartaithe. Má fuair tú é seo trí dhearmad, téigh i dteagmháil 
leis an seoltóir, le do thoil, agus scrios an t-ábhar as aon ríomhaire. Is 
é beartas na Roinne Dlí agus Cirt, Comhionannais agus Athchóirithe Dlí, 
agus na nOifígí agus na nGníomhaireachtaí a úsáideann seirbhísí TF na 
Roinne, seoladh ábhair cholúil a dhícheadú.
Más rud é go measann tú gur ábhar colúil atá san ábhar atá sa 
teachtaireacht seo is ceart duit dul i dteagmháil leis an seoltóir 
láithreach agus le mailminder[ag]justice.ie chomh maith. 
***********************************************************************************





----- Message from Luke Tierney <luke@stat.uiowa.edu> on Fri, 28 Nov 2008
08:32:26 -0600 (CST) -----
To:
Markus Schmidberger <schmidb@ibe.med.uni-muenchen.de>
cc:
R Help <r-help@r-project.org>
Subject:
Re: [R] More than doubling performance with snow
Hi Markus,

I'm happy to participate in this, as I think I said previously.

I won't have time to look carefully at the draft until sometime next
week, but I remain puzzled about the high time listed for case 3 with
snow/Rmpi.  It would be good to understand what is going on there --
the discrepancy between show/Rmpi and the other snow variants seems
odd.

I'm not sure how meaningful the timing comparisons are overall.  The
differences are mainly overhead due to additional feature and
communication difference.  The feature-related overhead is not likely
to be important in any real examples. In my experience, if
communication is an issue in a substantial (i.e. realistic)
computaiton, then a more sophisticated approach than simple
scatter-compute-gather is needed, and then the ability to express such
an approach becomes more important than the performance per se.

Best,

luke

On Mon, 24 Nov 2008, Markus Schmidberger wrote:

> Hi,
>
> there is a new mailing list for R and HPC: r-sig-hpc@r-project.org
> This is probably a better list for this question. Do not forget, first
> of all you have to register: 
https://stat.ethz.ch/mailman/listinfo/r-sig-hpc
>
> In this case the communication overhead is the problem. The data /
> matrix is to big!
> Have a look to the function snow.time to visualize your communication
> and calculation time. It is a new function in snow_0.3-4.
> ( http://www.cs.uiowa.edu/~luke/R/cluster/ )
>
> Best
> Markus
>
>
>
> Stefan Evert wrote:
>>
>>> I'm sorry but I don't quite understand what "not running solve() in
>>> this process" means. I updated the code and it do show that the result
>>> from clusterApply() are identical with the result from lapply(). Could
>>> you please explain more about this?
>>
>> The point is that a parallel processing framework like Snow and PVM 
does
>> not execute the operation in your (interactive) R session, but rather
>> starts separate computing processes that carry out the actual
>> calculation (while your R session is just waiting for the results to
>> become available).  These separate processes can either run on 
different
>> computers in a network, or on your local machine (in order to make use
>> of multiple CPU cores).
>>
>>>>> user  system elapsed
>>>>> 0.584   0.144   4.355
>>
>>>>> user  system elapsed
>>>>> 4.777   0.100   4.901
>>
>>
>> If you take a close look at your timing results, you can see that the
>> total processing time ("elapsed") is only slightly shorter with
>> parallelisation (4.35 s) than without (4.9 s).  You've probably been
>> looking at "user" time, i.e. the amount of CPU time your interactive R
>> session consumed.  Since with parallel processing, the R session itself
>> doesn't perform the actual calculation (as explained above), it is
>> mostly waiting for results to become available and "user" time is
>> therefore reduced drastically.  In short, when measuring performance
>> improvements from parallelisation, always look at the total "elapsed" 
time.
>>
>> So why isn't parallel processing twice as fast as performing the
>> caculation in a single thread? Perhaps the advantage of using both CPU
>> cores was eaten up by the communication overhead.  You should also take
>> into account that a lot of other processes (terminals, GUI, daemons,
>> etc.) are running on your computer at the same time, so even with
>> parallel processing you will not have both cores fully available to R.
>> In my experience, there is little benefit in parallelisation as long as
>> you just have two CPU cores on your computer (rather than, say, 8 
cores).
>>
>> Hope this clarifies things a bit (and is reasonably accurate, since I
>> don't have much experience with parallelisation),
>> Stefan
>>
>> [ stefan.evert@uos.de | http://purl.org/stefan.evert ]
>>
>> ______________________________________________
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>
> --
> Dipl.-Tech. Math. Markus Schmidberger
>
> Ludwig-Maximilians-Universität München
> IBE - Institut für medizinische Informationsverarbeitung,
> Biometrie und Epidemiologie
> Marchioninistr. 15, D-81377 Muenchen
> URL: http://www.ibe.med.uni-muenchen.de
> Mail: Markus.Schmidberger [at] ibe.med.uni-muenchen.de
> Tel: +49 (089) 7095 - 4599
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Luke Tierney
Chair, Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:      luke@stat.uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu
----- Message from "John Fox" <jfox@mcmaster.ca> on Fri, 28 Nov 2008 
10:22:34 -0500 -----
To:
<r-packages@r-project.org>
cc:
'Jangman Hong' <jangmanhong@yahoo.ca>
Subject:
[R] [R-pkgs] version 2.0-0 of the effects package
Dear R users,

I'd like to announce version 2.0-0 of the effects package, which is now on
CRAN. The package constructs graphical and tabular "effect displays," 
e.g.,
of interactions, for several kinds of models. These displays are
generalizations of "adjusted" means in linear models. 

The major addition to the package is the ability to display terms in
multinomial and proportional-odds logit models (using results described in
Fox, J. and R. Andersen (2006), "Effect displays for multinomial and
proportional-odds logit models," Sociological Methodology 36, 225-255; the
original package was described in Fox, J. (2003), "Effect displays in R 
for
generalised linear models," Journal of Statistical Software 8:15, 1-27.)

The new version of the package is co-authored with Jangman Hong.

Regards,
 John

------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox

_______________________________________________
R-packages mailing list
R-packages@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-packages



----- Message from Alex99 <loyola9988@yahoo.com> on Fri, 28 Nov 2008 
06:41:48 -0800 (PST) -----
To:
r-help@r-project.org
Subject:
[R] Transpose and replicate


Hi all,
I used the "replicate" function to make 2 samples from file test with 5
records in each sample and saved the output in "result".

result=replicate(2,test[,sample(colnames(test),5,replace =
FALSE)],simplify=FALSE)

now I need to transpose each sample, but when I use:

t(result) 

or 

result=t(replicate(2,test[,sample(colnames(test),5,replace =
FALSE)],simplify=FALSE))

I get this:

        [,1]             [,2]           [,3]            [,4]         [,5]  

[1,] Integer,300 Integer,300 Integer,300 Integer,300 Integer,300

anyone has any idea how can I fix it?
Thanks


-- 
View this message in context: 
http://www.nabble.com/Transpose-and-replicate-tp20735722p20735722.html
Sent from the R help mailing list archive at Nabble.com.



----- Message from "C.H." <chainsawtiney@gmail.com> on Fri, 28 Nov 2008 
23:41:00 +0800 -----
To:
"amit nirmalkar" <anirmalkar@gmail.com>
cc:
r-help@r-project.org
Subject:
Re: [R] R help
Actually, SPSS do have condition LR which can be simulate using Cox
Proportional Hazards regression.

For R, Conditional LR is clogit inside survival package.

?clogit may help.

Regards,

C


On Fri, Nov 28, 2008 at 5:43 PM, amit nirmalkar <anirmalkar@gmail.com> 
wrote:
> Dear Sir
>
> I am Amit Nirmalkar, M. Sc. Statistics.
>
> I generally use SPSS package for analysis.
>
> I wanted to run Conditional Logistic Regression in SPSS but this 
technique
> is not available.
>
> So I thought of R s/w.
>
> I am totally blank about R.
>
> Can you please send me few of R.
>
> Also how to run Conditional Logistic Regression in R.
>
>
> Thanks
>
> --
> Amit Nirmalkar
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.com



----- Message from "Hans W. Borchers" <hwborchers@gmail.com> on Fri, 28 
Nov 2008 15:55:12 +0000 (UTC) -----
To:
r-help@stat.math.ethz.ch
Subject:
[R] Examples of advanced data visualization
Dear R-help,

I am looking for ideas and presentations of new and advanced data 
visualization
methods. As an example of what I am searching for, the 'Many Eyes' pages 
at

    http://manyeyes.alphaworks.ibm.com/manyeyes/

may provide a good paradigm. I would be interested even if it will not be
easy
to implement such examples in R, e.g. because of the interactive nature of
these
graphical displays.

Please answer to my e-mail address. In case enough interesting material 
comes
up, I will enter a summary here.

Hans Werner Borchers
ABB Corporate Research



----- Message from "Blanchette, Marco" <MAB@stowers-institute.org> on Fri,
28 Nov 2008 09:57:33 -0600 -----
To:
John Fox <jfox@mcmaster.ca>, "Bunny, lautloscrew.com" 
<bunny@lautloscrew.com>
cc:
R-help <r-help@r-project.org>
Subject:
Re: [R] editor for MacOS X
Carbon emacs ( http://homepage.mac.com/zenitani/emacs-e.html) using the 
ess-mode ( http://ess.r-project.org/). Amazingly good integration of 
different buffer types for different tasks. You can have your R session 
running in a buffer, a .R buffer where you edit your functions/sources and
with very simple key strokes you can send/run lines, functions or full 
buffer into the running R session. Great integration of the help pages 
too.

This as become my central environment where I do all my computing work, 
programming (perl, python, etc...), shell work, R jobs, MySQL work etc...
In addition, your Mac can be configure to run emacs remotely as a client 
on any other type of machine. For instance, at home, on my PC or on my 
Mac, I can fire up an SSH connection from either X11 or PuTTY to the Mac 
desktop in my office, then fire up emacs from the terminal, et voila! I am
running jobs on the computer in my office (which as 8 core and 32Mb of 
RAM) from the same environment as I normally used in my office (can be a 
bit bandwidth intensive though).

You should also check the noweb mode ( http://www.cs.tufts.edu/~nr/noweb/)
for integrating codes and documentation, pretty cool.

Cheers,

Marco


On 11/28/08 7:55 AM, "John Fox" <jfox@mcmaster.ca> wrote:

Dear Bunny,

I've been using Eclipse with the StatET plug-in
<http://www.walware.de/goto/statet> under both Windows and Mac OS X. 
Eclipse
+ StatET provides much more than a code editor, such as the ability to 
check
and build packages and to interact with an svn archive. On the downside, 
it
requires quite a bit of configuration.

I hope this helps,
 John

------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox


> -----Original Message-----
> From: r-help-bounces@r-project.org [mailto:r-help-bounces@r-project.org]
On
> Behalf Of Bunny, lautloscrew.com
> Sent: November-28-08 6:16 AM
> To: r-help@r-project.org
> Subject: [R] editor for MacOS X
>
> Hi all,
>
> just wondered again, if there is some R editor for Mac OS X comparable
> to TINN-R on windows.
>
> thx in advance..
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@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.


--
Marco Blanchette, Ph.D.
Assistant Investigator
Stowers Institute for Medical Research
1000 East 50th St.

Kansas City, MO 64110

Tel: 816-926-4071
Cell: 816-726-8419
Fax: 816-926-2018



----- Message from "valeria pedrina" <valeria.pedrina@gmail.com> on Fri, 
28 Nov 2008 17:10:10 +0100 -----
To:
r-help@r-project.org
Subject:
[R] problem with function plm
Hi all,
I want to use the estimation method fixed effect on my panel data.
I have found plm function but it give me a problem,my model is:
1/5*log(z_{i,t}/r_{i,t})=a+b*r_{i,t}+u_{i,t} , I have 9 individuals and 5
time for each
individuals so I have 45 observation

this is what I do:

> p <- c("italia","italia","italia","italia","italia","spagna", .....)
> t  <- c(1980,1985,1990,1995,2000,1980, .....)
> y <- 1/5*log(z/r)
> x <- log(r)
> X <-cbind(p,t,y,x)
> X <- data.frame(X)
> ooo <- plm.data(X)
> ooo
            p        t                    y                            x
41    austria 1980   0.0346493597549657 0.179025476619000
42    austria 1985   0.0287375757505195 0.352272275393828
.
.
.
.
> vedo<-plm(y~x,data=ooo)
Errore in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
  0 (non-NA) cases
Inoltre: Warning messages:
1: In model.response(mf, "numeric") :
  using type="numeric" with a factor response will be ignored
2: In Ops.factor(y, y.m) : - not meaningful for factors


I do also in other way:
> Z <-cbind(p,t,z,r)
> Z <-data.frame(Z)
> zz<-plm.data(Z)
> zz
            p       t               z                           r
41    austria 1980 1.42229572713245 1.19605121512085
42    austria 1985 1.64207412666992 1.42229572713245
.
.
.
> xxx<-plm(1/5*log(z/r)~log(r),data=zz)
Errore in Math.factor(c(1L, 5L, 9L, 14L, 17L, 25L, 26L, 27L, 32L, 38L,  :
  log not meaningful for factors
Inoltre: Warning message:
In Ops.factor(y1, x1) : / not meaningful for factors


what I can do?
thanks in advance

                 [[alternative HTML version deleted]]



----- Message from "Ista Zahn" <izahn@psych.rochester.edu> on Fri, 28 Nov
2008 11:24:02 -0500 -----
To:
r-help@r-project.org
Subject:
[R] Contrast SS
Hi all,
Hopefully this is an easy question and I've overlooked something
simple. I want to present specific contrasts in an ANOVA table. I can
of course get the significance tests with summary.lm, but my adviser
wants the results in ANOVA format. Here is a minimal example:

> x <- factor(c(rep("condition.1", 5), rep("condition.2", 5), 
rep("condition.3", 5)))
> y <- rnorm(15)

I know there are all kinds of built-in contrasts, but I specifically
want to contrast groups 1 and two with group 3, and  I'm more
comfortable setting them by hand:

> contrasts(x) <- matrix(c(-1,-1,2, -1,1,0), 3,2)
> m.1 <- lm(y ~ x)

I can test the contrasts with

> summary(m.1)

but the results are not formatted in an ANOVA table. I can format the
results in an ANOVA table

> anova(m.1)

but this doesn't give me results for the contrast.

Any help is greatly appreciated.

-Ista



----- Message from John C Nash <nashjc@uottawa.ca> on Fri, 28 Nov 2008 
11:28:29 -0500 -----
To:
r-help@r-project.org
Subject:
Re: [R] optimization problem
tedzxx asked about apparent multiple optima. See below.

Users should be aware that optim() does local optimization. The default 
Nelder-Mead approach is fairly robust at finding such a local minimum, 
though it may halt if it is on a flat area of the loss function surface. I
would recommend trying one of the BFGS codes (they use somewhat different
approaches) and look at the gradient information. With only 3 parameters,
these should work fine. There is also another package (I forget the name 
-- someone?) that does full Newton with Hessian computed. That may be 
worth using to get more complete information about your problem.

tedzxx: If you send me the data off-list (maybe also include the function
again to save me digging it up again), I'll try to provide more 
information. 

John Nash





>Date: Thu, 27 Nov 2008 23:30:56 -0800 (PST)
>From: tedzzx <zengzhenxing@gmail.com>
>Subject: [R]  optimization problem
>To: r-help@r-project.org
>Message-ID: <20730032.post@talk.nabble.com>
>Content-Type: text/plain; charset=UTF-8


  I am facing an optimization problem. I am using the function 
optim(par,fun),
  but I find that every time I give different original guess parameter, I
can
  get different result. For example
  I have a data frame named data:
  head(data)
     price     s     x         t
  1 1678.0 12817 11200 0.1495902
  2 1675.5 12817 11200 0.1495902
  3 1678.0 12817 11200 0.1495902
  4 1688.0 12817 11200 0.1495902
  5 1677.0 12817 11200 0.1495902
  6 1678.5 12817 11200 0.1495902
  ??.
  f<-function(p,...){
                 v=exp(p[1]+p[2]*(x/s)+p[3]*(x/s)2)
                 d1=(log(s/x)+(v2)*t/2)/(v*sqrt(t))
                 d2=(log(s/x)-(v2)*t/2)/(v*sqrt(t))
                 sum((price-(s*pnorm(d1)-x*pnorm(d2)))2)
  }
  p=c(-0.1,-0.1,0.01)
  optim(par=p,f) # use the default algorism 


  I have other different original estimes, It also show me different 
result.

  Why?

Thanks.



----- Message from "Douglas Bates" <bates@stat.wisc.edu> on Fri, 28 Nov 
2008 10:41:25 -0600 -----
To:
"Michael White" <mpdubb@gmail.com>
cc:
r-help@stat.math.ethz.ch
Subject:
Re: [R] Request for Assistance in R with NonMem
On Wed, Nov 26, 2008 at 12:46 PM, Michael White <mpdubb@gmail.com> wrote:
> Hi
> I am having some problems running a covariate analysis with my
> colleage using R with the NonMem program we are using for a graduate
> school project. R and NonMem run fine without adding in the
> covariates, but the program is giving us a problem when the covariate
> analysis is added. We think the problem is with the R code to run the
> covariate data analysis. We have the control stream, R code (along
> with the error), and data attached. If anyone can help we would really
> appreciate it. Thank you very much.

The error message from R

> Error in as.vector(x, mode) : invalid 'mode' argument

is non-specific.  To diagnose exactly what the cause of this is you
would need to use

traceback()

after the error and determine where this error message originates.  It
is likely originating in code in the Mltools package that is trying to
parse the NonMem output file.

I myself would also be concerned about the warnings from the ld
program that indicate inconsistencies in the structure of the object
files from NonMem.  First of all the message doesn't make sense in
that 32 is not smaller than 28 and secondly it may indicate a
misalignment of storage in a Fortran common block.


> R Code:
> # load MItools from within R
> library(MItools)
>
> ProjectDir <- "~/EssentialsOpenCourseware/continuous_PKPD/Examples"
> NMcom <- "nm6osxg77big.pl"
> cov   <-  c("AGE", "BW")
>
> # run NONMEM using 3032.ctl
> NONR(ProjectDir=ProjectDir,
>     NMcom=NMcom,
>     dvname="Test (mcg/L)",
>     diag=1,
>     covplt=1,
>     b=3032,
>     boot=0,
>     nochecksum=TRUE,
>     grp=c("FLAG")
> )
>
> ERROR MESSAGE:
> ld warning: for symbol _cm41_ tentative definition of size 32 from
> /usr/local/nm6osxg77big/nm/nonmem.a(INITL.o) is is smaller than the
> real definition of size 28 from /usr/local/nm6osxg77big/nm/BLKDAT.o
> /usr/local/nm6osxg77big/test/nm6osxg77big.pl is starting
> 
/Users/mpdubb/EssentialsOpenCourseware/continuous_PKPD/Examples/3033/nonmem.exe
> /usr/local/nm6osxg77big/test/nm6osxg77big.pl is complete
> No TAD item for run 3033.
> Error in as.vector(x, mode) : invalid 'mode' argument
> Run 3033 complete.
> NONR complete.
>
> CONTROL STREAM (in NONMEM):
> $PROB RUN# 3033 EFFECT COMP POPULATION PK-PD MODEL 2
> $INPUT C REPL ID ARM TIME AGE BW GNDR DV MDV FLAG AMT EVID
> ;FLAG 1 = PK, FLAG 2=PD,
> ;CMT 1=GUT, 2=CENTRAL
> ;DV =PK  ORDERED BY ID, TIME
> $DATA ../projectRSD1.csv IGNORE=C
> $SUBROUTINE ADVAN2 TRANS2 INFN=../MItoolsRunlogNM6.for
> $ABB COMRES=8
> $PK
> FLA2=FLAG
> TVKA=THETA(1)
> TVCL=THETA(2)
> TVV=THETA(3)
> CL=TVCL*EXP(ETA(1))
> V=TVV*EXP(ETA(2))
> KA=TVKA*EXP(ETA(3))
> S2=V
> $ERROR
> EMAX=THETA(4)*EXP(ETA(4))
> EC50=THETA(5)*EXP(ETA(5))
> N = THETA(6)*EXP(ETA(6))
> EFF= (EMAX*F**N)/(EC50**N+F**N) + ERR(2)
> CONC= F + F*ERR(1)
> Y = CONC*(2-FLAG) + EFF*(FLAG-1)
> IPRED=Y
>    "  LAST
>    "  COM(1)=G(1,1)
>    "  COM(2)=G(2,1)
>    "  COM(3)=G(3,1)
>    "  COM(4)=G(4,1)
>    "  COM(5)=G(5,1)
>    "  COM(6)=G(6,1)
>    "  COM(7)=HH(1,1)
>    "  COM(8)=HH(2,1)
> $THETA
> (0, 1.7)     ;KA
> (0, 4.7)     ;CL
> (0, 38)     ;V
> (0.0, .5)                   ; EMAX
> (0.0, 100)                  ; EC50
> (0.0, 1, 10)                ; N
> $OMEGA
> 0.04
> 0.04
> 0.04
> 0.04
> 0.04
> 0.04
> $SIGMA
> 0.04
> 5
> $ESTIMATION MAXEVAL=9999 NOABORT METHOD=0 POSTHOC PRINT=5
> $COVARIANCE
> $TABLE ID TIME  AGE BW GNDR TVKA TVV TVCL ETA1 ETA2 ETA3
> EVID NOPRINT ONEHEADER FILE=TABLE.PAR
> $TABLE NOPRINT FILE=../3033.TAB ONEHEADER
> ID TIME AGE BW GNDR KA V CL TVKA TVCL TVV FLAG FLA2 EVID EFF CONC IPRED
FLAG
> $TABLE NOPRINT ONEHEADER FILE=../3033par.TAB
> ID TIME  AGE BW GNDR KA V CL TVKA TVCL TVV EMAX EC50 ETA1 ETA2 ETA3
> EVID
> $TABLE ID TIME COM(1)=G11 COM(2)=G21
> COM(3)=G31 COM(4)=G41 COM(5)=G51 COM(6)=G61 COM(7)=H11
> COM(8)=H21 IPRED MDV NOPRINT ONEHEADER FILE=cwtab1.deriv
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>



----- Message from "Gabor Grothendieck" <ggrothendieck@gmail.com> on Fri,
28 Nov 2008 11:47:30 -0500 -----
To:
"Ista Zahn" <izahn@psych.rochester.edu>
cc:
r-help@r-project.org
Subject:
Re: [R] Contrast SS
Is your objective to break down the sum of squares for x into one
for the group 1 vs group 3 contrast and another for the
group 2 vs group 3 contrast?

If that's it try this.  We create the model matrix, make the two columns
generated from x into separate explanatory variables, x1 and x2, and
then run the anova.

> m <- model.matrix(~ C(x, contr.treatment, base = 3))
> DF <- data.frame(y, x1 = m[,2], x2 = m[,3])
> anova(lm(y ~., DF))
Analysis of Variance Table

Response: y
          Df  Sum Sq Mean Sq F value Pr(>F)
x1         1  2.3389  2.3389  2.5072 0.1393
x2         1  0.1170  0.1170  0.1254 0.7294
Residuals 12 11.1947  0.9329

On Fri, Nov 28, 2008 at 11:24 AM, Ista Zahn <izahn@psych.rochester.edu> 
wrote:
> Hi all,
> Hopefully this is an easy question and I've overlooked something
> simple. I want to present specific contrasts in an ANOVA table. I can
> of course get the significance tests with summary.lm, but my adviser
> wants the results in ANOVA format. Here is a minimal example:
>
>> x <- factor(c(rep("condition.1", 5), rep("condition.2", 5), 
rep("condition.3", 5)))
>> y <- rnorm(15)
>
> I know there are all kinds of built-in contrasts, but I specifically
> want to contrast groups 1 and two with group 3, and  I'm more
> comfortable setting them by hand:
>
>> contrasts(x) <- matrix(c(-1,-1,2, -1,1,0), 3,2)
>> m.1 <- lm(y ~ x)
>
> I can test the contrasts with
>
>> summary(m.1)
>
> but the results are not formatted in an ANOVA table. I can format the
> results in an ANOVA table
>
>> anova(m.1)
>
> but this doesn't give me results for the contrast.
>
> Any help is greatly appreciated.
>
> -Ista
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



----- Message from David Winsemius <dwinsemius@comcast.net> on Fri, 28 Nov
2008 11:53:32 -0500 -----
To:
"Hans W. Borchers" <hwborchers@gmail.com>
cc:
r-help@stat.math.ethz.ch
Subject:
Re: [R] Examples of advanced data visualization
The gapminder.org project ;

http://graphs.gapminder.org/world/

Hans Rosling at TED:

http://www.ted.com/index.php/talks/hans_rosling_shows_the_best_stats_you_ve_ever_seen.html


http://hdr.undp.org/external/gapminder/2004/hdr2004.html

And was given Google support last year:
http://googleblog.blogspot.com/2007/03/world-in-motion.html

-- 
David Winsemius


On Nov 28, 2008, at 10:55 AM, Hans W. Borchers wrote:

> Dear R-help,
>
> I am looking for ideas and presentations of new and advanced data 
> visualization
> methods. As an example of what I am searching for, the 'Many Eyes' 
> pages at
>
>    http://manyeyes.alphaworks.ibm.com/manyeyes/
>
> may provide a good paradigm. I would be interested even if it will 
> not be easy
> to implement such examples in R, e.g. because of the interactive 
> nature of these
> graphical displays.
>
> Please answer to my e-mail address. In case enough interesting 
> material comes
> up, I will enter a summary here.
>
> Hans Werner Borchers
> ABB Corporate Research
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



----- Message from "Richard M. Heiberger" <rmh@temple.edu> on Fri, 28 Nov
2008 12:02:53 -0500 -----
To:
"'Ista Zahn'" <izahn@psych.rochester.edu>, <r-help@r-project.org>
Subject:
Re: [R] Contrast SS
I believe you are looking for the summary.lm() function and its split=
argument.
Look at
 example(summary.aov)
for several examples.



----- Message from "Ista Zahn" <izahn@psych.rochester.edu> on Fri, 28 Nov
2008 12:38:24 -0500 -----
To:
r-help@r-project.org
Subject:
Re: [R] Contrast SS
Thank you!

> m.1 <- aov(y ~ x)
> summary(m.1, split = list(x = list("groups 1 and 2 vs group 3" = 1,
"group 1 vs group 2" = 2)))

does what I want.

On Fri, Nov 28, 2008 at 12:02 PM, Richard M. Heiberger <rmh@temple.edu> 
wrote:
> I believe you are looking for the summary.lm() function and its split=
> argument.
> Look at
>  example(summary.aov)
> for several examples.
>
>
>



----- Message from Phillip Porter <philnotfil@gmail.com> on Fri, 28 Nov 
2008 13:55:05 -0500 -----
To:
r-help@r-project.org
Subject:
[R] side by side boxplots
Good Morning,
                 I am trying to get side by side boxplots of two groups on
the 
same variable.  The last item under ?boxplot led me to some useful 
code.
                 I use "boxwex" to make the boxes narrower, "at" to shift
them 
over and "add" to draw them both on the same graph.  Something along 
the lines of:

attach(group1)
boxplot(Y~X, col="blue", boxwex=.4, at=1:n+.2)
attach(group2)
boxplot(Y~X, col="red", boxwex=.4, at=1:n-.2, add=TRUE)

                 When I just make up a small dataset to try this out on it

works great.  My problem is that I don't have completely matching 
data in the real dataset.  Every instance of the variable does not 
have data present from both groups.  When they get put on top of each 
other they don't line up.
                 Can I do something with my data to make it line up 
correctly 
using this approach?  Is there another way of getting the same 
results?

Thanks,
Phillip



----- Message from "Wolfgang Lindner" <LindnerW@t-online.de> on Fri, 28 
Nov 2008 20:16:48 +0100 -----
To:
"R-Help" <r-help@r-project.org>
Subject:
[R] ranking the results of a questionnaire
dear experts,

I reproduced an experiment (questionnaire) some times.
The result of the experiment is a vector of 5 factors, say (A,B,C,D,E).
In the original article the result is given in 5 pairs of mean and stDev 
for
A .. E, e.g. mean_A=37.4 and sd_A=8.1.
The interval for A,B,C,D,E values is 0..50. The original data frame is not
available.

For a comparison of my results L=(A',B',C',D',E')  with the original
G=(A,B,C,D,E)  we can interpret that smaller sd-values are 'better'.
But for the means the interpretation is a little bit complicated:
a smaller mean value of A or B or E is 'better', but a bigger mean value 
for
C or D is 'better'.

To construct a quantified value of being 'better' and to rank my data L 
vs.
the data G, I wrote a kind of an signed distance-function.
Here is my simple code and an small example run:

R version 2.7.1 (2008-06-23)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0

> L<-c(32.8,5.3,  26.3,9.0,  35.1,6.2,  33.4,6.3,  22.9,12.9)
> G<-c(37.4,8.1,  30.6,9.7,  32.0,7.9,  29.7, 9.0,  17.1,10.8)

> sigdist<- function (L,G)
 sqrt(
        sign( G[1]-L[1] )*(G[1]-L[1])^2
      +   sign( G[2]-L[2] )*(G[2]-L[2])^2
      + sign( G[3]-L[3] )*(G[3]-L[3])^2
      +   sign( G[4]-L[4] )*(G[4]-L[4])^2
      - sign( G[5]-L[5] )*(G[5]-L[5])^2
      +   sign( G[6]-L[6])*(G[6]-L[6])^2
      - sign( G[7]-L[7] )*(G[7]-L[7])^2
      +   sign( G[8]-L[8] )*(G[8]-L[8])^2
      + sign( G[9]-L[9] )*(G[9]-L[9])^2
      +   sign( G[10]-L[10] )*(G[10]-L[10])^2
     )

> sigdist(L,G)
[1] 6.588627

I like to interpret the positive value 6.588 that  'the L vector is better
then G vector w.r.t. sigdist'.

My questions are:

1. are there build-in functions in R calculating some (distance?)value 
with
the possibility of a similar interpretation?
2. are there other ideas for a ranking of the experimental results L and 
G?

Any comments, critique or hints are very welcome.

Sincerely

Wolfgang



----- Message from tedzzx <zengzhenxing@gmail.com> on Fri, 28 Nov 2008 
08:16:22 -0800 (PST) -----
To:
r-help@r-project.org
Subject:
Re: [R] optimization problem

If I want to find out the globle minia, how shoul I change my code?
Thanks a lot

Armin Meier wrote:
> 
> Hi,
> I guess your function has several local minima and depending on where
> you start, i.e. your initial variables, you get into another mimimum.
> 
> HTH
> Armin
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/optimization-problem-tp20730032p20737066.html
Sent from the R help mailing list archive at Nabble.com.



----- Message from Alex99 <loyola9988@yahoo.com> on Fri, 28 Nov 2008 
08:51:21 -0800 (PST) -----
To:
r-help@r-project.org
Subject:
[R] Help: "mean" and "replicate"

Hi all,

I used the "replicate" function to make 2 samples from file "test" with 5
records in each sample and saved the output in "result".

result=replicate(2,test[,sample(colnames(test),5,replace
=FALSE)],simplify=FALSE)


now I need to calculate the mean of each cell; i.e. I need to add "the
number in cell 1&1 from sample 1" and "the number in cell 1&1 in sample 2"
and divide it by 2. and do the same for all numbers in two sample( adding  

the number in cell 1&2 from sample 1" and "the number in cell 1&2 in 
sample
2",.......)

does anyone have any idea how to do it?

Thanks
-- 
View this message in context: 
http://www.nabble.com/Help%3A-%22mean%22-and-%22replicate%22-tp20737544p20737544.html

Sent from the R help mailing list archive at Nabble.com.



----- Message from "Marcelo Perlin" <marceloperlin@gmail.com> on Fri, 28 
Nov 2008 12:18:28 +0000 -----
To:
r-help@r-project.org
Subject:
[R] Regarding posting a package to R-forge (with one of the dependent 
packages not in CRAN)
Hi Guys,

Recently I wrote a package for dealing with Markov Switching Regressions 
in
R and it is included in the Rmetrics project.

https://r-forge.r-project.org/projects/rmetrics/

Everything works fine when I use it in computer.

But, the package depends on the use of optimization functions from the
package Rdonlp2, which is not available on CRAN.
So, if I have Rdonlp2 in my laptop (or any computer) I can load the 
package
and it works fine.

But, the problem Im having is that when I submit the package to R-Forge, 
the
R-Forge system try to build it (Rcm -build ... ) and outputs a error 
message
saying that Rdonlp2 is not found. This means that its not possible to get,
from the internet, the package I wrote with install.package(...).

Did anyone had a simillar problem ? Any suggestions for a workaround or
solution ?

Thanks for your help!

Regards,
Marcelo.

                 [[alternative HTML version deleted]]



----- Message from Rthoughts <seb.brockel@northampton.ac.uk> on Fri, 28 
Nov 2008 07:00:13 -0800 (PST) -----
To:
r-help@r-project.org
Subject:
[R] R window lines limit

Hi,

Is the number of lines that can be displayed in R GUI limited?

When I do a Fourier Tranform of 4000 data points, I can only see the last
300 or so of it. I need to see all of it. How is this possible?

Thank you if you can help!


-- 
View this message in context: 
http://www.nabble.com/R-window-lines-limit-tp20735974p20735974.html
Sent from the R help mailing list archive at Nabble.com.



----- Message from "hadley wickham" <h.wickham@gmail.com> on Fri, 28 Nov 
2008 13:29:27 -0600 -----
To:
Rthoughts <seb.brockel@northampton.ac.uk>
cc:
r-help@r-project.org
Subject:
Re: [R] R window lines limit
On Fri, Nov 28, 2008 at 9:00 AM, Rthoughts
<seb.brockel@northampton.ac.uk> wrote:
>
> Hi,
>
> Is the number of lines that can be displayed in R GUI limited?
>
> When I do a Fourier Tranform of 4000 data points, I can only see the 
last
> 300 or so of it. I need to see all of it. How is this possible?

Perhaps you could tell us why you want to see all the 4000 data
points.  It's unlikely that looking at 4,000 numbers is going to give
you much insight into your data.  Perhaps you are trying to save out
the data?

Hadley

-- 
http://had.co.nz/



----- Message from "Dylan Beaudette" <dylan.beaudette@gmail.com> on Fri, 
28 Nov 2008 11:34:38 -0800 -----
To:
"Phillip Porter" <philnotfil@gmail.com>
cc:
r-help@r-project.org
Subject:
Re: [R] side by side boxplots
On Fri, Nov 28, 2008 at 10:55 AM, Phillip Porter <philnotfil@gmail.com> 
wrote:
> Good Morning,
>        I am trying to get side by side boxplots of two groups on the 
same
> variable.  The last item under ?boxplot led me to some useful code.
>        I use "boxwex" to make the boxes narrower, "at" to shift them 
over
> and "add" to draw them both on the same graph.  Something along the 
lines
> of:
>
> attach(group1)
> boxplot(Y~X, col="blue", boxwex=.4, at=1:n+.2)
> attach(group2)
> boxplot(Y~X, col="red", boxwex=.4, at=1:n-.2, add=TRUE)
>
>        When I just make up a small dataset to try this out on it works
> great.  My problem is that I don't have completely matching data in the
real
> dataset.  Every instance of the variable does not have data present from
> both groups.  When they get put on top of each other they don't line up.
>        Can I do something with my data to make it line up correctly 
using
> this approach?  Is there another way of getting the same results?
>
> Thanks,
> Phillip
>

Without some data, it is hard to gauge what you are trying to
accomplish. You should probably have a look at some of the examples on
the boxplot manual page, and investigate the bwplot() function from
the lattice package.


In R, you need to have your data in what is called 'long-format' in
order to plot grouped data.

An example:

# two treatments
x <- rnorm(n=100, mean=1, sd=1)
y <- rnorm(n=100, mean=3, sd=2)

# an id vector
id <- rep(c(1,2), each=100)

# stack two treatments, and add id
d <- data.frame(treatment=c(x,y), id=factor(id) )

# plot:
boxplot(treatment ~ id, data=d)


# more fun with the lattice package:
# add another grouping vector
grp <- rep(c(1,2,3,4), each=25)
d <- data.frame(treatment=c(x,y), id=factor(id), grp=factor(grp) )

library(lattice)
bwplot(treatment ~ id | grp, data=d)


Cheers,

Dylan



----- Message from "Gabor Grothendieck" <ggrothendieck@gmail.com> on Fri,
28 Nov 2008 14:35:25 -0500 -----
To:
Rthoughts <seb.brockel@northampton.ac.uk>
cc:
r-help@r-project.org
Subject:
Re: [R] R window lines limit
Try ?View

On Fri, Nov 28, 2008 at 10:00 AM, Rthoughts
<seb.brockel@northampton.ac.uk> wrote:
>
> Hi,
>
> Is the number of lines that can be displayed in R GUI limited?
>
> When I do a Fourier Tranform of 4000 data points, I can only see the 
last
> 300 or so of it. I need to see all of it. How is this possible?
>
> Thank you if you can help!
>
>
> --
> View this message in context: 
http://www.nabble.com/R-window-lines-limit-tp20735974p20735974.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



----- Message from Duncan Murdoch <murdoch@stats.uwo.ca> on Fri, 28 Nov 
2008 15:20:09 -0500 -----
To:
Rthoughts <seb.brockel@northampton.ac.uk>
cc:
r-help@r-project.org
Subject:
Re: [R] R window lines limit
On 28/11/2008 10:00 AM, Rthoughts wrote:
> Hi,
> 
> Is the number of lines that can be displayed in R GUI limited?

Which GUI?  In Windows, the console buffer size is configurable.  The 
defaults are 250,000 characters, 8000 lines; it doesn't sound as though 
you are hitting those limits.  But if you want to change them, go to 
Edit | Gui preferences.

When I look at fft(rnorm(4000)), I see all 4000 values; my limit appears 
to be around 8000 values, using the default settings.

Duncan Murdoch

> 
> When I do a Fourier Tranform of 4000 data points, I can only see the 
last
> 300 or so of it. I need to see all of it. How is this possible?
> 
> Thank you if you can help!
> 
>



----- Message from "Schreiber, Stefan" <Stefan.Schreiber@ales.ualberta.ca>
on Fri, 28 Nov 2008 14:12:59 -0700 -----
To:
<r-help@r-project.org>
Subject:
[R] save single image when using plot(lm(y~x))
Dear List!

When I'm using "plot(lm(y~x))" R shows me 4 different plots. They pop-up
individually by clicking on the graph. How can I save for example the
2nd plot? I've found a camera button that says  "copy to the clipboard
as a metafile" once you place the mouse pointer on it. I tried, though
it's not working. 

Any other suggestions?

Thanks!!

Stefan

                 [[alternative HTML version deleted]]



----- Message from Tom Backer Johnsen <backer@psych.uib.no> on Fri, 28 Nov
2008 22:13:04 +0100 -----
To:
"Hans W. Borchers" <hwborchers@gmail.com>
cc:
r-help@stat.math.ethz.ch
Subject:
Re: [R] Examples of advanced data visualization
Hans W. Borchers wrote:

> Dear R-help,
> 
> I am looking for ideas and presentations of new and advanced data 
visualization
> methods. As an example of what I am searching for, the 'Many Eyes' pages
at
> 
>     http://manyeyes.alphaworks.ibm.com/manyeyes/
> 
> may provide a good paradigm. I would be interested even if it will not 
be easy
> to implement such examples in R, e.g. because of the interactive nature
of these
> graphical displays.

The question is interesting, but what I have a somewhat negative 
reaction to is the next passage:
> 
> Please answer to my e-mail address. In case enough interesting material
comes
> up, I will enter a summary here.

It is nice that you are willing to summarize whatever appears, but 
somewhat arrogant in my eyes.  There might be things appearing that you 
do not regard as of first interest that might be of interest to others. 
  Therefore, the all parts of the discussion or responses should be 
public as well.  The response of David Winsemius pointing at (among 
other things) at the presentation of Rosling at TED is in my eyes a very 
good start.

In other words, I therefore suggest that the list ignores the last 
paragraph in the question from you.
> 
> Hans Werner Borchers
> ABB Corporate Research

Tom



----- Message from "Sebastian P. Luque" <spluque@gmail.com> on Fri, 28 Nov
2008 15:25:36 -0600 -----
To:
r-help@stat.math.ethz.ch
Subject:
[R] NA and logical indexes
Hi,

I vaguely remember this issue being discussed at some length in the
past, but am having trouble relocating the proper thread (defining an
adequate search string to do so):

---<---------------cut here---------------start-------------->---
R> foo <- data.frame(A=gl(2, 5, labels=letters[1:2]), X=runif(10))
R> foo$A[1] <- NA
R> foo$A == "b"
 [1]    NA FALSE FALSE FALSE FALSE  TRUE  TRUE  TRUE  TRUE  TRUE
R> foo$A[foo$A == "b"]
[1] <NA> b    b    b    b    b 
Levels: a b
R> foo$X[foo$A == "b"]
[1]     NA 0.4425 0.7164 0.3171 0.1967 0.8300
R> foo[foo$A == "b", ]
      A      X
NA <NA>     NA
6     b 0.4425
7     b 0.7164
8     b 0.3171
9     b 0.1967
10    b 0.8300
---<---------------cut here---------------end---------------->---

Why is foo$X[1] set to NA in that last call?


Cheers,

-- 
Seb



----- Message from "Juliet Hannah" <juliet.hannah@gmail.com> on Fri, 28 
Nov 2008 16:42:01 -0500 -----
To:
"Schreiber, Stefan" <Stefan.Schreiber@ales.ualberta.ca>
cc:
r-help@r-project.org
Subject:
Re: [R] save single image when using plot(lm(y~x))
Try:
mylm <- plot(lm(y~x))
plot(mylm,which=2)



On Fri, Nov 28, 2008 at 4:12 PM, Schreiber, Stefan
<Stefan.Schreiber@ales.ualberta.ca> wrote:
> Dear List!
>
> When I'm using "plot(lm(y~x))" R shows me 4 different plots. They pop-up
> individually by clicking on the graph. How can I save for example the
> 2nd plot? I've found a camera button that says  "copy to the clipboard
> as a metafile" once you place the mouse pointer on it. I tried, though
> it's not working.
>
> Any other suggestions?
>
> Thanks!!
>
> Stefan
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



----- Message from "Schreiber, Stefan" <Stefan.Schreiber@ales.ualberta.ca>
on Fri, 28 Nov 2008 14:45:55 -0700 -----
To:
"Juliet Hannah" <juliet.hannah@gmail.com>
cc:
r-help@r-project.org
Subject:
Re: [R] save single image when using plot(lm(y~x))
Woohoo!

Thanks a lot Juliet!

Stefan


-----Original Message-----
From: Juliet Hannah [mailto:juliet.hannah@gmail.com] 
Sent: Friday, November 28, 2008 2:42 PM
To: Schreiber, Stefan
Cc: r-help@r-project.org
Subject: Re: [R] save single image when using plot(lm(y~x))

Try:
mylm <- plot(lm(y~x))
plot(mylm,which=2)



On Fri, Nov 28, 2008 at 4:12 PM, Schreiber, Stefan
<Stefan.Schreiber@ales.ualberta.ca> wrote:
> Dear List!
>
> When I'm using "plot(lm(y~x))" R shows me 4 different plots. They
pop-up
> individually by clicking on the graph. How can I save for example the
> 2nd plot? I've found a camera button that says  "copy to the clipboard
> as a metafile" once you place the mouse pointer on it. I tried, though
> it's not working.
>
> Any other suggestions?
>
> Thanks!!
>
> Stefan
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



----- Message from (Ted Harding) <Ted.Harding@manchester.ac.uk> on Fri, 28
Nov 2008 22:01:15 -0000 (GMT) -----
To:
"Sebastian P. Luque" <spluque@gmail.com>
cc:
r-help@stat.math.ethz.ch
Subject:
Re: [R] NA and logical indexes
On 28-Nov-08 21:25:36, Sebastian P. Luque wrote:
> Hi,
> I vaguely remember this issue being discussed at some length in the
> past, but am having trouble relocating the proper thread (defining an
> adequate search string to do so):
> 
> ---<---------------cut here---------------start-------------->---
> R> foo <- data.frame(A=gl(2, 5, labels=letters[1:2]), X=runif(10))
> R> foo$A[1] <- NA
> R> foo$A == "b"
>  [1]    NA FALSE FALSE FALSE FALSE  TRUE  TRUE  TRUE  TRUE  TRUE
> R> foo$A[foo$A == "b"]
> [1] <NA> b    b    b    b    b 
> Levels: a b
> R> foo$X[foo$A == "b"]
> [1]     NA 0.4425 0.7164 0.3171 0.1967 0.8300
> R> foo[foo$A == "b", ]
>       A      X
> NA <NA>     NA
> 6     b 0.4425
> 7     b 0.7164
> 8     b 0.3171
> 9     b 0.1967
> 10    b 0.8300
> ---<---------------cut here---------------end---------------->---
> 
> Why is foo$X[1] set to NA in that last call?
> 
> Cheers,
> Seb

It is not! In my repetition (which has different runifs):

  foo[foo$A == "b", ]
#       A         X
# NA <NA>        NA
# 6     b 0.2300618
# 7     b 0.5109791
# 8     b 0.7947862
# 9     b 0.3400228
# 10    b 0.5464989
  foo
#       A         X
# 1  <NA> 0.5013591
# 2     a 0.4475963
# 3     a 0.2600449
# 4     a 0.9240698
# 5     a 0.4205284
# 6     b 0.2300618
# 7     b 0.5109791
# 8     b 0.7947862
# 9     b 0.3400228
# 10    b 0.5464989

NA can seem to have a bewildering logic, but it all becomes
clear if you interpret NA as "value unkown".

You asked for foo[foo$A == "b", ]. What happens is that
when the test foo$A == "b" encounters f$A[1] it sees NA,
so it does not know what the value is. Hence it does not
know whether this row of foo satisfies the test. Hence
the entire row is of unkown status. Hence a row is output
all of whose elements (including the row label, i.e. the
row number) are flagged "unknown", i.e. NA.

AFter all, if it gave the value of foo$X[1] = 0.5013591,
and you subsequently acessed foo[foo$A == "b",][1,2] and got
0.5013591, you would presumably proceed as though this was
a value corresponding to a case where foo$A == "b". But it
is not -- since foo$A[1] = NA, you don't know whether that is
the case. Hence you don't know the value of foo[foo$A == "b",][1,2].

Clear? ( :))
Hoping this helps,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding@manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 28-Nov-08                                       Time: 22:01:11
------------------------------ XFMail ------------------------------



----- Message from "Simon Collins" <Simon.Collins-2@manchester.ac.uk> on 
Fri, 28 Nov 2008 22:09:15 +0000 -----
To:
r-help@R-project.org
Subject:
[R] RODBC - problems connecting to oracle through linux
Hi

I'm presently trying to connect to Oracle through RODBC / UnixODBC on 
linux (Red Hat 5). I've successfully connected through the easysoft 
drivers but the trial license has run out and I'm trying to connect 
via the default Oracle 11G driver. However I'm getting the following 
error

> library(RODBC)
> setwd (paste("/home/oracle/scripts/R"))
> channel <- odbcConnect("test", uid="prod", pwd="passwd")

  *** caught segfault ***
address (nil), cause 'memory not mapped'

Traceback:
  1: .Call(C_RODBCDriverConnect, as.character(connection), id, 
as.integer(believeNRows))
  2: odbcDriverConnect(st, ...)
  3: odbcConnect("test", uid = "prod", pwd = "passwd")
aborting ...

The below shows the changes in the odbcinst.ini file.


[ORACLE]
Description             = Easysoft ODBC Oracle Driver
#Driver         = /usr/local/easysoft/oracle/libesoracle.so
Driver          = /u01/app/oracle/product/11.1.0/db_1/lib/libsqora.so.11.1
#Setup          = /usr/local/easysoft/oracle/libesoraclesetup.so
DontDLClose             = 1
FileUsage               = 2


Can anyone point me to what I'm doing wrong?

Version of R = R version 2.8.0 (2008-10-20)

Cheers

Simon

Dr S J Collins
Grid data consultant
University Manchester



----- Message from "Sebastian P. Luque" <spluque@gmail.com> on Fri, 28 Nov
2008 16:35:13 -0600 -----
To:
r-help@stat.math.ethz.ch
Subject:
Re: [R] NA and logical indexes
On Fri, 28 Nov 2008 22:01:15 -0000 (GMT),
(Ted Harding) <Ted.Harding@manchester.ac.uk> wrote:

[...]

> It is not!

Oops, of course, I meant to say "return" rather than "set" :-/


[...]

> NA can seem to have a bewildering logic, but it all becomes clear if
> you interpret NA as "value unkown".

> You asked for foo[foo$A == "b", ]. What happens is that when the test
> foo$A == "b" encounters f$A[1] it sees NA, so it does not know what
> the value is. Hence it does not know whether this row of foo satisfies
> the test. Hence the entire row is of unkown status. Hence a row is
> output all of whose elements (including the row label, i.e. the row
> number) are flagged "unknown", i.e. NA.

> AFter all, if it gave the value of foo$X[1] = 0.5013591, and you
> subsequently acessed foo[foo$A == "b",][1,2] and got 0.5013591, you
> would presumably proceed as though this was a value corresponding to a
> case where foo$A == "b". But it is not -- since foo$A[1] = NA, you
> don't know whether that is the case. Hence you don't know the value of
> foo[foo$A == "b",][1,2].

> Clear? ( :)) Hoping this helps, Ted.

Crystal!  It's something that one needs to be extra careful with when
playing with logicals.

Thanks Ted,

-- 
Seb



----- Message from Paul Hiemstra <p.hiemstra@geo.uu.nl> on Sat, 29 Nov 
2008 01:09:56 +0100 -----
To:
Juliet Hannah <juliet.hannah@gmail.com>
cc:
"Schreiber, Stefan" <Stefan.Schreiber@ales.ualberta.ca>, 
r-help@r-project.org
Subject:
Re: [R] save single image when using plot(lm(y~x))
Hi,

The plot function in R is a so called generic function, an appropriate 
function is chosen based on the input object provided by the user. In 
this case an lm-object (use the class() command to find this). The plot 
function that R calls is then called plot.lm. ?plot.lm gives you the 
help file and the first sentence in the help file already answers your 
problem.

hope this helps,
Paul

Juliet Hannah schreef:
> Try:
> mylm <- plot(lm(y~x))
> plot(mylm,which=2)
>
>
>
> On Fri, Nov 28, 2008 at 4:12 PM, Schreiber, Stefan
> <Stefan.Schreiber@ales.ualberta.ca> wrote:
> 
>> Dear List!
>>
>> When I'm using "plot(lm(y~x))" R shows me 4 different plots. They 
pop-up
>> individually by clicking on the graph. How can I save for example the
>> 2nd plot? I've found a camera button that says  "copy to the clipboard
>> as a metafile" once you place the mouse pointer on it. I tried, though
>> it's not working.
>>
>> Any other suggestions?
>>
>> Thanks!!
>>
>> Stefan
>>
>>        [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>> 
>
> ______________________________________________
> R-help@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.
> 


-- 
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:     +31302535773
Fax:    +31302531145
http://intamap.geo.uu.nl/~paul



----- Message from "Kara Przeczek" <przeczek@unbc.ca> on Fri, 28 Nov 2008
16:12:54 -0800 -----
To:
<r-help@r-project.org>
Subject:
[R] error message when using strptime
I am new to R and have been struggling with the following problem. I 
apologize if there is an obvious answer that I have missed.

I bring in a .txt file (pyr_h.txt) that has a DateTime column in the 
format "yyyy-mm-dd HH:MM"
When it comes into R, R does not recognize it as a date/time format. 

     Date        Time      DateTime              N_Wm2  S_Wm2
1   4/1/2008   01:00    2008-04-01 01:00    0.0000    0.00000
2   4/1/2008   02:00    2008-04-01 02:00    0.0000    0.00000
3   4/1/2008   03:00    2008-04-01 03:00    0.0000    0.00000
4   4/1/2008   04:00    2008-04-01 04:00    0.0000    0.00000
5   4/1/2008   05:00    2008-04-01 05:00    0.0000    0.00000
6   4/1/2008   06:00    2008-04-01 06:00    3.1655    2.56175


CODE:
pyr_h = read.table("H:/MastersInfo/data/Figures/Tables/pyr_h.txt",header = 
T, sep = "\t")
 #  convert Date to date format
pyr_h$Date = as.Date(pyr_h$Date, format = "%m/%d/%Y")
 #  convert DateTime to number format
pyr_h$DateTime = strptime(pyr_h$DateTime, format="%Y-%m-%d %H:%M")

This strptime command works on another .txt file of mine with the exact 
same date/time stamps, but when I try it for this file, it gives the error
message:

Error in `$<-.data.frame`(`*tmp*`, "DateTime", value = list(sec = c(0,  : 
  replacement has 9 rows, data has 1570

I tried creating a vector: 

tmp <-strptime(pyr_h$DateTime, format="%m/%d/%Y %H:%M")

When I queried the length of this vector, it was 9, yet when I print the 
vector there are 1570 objects. 
Any idea what is going on here? I have tried formatting the DateTime 
different ways in Excel, recreating the .txt file, changing the strptime 
format, and rebooting R yet nothing seems to be working.
Thanks SO much!
Kara

Kara Przeczek
M.Sc. Candidate  NRES - Environmental Science
University of Northern B.C.
3333 University Way
Prince George B.C   V2N 4Z9
Phone: (250) 960-5427
przeczek@unbc.ca





----- Message from "jim holtman" <jholtman@gmail.com> on Fri, 28 Nov 2008
19:31:23 -0500 -----
To:
"Kara Przeczek" <przeczek@unbc.ca>
cc:
r-help@r-project.org
Subject:
Re: [R] error message when using strptime
strptime has output of a POSIXlt object and you want an POSIXct object, so
use:

as.POSIXct(strptime(....

On Fri, Nov 28, 2008 at 7:12 PM, Kara Przeczek <przeczek@unbc.ca> wrote:
> I am new to R and have been struggling with the following problem. I 
apologize if there is an obvious answer that I have missed.
>
> I bring in a .txt file (pyr_h.txt) that has a DateTime column in the 
format "yyyy-mm-dd HH:MM"
> When it comes into R, R does not recognize it as a date/time format.
>
>     Date        Time      DateTime              N_Wm2  S_Wm2
> 1   4/1/2008   01:00    2008-04-01 01:00    0.0000    0.00000
> 2   4/1/2008   02:00    2008-04-01 02:00    0.0000    0.00000
> 3   4/1/2008   03:00    2008-04-01 03:00    0.0000    0.00000
> 4   4/1/2008   04:00    2008-04-01 04:00    0.0000    0.00000
> 5   4/1/2008   05:00    2008-04-01 05:00    0.0000    0.00000
> 6   4/1/2008   06:00    2008-04-01 06:00    3.1655    2.56175
>
>
> CODE:
> pyr_h = read.table("H:/MastersInfo/data/Figures/Tables/pyr_h.txt",header 
= T, sep = "\t")
>  #  convert Date to date format
> pyr_h$Date = as.Date(pyr_h$Date, format = "%m/%d/%Y")
>  #  convert DateTime to number format
> pyr_h$DateTime = strptime(pyr_h$DateTime, format="%Y-%m-%d %H:%M")
>
> This strptime command works on another .txt file of mine with the exact
same date/time stamps, but when I try it for this file, it gives the error
message:
>
> Error in `$<-.data.frame`(`*tmp*`, "DateTime", value = list(sec = c(0, :
>  replacement has 9 rows, data has 1570
>
> I tried creating a vector:
>
> tmp <-strptime(pyr_h$DateTime, format="%m/%d/%Y %H:%M")
>
> When I queried the length of this vector, it was 9, yet when I print the
vector there are 1570 objects.
> Any idea what is going on here? I have tried formatting the DateTime 
different ways in Excel, recreating the .txt file, changing the strptime 
format, and rebooting R yet nothing seems to be working.
> Thanks SO much!
> Kara
>
> Kara Przeczek
> M.Sc. Candidate  NRES - Environmental Science
> University of Northern B.C.
> 3333 University Way
> Prince George B.C   V2N 4Z9
> Phone: (250) 960-5427
> przeczek@unbc.ca
>
>
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?



----- Message from "Gabor Grothendieck" <ggrothendieck@gmail.com> on Fri,
28 Nov 2008 19:31:44 -0500 -----
To:
"Kara Przeczek" <przeczek@unbc.ca>
cc:
r-help@r-project.org
Subject:
Re: [R] error message when using strptime
You want to convert the datetime to POSIXct, not POSIXlt:

> as.POSIXct("2005-12-20 12:45")
[1] "2005-12-20 12:45:00 EST"

See R News 4/1 for details.

On Fri, Nov 28, 2008 at 7:12 PM, Kara Przeczek <przeczek@unbc.ca> wrote:
> I am new to R and have been struggling with the following problem. I 
apologize if there is an obvious answer that I have missed.
>
> I bring in a .txt file (pyr_h.txt) that has a DateTime column in the 
format "yyyy-mm-dd HH:MM"
> When it comes into R, R does not recognize it as a date/time format.
>
>     Date        Time      DateTime              N_Wm2  S_Wm2
> 1   4/1/2008   01:00    2008-04-01 01:00    0.0000    0.00000
> 2   4/1/2008   02:00    2008-04-01 02:00    0.0000    0.00000
> 3   4/1/2008   03:00    2008-04-01 03:00    0.0000    0.00000
> 4   4/1/2008   04:00    2008-04-01 04:00    0.0000    0.00000
> 5   4/1/2008   05:00    2008-04-01 05:00    0.0000    0.00000
> 6   4/1/2008   06:00    2008-04-01 06:00    3.1655    2.56175
>
>
> CODE:
> pyr_h = read.table("H:/MastersInfo/data/Figures/Tables/pyr_h.txt",header 
= T, sep = "\t")
>  #  convert Date to date format
> pyr_h$Date = as.Date(pyr_h$Date, format = "%m/%d/%Y")
>  #  convert DateTime to number format
> pyr_h$DateTime = strptime(pyr_h$DateTime, format="%Y-%m-%d %H:%M")
>
> This strptime command works on another .txt file of mine with the exact
same date/time stamps, but when I try it for this file, it gives the error
message:
>
> Error in `$<-.data.frame`(`*tmp*`, "DateTime", value = list(sec = c(0, :
>  replacement has 9 rows, data has 1570
>
> I tried creating a vector:
>
> tmp <-strptime(pyr_h$DateTime, format="%m/%d/%Y %H:%M")
>
> When I queried the length of this vector, it was 9, yet when I print the
vector there are 1570 objects.
> Any idea what is going on here? I have tried formatting the DateTime 
different ways in Excel, recreating the .txt file, changing the strptime 
format, and rebooting R yet nothing seems to be working.
> Thanks SO much!
> Kara
>
> Kara Przeczek
> M.Sc. Candidate  NRES - Environmental Science
> University of Northern B.C.
> 3333 University Way
> Prince George B.C   V2N 4Z9
> Phone: (250) 960-5427
> przeczek@unbc.ca
>
>
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



----- Message from "Schreiber, Stefan" <Stefan.Schreiber@ales.ualberta.ca>
on Fri, 28 Nov 2008 18:04:40 -0700 -----
To:
"Paul Hiemstra" <p.hiemstra@geo.uu.nl>, "Juliet Hannah" 
<juliet.hannah@gmail.com>
cc:
r-help@r-project.org
Subject:
Re: [R] save single image when using plot(lm(y~x))
Thanks Paul!!

I wasn't aware of the command "plot.lm". Therefore, I couldn't find the
help-file either. 

Cheers,
Stefan


-----Original Message-----
From: Paul Hiemstra [mailto:p.hiemstra@geo.uu.nl] 
Sent: Friday, November 28, 2008 5:10 PM
To: Juliet Hannah
Cc: Schreiber, Stefan; r-help@r-project.org
Subject: Re: [R] save single image when using plot(lm(y~x))

Hi,

The plot function in R is a so called generic function, an appropriate 
function is chosen based on the input object provided by the user. In 
this case an lm-object (use the class() command to find this). The plot 
function that R calls is then called plot.lm. ?plot.lm gives you the 
help file and the first sentence in the help file already answers your 
problem.

hope this helps,
Paul

Juliet Hannah schreef:
> Try:
> mylm <- plot(lm(y~x))
> plot(mylm,which=2)
>
>
>
> On Fri, Nov 28, 2008 at 4:12 PM, Schreiber, Stefan
> <Stefan.Schreiber@ales.ualberta.ca> wrote:
> 
>> Dear List!
>>
>> When I'm using "plot(lm(y~x))" R shows me 4 different plots. They
pop-up
>> individually by clicking on the graph. How can I save for example the
>> 2nd plot? I've found a camera button that says  "copy to the
clipboard
>> as a metafile" once you place the mouse pointer on it. I tried,
though
>> it's not working.
>>
>> Any other suggestions?
>>
>> Thanks!!
>>
>> Stefan
>>
>>        [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>> 
>
> ______________________________________________
> R-help@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.
> 


-- 
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:     +31302535773
Fax:    +31302531145
http://intamap.geo.uu.nl/~paul



----- Message from "jim holtman" <jholtman@gmail.com> on Fri, 28 Nov 2008
20:15:36 -0500 -----
To:
mitras <suparna.mitra@gmail.com>
cc:
r-help@r-project.org
Subject:
Re: [R] Help processing large data
Is this what you want:

> x <- read.table(textConnection('"read" "no" "length"
+ 2 2 144
+ 7 7 47490
+ 9 9 310944
+ 11 11 10089
+ 14 14 13152
+ 17 17 27363 '), header=TRUE)
> closeAllConnections()
> result <- lapply(1:nrow(x), function(.indx){
+     data.frame(read=paste(x$read[.indx], seq(x$length[.indx] %/% 100
+ 1), sep="_"),
+         no=rep(x$no[.indx], x$length[.indx] %/% 100 + 1),
+         length=c(rep(100, x$length[.indx] %/% 100), x$length[.indx] %%
100))
+ })
> result <- do.call(rbind, result)
>
> str(result)
'data.frame':   4094 obs. of  3 variables:
 $ read  : Factor w/ 4094 levels "2_1","2_2","7_1",..: 1 2 3 114 225
336 423 434 445 456 ...
 $ no    : int  2 2 7 7 7 7 7 7 7 7 ...
 $ length: num  100 44 100 100 100 100 100 100 100 100 ...
> head(result)
  read no length
1  2_1  2    100
2  2_2  2     44
3  7_1  7    100
4  7_2  7    100
5  7_3  7    100
6  7_4  7    100
>


On Thu, Nov 27, 2008 at 5:16 AM, mitras <suparna.mitra@gmail.com> wrote:
>
> Dear all,
>  I have one problem to handle a large dataset...
> It looks like:
> "read" "no" "length"
> 2 2 144
> 7 7 47490
> 9 9 310944
> 11 11 10089
> 14 14 13152
> 17 17 27363 and so on
> There are 130000 rows
>
> >From this table I need to make a table like
> 2_1 2 100
> 2_2 2 44
> 7_1 7 100
> 7_2 7 100
> ...
> ...
> 7_474 7 100
> 7_475 7 90
> 9_1 9 100
> 9_2 9 100 and so on...
>
> In words: I want to divide the 3rd column by 100  to keep the length 100
and
> increasing no of rows needed, where no will be same for all increased 
rows,
> but the read will be changed like 2_1,2_2 and so on..
> Please let me know if any one can help.
> Thanks a lot in advance.
> Best,
> Mitra.
> --
> View this message in context: 
http://www.nabble.com/Help-processing-large-data-tp20716564p20716564.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?



----- Message from "C.H." <chainsawtiney@gmail.com> on Sat, 29 Nov 2008 
11:03:05 +0800 -----
To:
"Blanchette, Marco" <MAB@stowers-institute.org>
cc:
R-help <r-help@r-project.org>, John Fox <jfox@mcmaster.ca>, "Bunny, 
lautloscrew.com" <bunny@lautloscrew.com>
Subject:
Re: [R] editor for MacOS X
Aquamacs preinstalled ess-mode.

http://aquamacs.org/


On Fri, Nov 28, 2008 at 11:57 PM, Blanchette, Marco
<MAB@stowers-institute.org> wrote:
> Carbon emacs ( http://homepage.mac.com/zenitani/emacs-e.html) using the
ess-mode ( http://ess.r-project.org/). Amazingly good integration of 
different buffer types for different tasks. You can have your R session 
running in a buffer, a .R buffer where you edit your functions/sources and
with very simple key strokes you can send/run lines, functions or full 
buffer into the running R session. Great integration of the help pages 
too.
>
> This as become my central environment where I do all my computing work,
programming (perl, python, etc...), shell work, R jobs, MySQL work etc...
In addition, your Mac can be configure to run emacs remotely as a client 
on any other type of machine. For instance, at home, on my PC or on my 
Mac, I can fire up an SSH connection from either X11 or PuTTY to the Mac 
desktop in my office, then fire up emacs from the terminal, et voila! I am
running jobs on the computer in my office (which as 8 core and 32Mb of 
RAM) from the same environment as I normally used in my office (can be a 
bit bandwidth intensive though).
>
> You should also check the noweb mode ( 
http://www.cs.tufts.edu/~nr/noweb/) for integrating codes and 
documentation, pretty cool.
>
> Cheers,
>
> Marco
>
>
> On 11/28/08 7:55 AM, "John Fox" <jfox@mcmaster.ca> wrote:
>
> Dear Bunny,
>
> I've been using Eclipse with the StatET plug-in
> <http://www.walware.de/goto/statet> under both Windows and Mac OS X. 
Eclipse
> + StatET provides much more than a code editor, such as the ability to 
check
> and build packages and to interact with an svn archive. On the downside,
it
> requires quite a bit of configuration.
>
> I hope this helps,
>  John
>
> ------------------------------
> John Fox, Professor
> Department of Sociology
> McMaster University
> Hamilton, Ontario, Canada
> web: socserv.mcmaster.ca/jfox
>
>
>> -----Original Message-----
>> From: r-help-bounces@r-project.org 
[mailto:r-help-bounces@r-project.org]
> On
>> Behalf Of Bunny, lautloscrew.com
>> Sent: November-28-08 6:16 AM
>> To: r-help@r-project.org
>> Subject: [R] editor for MacOS X
>>
>> Hi all,
>>
>> just wondered again, if there is some R editor for Mac OS X comparable
>> to TINN-R on windows.
>>
>> thx in advance..
>>
>> ______________________________________________
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help@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.
>
>
> --
> Marco Blanchette, Ph.D.
> Assistant Investigator
> Stowers Institute for Medical Research
> 1000 East 50th St.
>
> Kansas City, MO 64110
>
> Tel: 816-926-4071
> Cell: 816-726-8419
> Fax: 816-926-2018
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.com



----- Message from Berwin A Turlach <berwin@maths.uwa.edu.au> on Sat, 29 
Nov 2008 13:37:37 +0800 -----
To:
"Sebastian P. Luque" <spluque@gmail.com>
cc:
r-help@stat.math.ethz.ch
Subject:
Re: [R] NA and logical indexes
G'day Sebastian,

On Fri, 28 Nov 2008 16:35:13 -0600
"Sebastian P. Luque" <spluque@gmail.com> wrote:

> On Fri, 28 Nov 2008 22:01:15 -0000 (GMT),
> (Ted Harding) <Ted.Harding@manchester.ac.uk> wrote:
>
> > NA can seem to have a bewildering logic, but it all becomes clear if
> > you interpret NA as "value unkown".
> > [...] 
> > Clear? ( :)) Hoping this helps, Ted.
> 
> Crystal!  It's something that one needs to be extra careful with when
> playing with logicals.

Or, rather, if you expect that your code one day has to handle data in
which values from which you construct logicals might be missing (NA),
then it might be worthwhile to think carefully about this case and how
you want to handle missing values.  In your case, do you want to
return the rows where foo$A is missing or not?  Both is possible:

R> foo <- data.frame(A=gl(2, 5, labels=letters[1:2]), X=runif(10))
R> foo$A[1] <- NA
R> foo[!is.na(foo$A) & foo$A == "b", ] 
   A         X
6  b 0.8418619
7  b 0.6833322
8  b 0.1582648
9  b 0.4431542
10 b 0.7603365
R> foo[is.na(foo$A) | foo$A == "b", ] 
      A         X
1  <NA> 0.8922147
6     b 0.8418619
7     b 0.6833322
8     b 0.1582648
9     b 0.4431542
10    b 0.7603365

Cheers,

                 Berwin

=========================== Full address =============================
Berwin A Turlach                            Tel.: +65 6516 4416 (secr)
Dept of Statistics and Applied Probability        +65 6516 6650 (self)
Faculty of Science                          FAX : +65 6872 3919 
National University of Singapore 
6 Science Drive 2, Blk S16, Level 7          e-mail: statba@nus.edu.sg
Singapore 117546                    http://www.stat.nus.edu.sg/~statba



----- Message from Bob Green <bgreen@dyson.brisnet.org.au> on Sat, 29 Nov
2008 19:08:14 +1000 -----
To:
r-help@r-project.org
Subject:
[R] Error in check(itp) : ?object? do es not represent a K sample problem
with censored data
Hello,

I have two questions regarding a survival analysis I have been 
working on. Below is the code to date.
The variables:

1) recidivism$intDaysUntilFVPO  are the number of days before an 
violent offence was committed - if no offence was committed than the 
days between court hearing and end of data collection was recorded.
2) recidivism$intDaysUntilFNVPO are the number of days before a 
nonviolent offence was committed - if no offence was committed than 
the days between court hearing and end of data collection was recorded.
3) recidivism$Event_v   coded TRUE or FALSE as to whether a violent 
offence was committed
4) recidivism$Event_nv   coded TRUE or FALSE as to whether a 
non-violent offence was committed
5) recidivism$group - there were 3 groups recorded as 1, 2 or 3

I encountered two problems:

a)  when I tried to run the following: > 
surv_test(Surv(recidivism$intDaysUntilFVPO, recidivism$Event_v) ~ 
recidivism$group, data = recidivism, distribution = "exact")

I received the following error message. I am unsure whether the 
problem lies with the group variable, how I have set up the time 
variables or there is something missing.

Error in check(itp) :
   'object' does not represent a K sample problem with censored data

(b) I ran some simple plots of the curves. While I have a fair idea 
of  which group is which, I wanted to add a legend identifying the 
groups ? What code is required for this?

Any assistance is much appreciated,

Bob


 > library(survival)
 >
 > survdiff(Surv(recidivism$intDaysUntilFVPO, recidivism$Event_v) ~ 
group, data = recidivism)
Call:
survdiff(formula = Surv(recidivism$intDaysUntilFVPO, recidivism$Event_v) ~
     group, data = recidivism)

            N Observed Expected (O-E)^2/E (O-E)^2/V
group=1 1136      135   154.18      2.39      7.75
group=2  446       87    61.29     10.78     14.90
group=3   65        1     7.52      5.66      5.86

  Chisq= 18.9  on 2 degrees of freedom, p= 8.06e-05
 > survdiff(Surv(recidivism$intDaysUntilFNVPO, recidivism$Event_nv) ~ 
group, data = recidivism)
Call:
survdiff(formula = Surv(recidivism$intDaysUntilFNVPO, recidivism$Event_nv) 
~
     group, data = recidivism)

            N Observed Expected (O-E)^2/E (O-E)^2/V
group=1 1136      323    366.3      5.11     17.80
group=2  446      184    127.7     24.84     33.12
group=3   65        7     20.1      8.51      8.86

  Chisq= 38.5  on 2 degrees of freedom, p= 4.3e-09
 > layout(matrix(1:2, ncol = 2))
 > plot(survfit(Surv(recidivism$intDaysUntilFNVPO, 
recidivism$Event_v) ~ recidivism$group, data = recidivism), main = 
"time to violent reoffense by group", lty = c(1,2,3), ylab = 
"probability", xlab = "survival time in days")
 > plot(survfit(Surv(recidivism$intDaysUntilFVPO, 
recidivism$Event_nv) ~ recidivism$group, data = recidivism), main = 
"time to nonviolent reoffense by group", lty = c(1,2,3), ylab = 
"probability", xlab = "survival time in days")
 >
 > library(coin)
 > surv_test(Surv(recidivism$intDaysUntilFVPO, recidivism$Event_v) ~ 
recidivism$group, data = recidivism, distribution = "exact")
Error in check(itp) :
   'object' does not represent a K sample problem with censored data



----- Message from Ophelia Wang <opheliawang@mail.utexas.edu> on Sat, 29 
Nov 2008 04:22:18 -0600 -----
To:
r-help@r-project.org
Subject:
[R] Subset by string name?
Hi all,

I thought this should be very simple, but I'm not sure where the
problem is. I have a .txt data file that contains X and Y coordinates
of trees and their family names:

"X"              "Y"             "Mark"
0                28              "Sapotaceae"
1                30              "Meliaceae"
1                40              "Meliaceae"
1                60              "Mimosaceae"
1                76              "Olacaceae"
1.5              73              "Myristicaceae"
2                34              "Euphorbiaceae"
2                62              "Olacaceae"
2                86              "Mimosaceae"
2.5              36              "Arecaceae"
3                22              "Nyctaginaceae"
3                25              "Moraceae"
3                38              "Rubiaceae"
3                47              "Desconocido "
3                99              "Mimosaceae"
3.5              24              "Anacardiaceae"
3.5              57              "Sapotaceae"
4                1               "Lecythidaceae"

Now I just want to work on one family for various spatial analyses in
ads and spatstats, so I wrote:

Yut <-read.delim(
"C:/dissertation/data2006/Parcela_1-3/Yutsun_tree.txt", header = TRUE,
sep = "\t", quote="\"", dec=".", fill = TRUE )

Yut_are <- subset (Yut, Mark="Arecaceae", select=c(X, Y, Mark))

However, the summary of Yut_are still contains trees of other families:

    X                Y                    Mark
   Min.   :  0.00   Min.   : 0.00   Myristicaceae: 65
   1st Qu.: 24.00   1st Qu.:24.00   Lecythidaceae: 60
   Median : 46.00   Median :51.00   Sapotaceae   : 51
   Mean   : 48.07   Mean   :49.72   Moraceae     : 45
   3rd Qu.: 72.50   3rd Qu.:75.50   Arecaceae    : 41
   Max.   :100.00   Max.   :99.00   Mimosaceae   : 34
                                    (Other)      :313

Please tell me how do I subset a dataset like this to extract trees
from only one or a few families? Thanks a lot!

Ophelia

-- 
Yung-Ho (Ophelia) Wang
Doctoral Candidate
Department of Geography and the Environment
University of Texas
+1-512-232-1597
opheliawang@mail.utexas.edu



----- Message from Ophelia Wang <opheliawang@mail.utexas.edu> on Sat, 29 
Nov 2008 04:35:39 -0600 -----
To:
r-sig-ecology@r-project.org
cc:
r-help@r-project.org
Subject:
Re: [R] Subset by family name?
Sorry to bother everyone---I realized I should have used "==" instead
of "=" in the subset syntax!


Quoting Ophelia Wang <opheliawang@mail.utexas.edu>:

> Hi all,
>
> I thought this should be very simple, but I'm not sure where the
> problem is. I have a .txt data file that contains X and Y coordinates
> of trees and their family names:
>
> "X"            "Y"             "Mark"
> 0              28              "Sapotaceae"
> 1              30              "Meliaceae"
> 1              40              "Meliaceae"
> 1              60              "Mimosaceae"
> 1              76              "Olacaceae"
> 1.5            73              "Myristicaceae"
> 2              34              "Euphorbiaceae"
> 2              62              "Olacaceae"
> 2              86              "Mimosaceae"
> 2.5            36              "Arecaceae"
> 3              22              "Nyctaginaceae"
> 3              25              "Moraceae"
> 3              38              "Rubiaceae"
> 3              47              "Desconocido "
> 3              99              "Mimosaceae"
> 3.5            24              "Anacardiaceae"
> 3.5            57              "Sapotaceae"
> 4              1               "Lecythidaceae"
>
> Now I just want to work on one family for various spatial analyses in
> ads and spatstats, so I wrote:
>
> Yut <-read.delim(
> "C:/dissertation/data2006/Parcela_1-3/Yutsun_tree.txt", header = TRUE,
> sep = "\t", quote="\"", dec=".", fill = TRUE )
>
> Yut_are <- subset (Yut, Mark="Arecaceae", select=c(X, Y, Mark))
>
> However, the summary of Yut_are still contains trees of other families:
>
>   X                Y                    Mark
>  Min.   :  0.00   Min.   : 0.00   Myristicaceae: 65
>  1st Qu.: 24.00   1st Qu.:24.00   Lecythidaceae: 60
>  Median : 46.00   Median :51.00   Sapotaceae   : 51
>  Mean   : 48.07   Mean   :49.72   Moraceae     : 45
>  3rd Qu.: 72.50   3rd Qu.:75.50   Arecaceae    : 41
>  Max.   :100.00   Max.   :99.00   Mimosaceae   : 34
>                                   (Other)      :313
>
> Please tell me how do I subset a dataset like this to extract trees
> from only one or a few families? Thanks a lot!
>
> Ophelia
>



----- Message from Johannes Huesing <johannes@huesing.name> on Sat, 29 Nov
2008 11:40:39 +0100 -----
To:
Tom Backer Johnsen <backer@psych.uib.no>
cc:
r-help@stat.math.ethz.ch, "Hans W. Borchers" <hwborchers@gmail.com>
Subject:
Re: [R] Examples of advanced data visualization
Tom Backer Johnsen <backer@psych.uib.no> [Fri, Nov 28, 2008 at 10:13:04PM
CET]:
> Hans W. Borchers wrote:
[...]
>>
>> Please answer to my e-mail address. In case enough interesting material
comes
>> up, I will enter a summary here.
>
> It is nice that you are willing to summarize whatever appears, but 
> somewhat arrogant in my eyes.  There might be things appearing that you
> do not regard as of first interest that might be of interest to others.

I'd say "arrogant" is a bit harsh. There are mailing lists where there 
is a good summary culture (haven't come across one lately though, remember
it rather from 15 years ago) which doesn't make you feel excluded, 
rather quiet mailing list where a sudden lengthy discussion would cause
people to react bewildered and alienated, and specialized questions 
which only interest a handful readers, who could always contact the 
original contributor for more information.

This list and Hans' question doesn't fit any of the criteria. Therefore I
agree with Tom's conclusion:

> In other words, I therefore suggest that the list ignores the last 
> paragraph in the question from you.

but I'd say that there are situations where it would be best to follow 
Hans' request.
-- 
Johannes Hüsing               There is something fascinating about 
science. 
                              One gets such wholesale returns of 
conjecture 
mailto:johannes@huesing.name  from such a trifling investment of fact.     

http://derwisch.wikidot.com         (Mark Twain, "Life on the 
Mississippi")


_______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

	[[alternative HTML version deleted]]

