[R] climatological standard deviation

2008-09-24 Thread Yogesh Tiwari
Hello R users,

I have a montly time series over a several year period.
It's easy to compute a monthly climatology (12 values), Now, I would like to
calculate the corresponding standard deviation, ie the 12 values
calculated from the january values, february values, etc.
What's the best way for such a calculation ?
Regards,
Yogesh

-- 
Yogesh K. Tiwari (Dr.rer.nat),
Scientist,
Indian Institute of Tropical Meteorology,
Homi Bhabha Road,
Pashan,
Pune-411008
INDIA

Phone: 0091-99 2273 9513 (Cell)
: 0091-20-258 93 600 (O) (Ext.250)
Fax : 0091-20-258 93 825

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


Re: [R] How to draw the graph of f(x,y) = x * y ?

2008-09-24 Thread Robin Hankin

Paul

you might find the view() function in the 'elliptic' package useful.

This function implements various methods to visualize functions
over the complex plane.

HTH


rksh



Paul Smith wrote:

Dear All,

The function curve() draws the graph of functions from R to R. Is
there some homologous function to curve() to draw functions from R^2
to R?

Thanks in advance,

Paul

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



--
Robin K. S. Hankin
Senior Research Associate
Cambridge Centre for Climate Change Mitigation Research (4CMR)
Department of Land Economy
University of Cambridge
[EMAIL PROTECTED]
01223-764877

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


Re: [R] Options for viewing / using results from lm

2008-09-24 Thread Michael Just
Hello,
Thanks for the response.

However, I have this problem with view.

 View(fit1)
Error: could not find function View

I have R 2.4.1 and even tried loading 'utils'.

As for saving residuals in a spreadsheet I used something like this:

res.fit1-fit1$residuals
res.fit2-fit2$residuals

write.csv(res.fit1, file=res.fit1.csv)
write.csv(res.fit2, file=res.fit2.csv)

Thanks,
M Just

On Tue, Sep 23, 2008 at 9:07 PM, Greg Snow [EMAIL PROTECTED] wrote:

  The View function (note the uppercase V) is in the utils package, one of
 the standard ones that loads automatically.
  --
 *From:* Michael Just [EMAIL PROTECTED]
 *Sent:* Tuesday, September 23, 2008 2:49 PM
 *To:* Greg Snow
 *Cc:* r-help@r-project.org; [EMAIL PROTECTED]

 *Subject:* Re: [R] Options for viewing / using results from lm

   Greg,
 Thanks for the pseudocode and cbind suggestions I think these should be
 quite helpful. What package is the function 'view' in? As for exporting
 elsewhere, basically I would to have the values of residuals saved in a
 spreadsheet in addition to any visualizations created within R.

 Thanks,
 M Just

 On Tue, Sep 23, 2008 at 3:26 PM, Greg Snow [EMAIL PROTECTED] wrote:

 You can do things like this pseudocode:

  fit1 - lm( y ~ x1, data=mydata )
  fit2 - lm( y ~ x2, data=mydata )
  fit3 - lm( y ~ x1*x2, data=mydata )
 ...

  mydata$r1 - resid(fit1)
  mydata$r2 - resid(fit2)
  mydata$r3 - resid(fit3)

 Or

  mydata - cbind(mydata, r1=resid(fit1), r2=resid(fit2), ...

 To view the data in a spreadsheet like table:

  View(mydata)

 And scroll over to the r columns, using indexing or the subset function
 can reorder the columns to make this easier.

 A simple plot:

  pairs( mydata[ , paste('r',1:10, sep='')], col=c('red','green','blue')[
 mydata$g1 ],
 + panel=panel.smooth )

 Or there are various other ways to explore the data within R.  If you
 really feel the need to use another tool, do like the above, then use
 write.table to export it to a csv file or paste it to a spreadsheet.   There
 is also the rggobi package which will automate the exporting to the ggobi
 program which allows a lot more visualization options.

 Hope this helps,


 --
 Gregory (Greg) L. Snow Ph.D.
 Statistical Data Center
 Intermountain Healthcare
 [EMAIL PROTECTED]
 801.408.8111


  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
  project.org] On Behalf Of Michael Just
  Sent: Tuesday, September 23, 2008 2:06 PM
  To: r-help@r-project.org
  Cc: [EMAIL PROTECTED]
  Subject: Re: [R] Options for viewing / using results from lm
 
  Hello,
 
  Why do you think it is better done in another program? Keeping it in R
  saves you from the exporting, which you say you are having trouble
  with.
 
  I think it might be better for viewing capabilities. If I had columns
  of
  residuals right next to each other I could spot differences amongst
  locations. Right? If I can take the residual values and put them back
  into
  my main data file I can then have the options to use grouping values
  that
  exist there. (Like I asked here:
  http://tolstoy.newcastle.edu.au/R/e5/help/08/09/2186.html)
 
   Q2: How can I take the residuals and create an object(s) for further
   http://tolstoy.newcastle.edu.au/R/e5/help/08/09/2259.html#2265qlink2
 *
  analysis.
  *
  **
 
  See ?residuals.
 
  Try the following:
 
  x - sample(1:20, 100, replace=TRUE)
  y - rnorm(100)
  fit.lm - lm(y ~ x)
  plot(residuals(fit.lm))
  plot(x,residuals(fit.lm))
 
 
  When I was thinking further analysis, for example, could I take the
  residuals for all metrics in one extent and compare them to all
  residuals
  for all metrics in another extent? Even though the were created with 16
  different models?
 
  In 'plot(residuals(fit.lm))' what is the index 'counting'?
 
 
  Thank you kindly for you $0.25,
 
  Cheers,
 
  M Just
 
   [[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.




[[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] Antwort: Re: WG: Problem during porting R-2.7.2 on HP-UP 11.11 PA-Risc

2008-09-24 Thread claus-juergen . neumann

Dear Peter,
thank you so much for the information and quick help, this was my problem
to get the configure run.
please see the results:

R is now configured for hppa2.0w-hp-hpux11.11

  Source directory:  .
  Installation directory:/opt/R

  C compiler:gcc -std=gnu99  -g -O2
  Fortran 77 compiler:   f90  -g

  C++ compiler:  g++  -g -O2
  Fortran 90/95 compiler:f90 -g
  Obj-C compiler:

  Interfaces supported:
  External libraries:
  Additional capabilities:   PNG, JPEG, iconv, MBCS, NLS
  Options enabled:   shared BLAS, R profiling

  Recommended packages:  yes

configure: WARNING: you cannot build DVI versions of the R manuals
configure: WARNING: you cannot build PDF versions of the R manuals


But now i have a new problem during the make, we get a error from the
compiler.
Please Peter can you look / help again?

141 Lines Compiled
f90   -g -c eigen.f -o eigen.o
eigen.f
   external subroutine BALANC
   external subroutine BALBAK
   external subroutine CBABK2
   external subroutine CBAL
   external subroutine CDIV
   external subroutine COMQR
   external subroutine COMQR2
   external subroutine CORTH
   external subroutine CSROOT
   external subroutine ELMHES
   external subroutine ELTRAN
   external function EPSLON
   external subroutine HQR
   external subroutine HQR2
   external subroutine HTRIBK
   external subroutine HTRIDI
   external function PYTHAG
   external subroutine TQL1
   external subroutine TQL2
   external subroutine TQLRAT
   external subroutine TRED1
   external subroutine TRED2
   external subroutine RG
   external subroutine RS
   external subroutine CG
   external subroutine CH

3502 Lines Compiled
Make: Don't know how to make #.  Stop.
*** Error exit code 1

Stop.
*** Error exit code 1

Stop.
*** Error exit code 1

Stop.

-
Ok, this makes no sense in this moment ;-)

ZLI/sw2/R-2.7.2  make install
mkdir /opt/R/bin/lib
mkdir /opt/R/bin/lib/R
installing doc ...
mkdir /opt/R/bin/lib/R/doc
mkdir /opt/R/share
mkdir /opt/R/share/man
mkdir /opt/R/share/man/man1
../tools/install-sh -c -m 644 ../NEWS /opt/R/bin/lib/R/doc
help2man: can't get `--version' info from ../bin/R
*** Error exit code 127

Stop.
*** Error exit code 1

Stop.


Viele Grüße
Claus-Juergen Neumann
Global RD Information Technology and Information Management


Phone: +49 621 60-27453, Mobile: +49 172 7437400, Fax: +49 621 60-27092,
E-Mail: [EMAIL PROTECTED]
Postal Address: BASF SE, AP/CLS - LI444, D-67117 Limburgerhof, Germany


BASF - The Chemical Company


BASF SE, Registered Office: 67056 Ludwigshafen, Germany
Companies' Register: Amtsgericht Ludwigshafen, Registration No.: HRB 6000
Chairman of the Supervisory Board: Juergen Strube
Board of Executive Directors:
Juergen Hambrecht, Chairman; Eggert Voscherau, Vice Chairman;
Kurt Bock, Martin Brudermueller, John Feldmann, Andreas Kreimeyer, Stefan
Marcinowski, Harald Schwager




   
 Peter Dalgaard
 [EMAIL PROTECTED] 
 at.ku.dk  An 
[EMAIL PROTECTED] 
 23.09.2008 15:35Kopie 
r-help@r-project.org   
 Thema 
Re: [R] WG: Problem during porting 
R-2.7.2 on HP-UP 11.11 PA-Risc 
   
   
   
   
   
   




[EMAIL PROTECTED] wrote:


  Claus-Juergen

  Neumann/BASF-AG/B

  ASF
An
 r-help@r-project.org

  23.09.2008 12:49
Kopie



Thema
 Problem during porting R-2.7.2 on

 HP-UP 11.11 PA-Risc




















 Dear R-Team,
 we had some problem to install R-2.7.2 on HP-UX 11.11 on PA-Risc
platform.

 1.) i load down the Software and made a extract of the tar-file in a
 specific Directory.

 2.) i follow the instructions on the 

Re: [R] cannot allocate memory

2008-09-24 Thread Uwe Ligges



DumpsterBear wrote:

I am getting Error: cannot allocate vector of size 197 MB.
I know that similar problems were discussed a lot already, but I
didn't find any satisfactory answers so far!

Details:
*** I have XP (32bit) with 4GB ram. At the time when the problem
appeared I had 1.5GB of available physical memory.
*** I increased R memory limit to 3GB via memory.limit(3000)



Have you told Windows to allow processes of more than 2GB?



*** I did gs() and got


gc(), I think.

Uwe Ligges



used  (Mb) gc trigger   (Mb)  max used   (Mb)
Ncells147534   4.0 407500   10.9407500   10.9
Vcells 104939449 800.7  186388073 1422.1 185874684 1418.2

The garbage collection didn't help.

Any ideas? Many thanks in advance!

-- Adam

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


Re: [R] Antwort: Re: WG: Problem during porting R-2.7.2 on HP-UP 11.11 PA-Risc

2008-09-24 Thread Peter Dalgaard
[EMAIL PROTECTED] wrote:
 Make: Don't know how to make #.  Stop.
 *** Error exit code 1
   
Sounds like you are using a make which doesn' t understand comments
(??!). You might need to install GNU make and possibly set MAKE=gmake or
some such to make sure that you are using the right one. At least that
is the sort of thing you needed to do on Solaris five years ago... Isn't
this in the  admin manual?

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
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] Logistic regression

2008-09-24 Thread Annie Bissonnette

Dear all,

I am currently learning to run logistic regression models with R. Would 
someone tell me what this exactly means:


Estimated scale (compare to 1 ) 1.746724

If the value is higher or lower than 1, what should I do?

The complete results of the model were as follows:
Generalized linear mixed model fit using Laplace
Formula: success ~ diffca + (1 | partner1) + (1 | partner2) + (1 | target)
   Data: cascoresept08.df
 Family: binomial(logit link)
   AIC BIC logLik deviance
 105.8 121.8 -47.89 95.79
Random effects:
 Groups Name Variance Std.Dev.
 partner1 (Intercept) 5.e-10 2.2361e-05
 partner2 (Intercept) 5.e-10 2.2361e-05
 target (Intercept) 1.0461e+00 1.0228e+00
number of obs: 182, groups: partner1, 19; partner2, 19; target, 13

Estimated scale (compare to 1 ) 1.746724

Fixed effects:
Estimate Std. Error z value Pr(|z|)
(Intercept) -4.5053 0.9174 -4.911 9.06e-07 ***
diffca 0.7631 0.1130 6.756 1.42e-11 ***

I thank you in advance!

Annie

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


Re: [R] Bug in is ?

2008-09-24 Thread Keith Jewell
7 is an integer, but it's also a real.

In R '?is'  and '?is.integer' are clear that you're testing the class(es) of 
objects, not their values.
I can't comment on the relationship with S Programming

hth

Keith J

[EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 This is really bothering me! In the Dr. Venables and Dr. Ripley's book  S 
 Programming Page 105
 shows that
 c(is(10,integer),is(10.5,integer))
 [1] T F

 But I try this in R 2.7.2 it shows
 c(is(10,integer),is(10.5,integer))
 [1] FALSE FALSE
 Does anyone know what is going on here?

 Appreciate,
 Chunhao




 Quoting Yihui Xie [EMAIL PROTECTED]:

 Yes, everyone will agree 7 is an integer, but I don't think
 computers will agree too :-) R thinks it's a double-precision number,
 except when you explicitly specify it as an integer (say,
 as.integer()).

 class(7)
 [1] numeric

 is.double(7)
 [1] TRUE

 Regards,
 Yihui
 --
 Yihui Xie [EMAIL PROTECTED]
 Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
 Mobile: +86-15810805877
 Homepage: http://www.yihui.name
 School of Statistics, Room 1037, Mingde Main Building,
 Renmin University of China, Beijing, 100872, China



 On Wed, Sep 24, 2008 at 12:40 PM,  [EMAIL PROTECTED] wrote:
 Hi R users
 Is there anything wrong in is function? (R 2.7.2)
 I believe that everyone will agree that 7 is an integer, right? but 
 why R
 shows 7 is not an integer

 is.integer(7)

 [1] FALSE

 is(7,integer)

 [1] FALSE

 is(as.integer(7), integer)

 [1] TRUE

 Thank you very much in advance
 Chunhao

__
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] match.call in a function

2008-09-24 Thread Camarda, Carlo Giovanni
Dear UseRs,

please find below a simple example which exemplifies my question. 
In words, I'd like to write a function which prints formula and outcomes only 
when results are not assigned or recalling the already assigned object, as e.g. 
glm.
I'm sure a solution is rather simple and straightforward and it has something 
to do with match.call (maybe), but I'm not able to see it.

Thanks in advance for any help
Carlo G. Camarda

# my simple function
myFUN - function(a, b, method){
res - ifelse(method==1, a+b, a-b)
object - list(res=res, call=match.call())
return(object)
}
# assigning to A
A - myFUN(2,4,1)
# recalling A or don't assign ...
A
myFUN(2,4,1)

# ... what I'd like (somehow) to have when
# I don't assign myFUN to another obj
# or when I recall the obj itself
My simple analysis

Call: myFUN(a = 2, b = 4, method = 1)

a: 2
b: 4
Outcome: 6


-
Carlo Giovanni Camarda
Research Scientist
Konrad-Zuse-Straße 1
18057 Rostock - Germany
Phone: +49 381 2081 172
Fax: +49 381 2081 472
[EMAIL PROTECTED]
http://www.demogr.mpg.de/en/staff/camarda/default.htm
-


--
This mail has been sent through the MPI for Demographic ...{{dropped:10}}

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


Re: [R] cannot allocate memory

2008-09-24 Thread Bernardo Rangel Tura
Em Ter, 2008-09-23 às 21:42 -0400, DumpsterBear escreveu:
 I am getting Error: cannot allocate vector of size 197 MB.
 I know that similar problems were discussed a lot already, but I
 didn't find any satisfactory answers so far!
 
 Details:
 *** I have XP (32bit) with 4GB ram. At the time when the problem
 appeared I had 1.5GB of available physical memory.
 *** I increased R memory limit to 3GB via memory.limit(3000)
 *** I did gs() and got
 used  (Mb) gc trigger   (Mb)  max used   (Mb)
 Ncells147534   4.0 407500   10.9407500   10.9
 Vcells 104939449 800.7  186388073 1422.1 185874684 1418.2
 
 The garbage collection didn't help.
 
 Any ideas? Many thanks in advance!
 

Adam,

First, is possible 32bit XP use all your 4Gb?

Second, I think you say gc whem say gs, so in my computer (Ubuntu
64bit with 4Gb):

 gc()
 used (Mb) gc trigger (Mb) max used (Mb)
Ncells 188975 10.1 407500 21.8   35 18.7
Vcells 169133  1.3 786432  6.0   786378  6.0

 gc(reset=T)
 used (Mb) gc trigger (Mb) max used (Mb)
Ncells 188951 10.1 407500 21.8   188951 10.1
Vcells 168893  1.3 786432  6.0   168893  1.3

If you read gc help:

reset: logical; if 'TRUE' the values for maximum space used are
  reset to the current values.

Other issue is options for rgui command.
Have a option --max-mem-size that you modify to expand you RAM
avaiable

-- 
Bernardo Rangel Tura, M.D,MPH,Ph.D
National Institute of Cardiology
Brazil

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


Re: [R] Modifying output to Google Docs

2008-09-24 Thread Jim Lemon

Ajay ohri wrote:

Hi List,
Graphical output to PDF's ,RTF ,CSV is known through R.
Can it be modified for outputting to Google Docs (which is basically
uploaded files ,published to become html pages)

Is there any package on this ?

  

Hi Ajay,
Do you mean transforming R output into HTML? The R2HTML package does 
this, and the htmlize and R2html functions in the prettyR package do so 
as well.


Jim

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


Re: [R] Modifying output to Google Docs

2008-09-24 Thread Ajay ohri
Do I mean R output to Google docs, like in Google spreadsheets which are
different from a spreadsheet published as an html
or Presentations in Google Docs, which are  much different tahn ordinary
html presentations.

See examples here of Google Docs-
https://spreadsheets.google.com/ccc?key=pS9vSxWuwOlmcp-m7LUaAKAhl=en

Thats an example of country wise medals in Olympics , and see if you can
switch to Sheet3 which has graphs.

Ajay

www.decisionstats.com

On Wed, Sep 24, 2008 at 3:05 PM, Jim Lemon [EMAIL PROTECTED] wrote:

 Ajay ohri wrote:

 Hi List,
 Graphical output to PDF's ,RTF ,CSV is known through R.
 Can it be modified for outputting to Google Docs (which is basically
 uploaded files ,published to become html pages)

 Is there any package on this ?



 Hi Ajay,
 Do you mean transforming R output into HTML? The R2HTML package does this,
 and the htmlize and R2html functions in the prettyR package do so as well.

 Jim




-- 
Regards,

Ajay Ohri
http://tinyurl.com/liajayohri

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


Re: [R] R2HTML: output from for-loops

2008-09-24 Thread Jim Lemon

Werner Wernersen wrote:

Hi,

I am trying to prepare a report with R2HTML using 
HTMLStart(outdir=./html, filename=report, echo=T, HTMLframe=F)


then, for instance, I want to get the output of a loop:
for (i in 1:20) print(summary(rnorm(1000)))

but only the first of summaries really ends up in the html file.
What am I doing wrongly?
  

Hi Werner,
I don't think you are doing anything wrong. I tried running a loop with 
the htmlize function in the prettyR package and it seems to work okay.


Jim

__
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] extract species in a phylog tree

2008-09-24 Thread Christine N. Meynard
Hi,

I am working with a phylog tree and I would like to extract a subset of the
tree based on the species names (conserving the evolutionary distance and
relationships between the pairs of species I am interested in). I see there
is an option to select a subset of the tree using node names
(phylog.extract), but this is not what I need since one node could take me
to several species, some of which I am not interested in. This happens, for
example, when I have a phylogenetic tree for, say, all bird species of North
America, but I am only interested on those 20 that occur in my community,
and I would like to extract the phylog tree for these species. Would anyone
have any advice on how to proceed?

Thanks a lot,

Christine

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


Re: [R] read.table readLines behaviour?

2008-09-24 Thread J . delasHeras

Quoting Peter Dalgaard [EMAIL PROTECTED]:


[EMAIL PROTECTED] wrote:


Hi,


I have been using 'read.table' regularly to read tab-delimited text
files with data. No problem, until now.
Now I have a file that appeared to have read fine, and the data inside
looks correct (structure etc), except I only had 15000+ rows out of
the expected 24000. Using 'readLines' instead, and breaking up the
data by tabs, gives me the expected result.
I do not understand why this is happening and I can't find anything
obvious in the data to explain the bahaviour...
Does anybody have an explanation? something to watch out for?

Hmm:

- completely blank lines
- filling
- quotes

My bet would be on the last one. Does read.delim work better?


I just tried 'read.delim', and it reads the file just fine


xxx-read.delim(All_norm_calls.txt, header=T, sep=\t)
dim(xxx)

[1] 2400011

I'll check for quotes etc. Thanks!


Also, just in case: Check length(probesets) after the readLines call.


I did the first time. It gives me the expected 20001 lines (the first  
one is the header)


Jose


--
Dr. Jose I. de las Heras  Email: [EMAIL PROTECTED]
The Wellcome Trust Centre for Cell BiologyPhone: +44 (0)131 6513374
Institute for Cell  Molecular BiologyFax:   +44 (0)131 6507360
Swann Building, Mayfield Road
University of Edinburgh
Edinburgh EH9 3JR
UK

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

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


Re: [R] read.table readLines behaviour?

2008-09-24 Thread J . delasHeras


The result was 11, 24001 times, as I expected originally. hmmm...

JOse


Quoting Gabor Grothendieck [EMAIL PROTECTED]:


Try looking at the result of count.fields to diagnose it.

On Tue, Sep 23, 2008 at 5:19 AM,  [EMAIL PROTECTED] wrote:


Hi,


I have been using 'read.table' regularly to read tab-delimited text files
with data. No problem, until now.
Now I have a file that appeared to have read fine, and the data inside looks
correct (structure etc), except I only had 15000+ rows out of the expected
24000. Using 'readLines' instead, and breaking up the data by tabs, gives me
the expected result.
I do not understand why this is happening and I can't find anything obvious
in the data to explain the bahaviour...
Does anybody have an explanation? something to watch out for?

If I run this I get the incomplete set:



oldprobesets-read.table(All_norm_calls.txt,sep=\t,header=T,stringsAsFactors=F)
dim(oldprobesets)


[1] 1573311

but I get the right data if I use:


probesets-readLines(All_norm_calls.txt)
tmp-matrix(ncol=11,nrow=24000)
for (i in 1:24000) tmp[i,]-unlist(strsplit(probesets[i+1],split=\t))
colnames(tmp)-unlist(strsplit(probesets[1],split=\t))
probesets-data.frame(tmp,stringsAsFactors=F)
dim(probesets)


[1] 2400011


Here's my sessionInfo output:


sessionInfo()


R version 2.7.0 (2008-04-22)
i386-pc-mingw32

locale:
LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United
Kingdom.1252;LC_MONETARY=English_United
Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252

attached base packages:
[1] stats graphics  grDevices datasets  tcltk utils methods
[8] base

other attached packages:
[1] limma_2.14.0   svSocket_0.9-5 svIO_0.9-5 R2HTML_1.59svMisc_0.9-5
[6] svIDE_0.9-5

loaded via a namespace (and not attached):
[1] tools_2.7.0


Thanks!

Jose

--
Dr. Jose I. de las Heras  Email: [EMAIL PROTECTED]
The Wellcome Trust Centre for Cell BiologyPhone: +44 (0)131 6513374
Institute for Cell  Molecular BiologyFax:   +44 (0)131 6507360
Swann Building, Mayfield Road
University of Edinburgh
Edinburgh EH9 3JR
UK

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

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








--
Dr. Jose I. de las Heras  Email: [EMAIL PROTECTED]
The Wellcome Trust Centre for Cell BiologyPhone: +44 (0)131 6513374
Institute for Cell  Molecular BiologyFax:   +44 (0)131 6507360
Swann Building, Mayfield Road
University of Edinburgh
Edinburgh EH9 3JR
UK

--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

__
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] lattice: Color in Barchart legend

2008-09-24 Thread Patrick Hausmann

Dear list,

with the code below I produce the right graph, but the colours of the  
legend are different from the colours of the graph. The colours of the  
graph are the desired colours.


Thanks for any help.
Patrick

library(lattice)

pal1 - rgb(196, 255, 255, max = 255)
pal2 - rgb(  0,  35, 196, max = 255)

df - data.frame( Gruppe = c(A, B, A, B),
Kat = c(x1, x1, w1, w1),
value= c(1,2, 4, 5))

barchart(value ~ Kat, group= Gruppe,
 panel = function(y,x,...){
 panel.barchart(x,y, ..., col=c(pal1, pal2))
 }, data = df,
 auto.key = list(points = FALSE, rectangles = TRUE,
columns = 2, space = bottom)
)

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


Re: [R] How to convert backslash to slash?

2008-09-24 Thread Duncan Murdoch

Shengqiao Li wrote:

On Tue, 23 Sep 2008, Duncan Murdoch wrote:

  

On 23/09/2008 4:00 PM, Shengqiao Li wrote:


How to use sub, gsub, etc. to replace \ in a string to /?

For example,convert C:\foo\bar to C:/foo/bar.
  
If those are R strings, there are no backslashes in the first one.  It has a 
formfeed and a backspace in it.



I did notice that this string  was special. It's a legimate R string. If 
f and b are replaced by d, it will not. 


I didn't say it was not legitimate, I said that it contains no 
backslashes.  If you replace f or b with d, you do not have a legitimate 
string.
My purpose is to convert a 
Windows file path (eg. copied from Explorer location bar) to a R file path 
through some R function inside R terminal. The File-Change dir... takes 
a file path like C:\Acer, but setwd function will fail.  


That's not true.  If you enter a backslash in the string, setwd() works 
fine.


Your problem is that you are confusing R source code with the strings 
that it represents.  The R source code for the file path C:\Acer is 
C:\\Acer.  The
R source code C:\foo\bar contains no backslashes, it contains the 
characters C, :, formfeed, o, o,  backspace, a, r.


If you have the string C:\Acer in the Windows clipboard, then you can 
read it from there using readClipboard().  (There are many other ways to 
read the clipboard as well;
using 'clipboard' as a filename generally works.) You can then pass it 
to setwd(), and it will be fine.


Duncan Murdoch
I guess there 
must be some ways in R to replace a backslash by slash, eg. C:\Acer - 
C:/Acer. The first problem may be how to pass and save this kind of 
strings. encodeString does not work for this, it will just ignore \.
  
Shengqiao Li


  

Duncan Murdoch




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


Re: [R] lattice: Color in Barchart legend

2008-09-24 Thread baptiste auguie

Hi,

you can use par.settings to get a consistent color scheme,


pal1 - rgb(196, 255, 255, max = 255)
pal2 - rgb(  0,  35, 196, max = 255)

df - data.frame( Gruppe = c(A, B, A, B),
   Kat = c(x1, x1, w1, w1),
   value= c(1,2, 4, 5))

barchart(value ~ Kat, group= Gruppe,
par.settings = list(superpose.polygon = list(col=c(pal1, pal2)) ),
panel = function(y,x,...){
panel.barchart(x,y, ...)
}, data = df,
auto.key = list(points = FALSE, rectangles = TRUE,
   columns = 2, space = bottom)
)

HTH,

baptiste



On 24 Sep 2008, at 11:37, Patrick Hausmann wrote:


Dear list,

with the code below I produce the right graph, but the colours of  
the legend are different from the colours of the graph. The colours  
of the graph are the desired colours.


Thanks for any help.
Patrick

library(lattice)

pal1 - rgb(196, 255, 255, max = 255)
pal2 - rgb(  0,  35, 196, max = 255)

df - data.frame( Gruppe = c(A, B, A, B),
   Kat = c(x1, x1, w1, w1),
   value= c(1,2, 4, 5))

barchart(value ~ Kat, group= Gruppe,
panel = function(y,x,...){
panel.barchart(x,y, ..., col=c(pal1, pal2))
}, data = df,
auto.key = list(points = FALSE, rectangles = TRUE,
   columns = 2, space = bottom)
)

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


_

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag

__
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] hexbin object to vector (shapefile)

2008-09-24 Thread Paulo Cardoso
Is it possible to convert an hexbin object like
hexbin(rep(1:100,each=100),rep(1:100,100),xbins=10)
and convert it to a vectorial (shp) format?
Paulo


-
This electronic mail transmission including any attachment hereof, contains
information that is private and confidential, and it is only for the use of
the person and at the e-mail address above indicated. If you have received
this electronic mail transmission in error, please destroy it and notify me
immediately through e-mail address: [EMAIL PROTECTED]

__
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] Changing a plot

2008-09-24 Thread R Help
Hello list,

I've been working on this problem for a while and I haven't been able
to come up with a solution.

I have a couple of functions that plot a bunch of data, then a single
point on top of it.  What I want is to be able to change the plot of
the point without replotting all the data.  Consider the following
example:

x = rnorm(100,1,0.5)
y = rnorm(100,1,0.5)
plot(x,y,pch=16)
points(x[35],y[35],pch=19,col=6,cex=3)

What I want to be able to do is to change the purple point to a
different value without replotting everything.

I know this seems like an odd suggestion, but it comes up a lot with
the work I'm doing.  I've prepared a package on CRAN called
ResearchMethods for a course I'm working on, and there are several
functions in there who's GUIs could work better if I could figure this
out.

If anyone has any ideas, or needs some further explanation, feel free
to contact me.

Thanks a lot,
Sam Stewart

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


Re: [R] Generating series of distributions with the same skewness and different kurtosis or with same kurtosis and different skewness?

2008-09-24 Thread Gabor Grothendieck
Check out JohnsonFit in SuppDists.

On Tue, Sep 23, 2008 at 10:59 AM, zhijie zhang [EMAIL PROTECTED] wrote:
 Dear R users,
  I hope to explain the concepts of skewness and kurtosis by generating
 series of distributions with same skewness and different kurtosis or  with
 same kurtosis and different skewness, but it seems that i cannot find the
 right functions.
  I have searched the mailing list, but no answers were found.
  Is it possible to do that in R? Which function could be used?
  Thanks a lot.

 --
 With Kind Regards,

 oooO:
 (..):
 :\.(:::Oooo::
 ::\_)::(..)::
 :::)./:::
 ::(_/
 :
 [***]
 Zhi Jie,Zhang ,PHD
 Tel:+86-21-54237149
 Dept. of Epidemiology,School of Public Health,Fudan University
 Address:No. 138 Yi Xue Yuan Road,Shanghai,China
 Postcode:200032
 Email:[EMAIL PROTECTED] [EMAIL PROTECTED]
 Website: www.statABC.com
 [***]
 oooO:
 (..):
 :\.(:::Oooo::
 ::\_)::(..)::
 :::)./:::
 ::(_/
 :

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


Re: [R] Bug in is ?

2008-09-24 Thread Martin Maechler
 KJ == Keith Jewell [EMAIL PROTECTED]
 on Wed, 24 Sep 2008 09:46:08 +0100 writes:

KJ 7 is an integer, but it's also a real.
KJ In R '?is'  and '?is.integer' are clear that you're testing the 
class(es) of 
KJ objects, not their values.
KJ I can't comment on the relationship with S Programming

I can:

In S, and S-plus upto version 3.4,
numeric constants such as '7' where  double as they are in R.

Then in S-plus 5.1, they became integer,
and there were tools so users could change all(!!) their S
scripts to use '7.' instead of '7' in all places where numeric
constants were seen, in order to keep behavior back compatible.

R never made such a step (backwards ;-), and never will,
notably since in R we had introduced the explicit long (= long
integer) constants, using the 'L' suffix,
i.e.,  7L is integer
7 is double

Note however that for both, is.numeric(.) is fulfilled and 
class(.) and mode(.) return numeric.
Only typeof(.), storage.mode(.)  or  str(.) 
(or functions building on these) tell you the difference.

Martin Maechler, ETH Zurich and R core team

[And, yes, if you think further and are wondering: 
 If we'd design things from scratch, we would only have S4
 classes and double would be a proper class and 
 numeric would be the class union of {integer, double}
]


KJ [EMAIL PROTECTED] wrote in message 
KJ news:[EMAIL PROTECTED]
 This is really bothering me! In the Dr. Venables and Dr. Ripley's book  
S 
 Programming Page 105
 shows that
 c(is(10,integer),is(10.5,integer))
 [1] T F
 
 But I try this in R 2.7.2 it shows
 c(is(10,integer),is(10.5,integer))
 [1] FALSE FALSE
 Does anyone know what is going on here?
 
 Appreciate,
 Chunhao
 
 Quoting Yihui Xie [EMAIL PROTECTED]:
 
 Yes, everyone will agree 7 is an integer, but I don't think
 computers will agree too :-) R thinks it's a double-precision number,
 except when you explicitly specify it as an integer (say,
 as.integer()).
 
 class(7)
 [1] numeric
 
 is.double(7)
 [1] TRUE
 
 Regards,
 Yihui
 --
 Yihui Xie [EMAIL PROTECTED]
 Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
 Mobile: +86-15810805877
 Homepage: http://www.yihui.name
 School of Statistics, Room 1037, Mingde Main Building,
 Renmin University of China, Beijing, 100872, China
 
 
 
 On Wed, Sep 24, 2008 at 12:40 PM,  [EMAIL PROTECTED] wrote:
 Hi R users
 Is there anything wrong in is function? (R 2.7.2)
 I believe that everyone will agree that 7 is an integer, right? but 
 why R
 shows 7 is not an integer
 
 is.integer(7)
 
 [1] FALSE
 
 is(7,integer)
 
 [1] FALSE
 
 is(as.integer(7), integer)
 
 [1] TRUE
 
 Thank you very much in advance
 Chunhao

KJ __
KJ R-help@r-project.org mailing list
KJ https://stat.ethz.ch/mailman/listinfo/r-help
KJ PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
KJ 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.


Re: [R] How to convert backslash to slash?

2008-09-24 Thread Shengqiao Li


On Wed, 24 Sep 2008, Duncan Murdoch wrote:


Shengqiao Li wrote:

On Tue, 23 Sep 2008, Duncan Murdoch wrote:



On 23/09/2008 4:00 PM, Shengqiao Li wrote:


How to use sub, gsub, etc. to replace \ in a string to /?

For example,convert C:\foo\bar to C:/foo/bar.

If those are R strings, there are no backslashes in the first one.  It has 
a formfeed and a backspace in it.




I did notice that this string  was special. It's a legimate R string. If 
f and b are replaced by d, it will not. 


I didn't say it was not legitimate, I said that it contains no backslashes. 
If you replace f or b with d, you do not have a legitimate string.
My purpose is to convert a Windows file path (eg. copied from Explorer 
location bar) to a R file path through some R function inside R terminal. 
The File-Change dir... takes a file path like C:\Acer, but setwd 
function will fail. 


That's not true.  If you enter a backslash in the string, setwd() works fine.

Your problem is that you are confusing R source code with the strings that it 
represents.  The R source code for the file path C:\Acer is C:\\Acer.  The
R source code C:\foo\bar contains no backslashes, it contains the 
characters C, :, formfeed, o, o,  backspace, a, r.


If you have the string C:\Acer in the Windows clipboard, then you can read it 
from there using readClipboard().  (There are many other ways to read the 
clipboard as well;
using 'clipboard' as a filename generally works.) You can then pass it to 
setwd(), and it will be fine.


Thank you for your reply. readClipboard is a partial solution to this 
case. More generally, if I want to wrtie a R program in which users are 
asked to input a file path. I want this program to be robust and tolerant, 
that is users can type in C:\Acer or C:/Acer.  What's the way to do this?


Shengqiao Li



Duncan Murdoch
I guess there must be some ways in R to replace a backslash by slash, eg. 
C:\Acer - C:/Acer. The first problem may be how to pass and save this kind 
of strings. encodeString does not work for this, it will just ignore \.

  Shengqiao Li



Duncan Murdoch




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


Re: [R] How to draw the graph of f(x,y) = x * y ?

2008-09-24 Thread Paul Smith
On Wed, Sep 24, 2008 at 4:05 AM, Ben Bolker [EMAIL PROTECTED] wrote:
 The function curve() draws the graph of functions from R to R. Is
 there some homologous function to curve() to draw functions from R^2
 to R?

  There is a curve3d function in the emdbook package on CRAN.

Thanks, Ben and Robin. I think curve3d should be included in the base
of R. It would help many users, I believe.

I do not know whether curve3d could be extended to draw constant
functions and functions like f(x,y) = x. With the current version, I
get the following:

 curve3d(1)
Error in curve3d(1) :
  'expr' must be a function or an expression containing 'x' and 'y'
 curve3d(x)
Error in eval(expr, envir, enclos) : could not find function x


Paul

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


Re: [R] How to convert backslash to slash?

2008-09-24 Thread jim holtman
It probably depends on how you are prompting the user for input.  Here
is what happens with 'readline' and you will see that the string after
input does have the backslashes escaped.

 x - readline(Input File: )
Input File: c:\dir1\dir2\file.name
 x
[1] c:\\dir1\\dir2\\file.name
 gsub(, /, x)  # notice the double escape
[1] c:/dir1/dir2/file.name



On Wed, Sep 24, 2008 at 8:53 AM, Shengqiao Li [EMAIL PROTECTED] wrote:

 On Wed, 24 Sep 2008, Duncan Murdoch wrote:

 Shengqiao Li wrote:

 On Tue, 23 Sep 2008, Duncan Murdoch wrote:


 On 23/09/2008 4:00 PM, Shengqiao Li wrote:

 How to use sub, gsub, etc. to replace \ in a string to /?

 For example,convert C:\foo\bar to C:/foo/bar.

 If those are R strings, there are no backslashes in the first one.  It
 has a formfeed and a backspace in it.


 I did notice that this string  was special. It's a legimate R string. If
 f and b are replaced by d, it will not.

 I didn't say it was not legitimate, I said that it contains no
 backslashes. If you replace f or b with d, you do not have a legitimate
 string.

 My purpose is to convert a Windows file path (eg. copied from Explorer
 location bar) to a R file path through some R function inside R terminal.
 The File-Change dir... takes a file path like C:\Acer, but setwd
 function will fail.

 That's not true.  If you enter a backslash in the string, setwd() works
 fine.

 Your problem is that you are confusing R source code with the strings that
 it represents.  The R source code for the file path C:\Acer is C:\\Acer.
  The
 R source code C:\foo\bar contains no backslashes, it contains the
 characters C, :, formfeed, o, o,  backspace, a, r.

 If you have the string C:\Acer in the Windows clipboard, then you can read
 it from there using readClipboard().  (There are many other ways to read the
 clipboard as well;
 using 'clipboard' as a filename generally works.) You can then pass it to
 setwd(), and it will be fine.

 Thank you for your reply. readClipboard is a partial solution to this case.
 More generally, if I want to wrtie a R program in which users are asked to
 input a file path. I want this program to be robust and tolerant, that is
 users can type in C:\Acer or C:/Acer.  What's the way to do this?

 Shengqiao Li


 Duncan Murdoch

 I guess there must be some ways in R to replace a backslash by slash, eg.
 C:\Acer - C:/Acer. The first problem may be how to pass and save this kind
 of strings. encodeString does not work for this, it will just ignore \.
  Shengqiao Li


 Duncan Murdoch



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




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

What is the problem that you are trying to solve?

__
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] rgl: ellipse3d with axes

2008-09-24 Thread Michael Friendly
Last week I asked about data ellipses with rgl:::ellipse3d() with lines 
showing the principal axes.
(The goal is a visual demonstration of PCA as a rotation of variable 
space to component space.)
I was trying, unsuccessfully, to use princomp() to generate the PCA axes 
and plot them using

segments3d:


 PC - princomp(trees)
 sdev - PC$sdev # component standard deviations
 sd - sqrt(diag(cov))   # variable standard deviations

 # vectors in variable space of principal components
 vec - matrix(mu,3,3, byrow=TRUE) + diag(sd) %*% PC$loadings

 for (j in 1:3) {
  mat - rbind(mu, vec[j,])
  segments3d(mat, col=red)
 }
However, it occurred to me that these axes are just the orthogonal axes 
of the unit sphere
that is transformed (using chol()) in ellipse3d, so plotting the axes 
transformed in the

same way would give me what I want.

Looking at the result returned by ellipse3d, I see a normals component, 
but I'm not sure if this
represents what I want, or, if it is, how to use it to draw the ellipse 
major axes in the plot.


 e1 -ellipse3d(cov, centre=mu, level=0.68)
 str(e1)
List of 6
$ vb   : num [1:4, 1:386] 4.95 2.64 2.03 1.00 6.74 ...
$ ib   : num [1:4, 1:384] 1 195 99 196 51 197 99 195 27 198 ...
$ primitivetype: chr quad
$ homogeneous  : logi TRUE
$ material : list()
$ normals  : num [1:4, 1:386]  0.290 -0.902 -0.320  1.000  0.635 ...
- attr(*, class)= chr qmesh3d

-Michael

--
Michael Friendly Email: friendly AT yorku DOT ca 
Professor, Psychology Dept.

York University  Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Streethttp://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT  M3J 1P3 CANADA

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


Re: [R] How to convert backslash to slash?

2008-09-24 Thread Duncan Murdoch

Shengqiao Li wrote:

On Wed, 24 Sep 2008, Duncan Murdoch wrote:

  

Shengqiao Li wrote:


On Tue, 23 Sep 2008, Duncan Murdoch wrote:


  

On 23/09/2008 4:00 PM, Shengqiao Li wrote:



How to use sub, gsub, etc. to replace \ in a string to /?

For example,convert C:\foo\bar to C:/foo/bar.

  
If those are R strings, there are no backslashes in the first one.  It has 
a formfeed and a backspace in it.



I did notice that this string  was special. It's a legimate R string. If 
f and b are replaced by d, it will not. 
  
I didn't say it was not legitimate, I said that it contains no backslashes. 
If you replace f or b with d, you do not have a legitimate string.

My purpose is to convert a Windows file path (eg. copied from Explorer 
location bar) to a R file path through some R function inside R terminal. 
The File-Change dir... takes a file path like C:\Acer, but setwd 
function will fail. 
  

That's not true.  If you enter a backslash in the string, setwd() works fine.

Your problem is that you are confusing R source code with the strings that it 
represents.  The R source code for the file path C:\Acer is C:\\Acer.  The
R source code C:\foo\bar contains no backslashes, it contains the 
characters C, :, formfeed, o, o,  backspace, a, r.


If you have the string C:\Acer in the Windows clipboard, then you can read it 
from there using readClipboard().  (There are many other ways to read the 
clipboard as well;
using 'clipboard' as a filename generally works.) You can then pass it to 
setwd(), and it will be fine.



Thank you for your reply. readClipboard is a partial solution to this 
case. More generally, if I want to wrtie a R program in which users are 
asked to input a file path. I want this program to be robust and tolerant, 
that is users can type in C:\Acer or C:/Acer.  What's the way to do this?


Just treat their input as data, not as source code.  Backslashes are not 
special in data.


Duncan Murdoch

__
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] Bug in persp?

2008-09-24 Thread Paul Smith
Dear All,

I am not sure whether the following can be considered a bug:

 x - seq(-1,1,length=20)
 y - x
 z - matrix(1,20,20)
 persp(x,y,z)
Error in persp.default(x, y, z) : invalid 'z' limits

It works with:

persp(x,y,z,zlim=c(0,1.5))

Should not persp set the z limits by default when the matrix to draw
is constant?

Paul

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


Re: [R] bandwidth selection for locpoly

2008-09-24 Thread Liaw, Andy
Don't think it's in kernSmooth, but locfit has such facility.  See
Loader's book for details.

Best,
Andy 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Chinthaka Kuruwita
 Sent: Tuesday, September 23, 2008 12:18 PM
 To: r-help@r-project.org
 Subject: [R] bandwidth selection for locpoly
 
 Hello All,
 
 Is there a local bandwidth selection routine for local polynomial
 regression (locpoly) ?
 
 Thanks
 
 Chinthaka Kuruwita
 
 __
 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.
 
Notice:  This e-mail message, together with any attachme...{{dropped:12}}

__
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] qplot, stacked area, own colourscheme

2008-09-24 Thread Albin Blaschka


Dear list,

I would like to apply my own colours to a stacked area plot, done with 
qplot, but I have not succeeded...


What do I have so far (I am dealing with the development of cover of 
specific groups of plants):



library(ggplot2) 

library(RODBC) 

channel - odbcConnect(myusername, case=tolower) 

sql - select trial, cover_of, dateofsurvey, cover from mytable 


mydata - (sqlQuery(channel, sql))

What I get is the following dataframe (simplified, there are more 
categories, not real data):


trial   cover_ofdateofsurveycover
1ZU-316 Cover dead material 2004-09-160
2ZU-316 Cover grasses   2004-09-16   16
3ZU-316 Cover herbs 2004-09-16   14
4ZU-316 Cover legumes   2004-09-16   10
5ZU-316 Cover open soil 2004-09-16   30
6ZU-316 Cover dead material 2005-09-185
7ZU-316 Cover grasses   2005-09-18   26
8ZU-316 Cover herbs 2005-09-18   14
9ZU-316 Cover legumes   2005-09-18   15
10   ZU-316 Cover open soil 2005-09-18   20
11   ZU-316 Cover dead material 2006-09-067
12   ZU-316 Cover grasses   2006-09-06   36
13   ZU-316 Cover herbs 2006-09-06   20
14   ZU-316 Cover legumes   2006-09-06   15
15   ZU-316 Cover open soil 2006-09-06   20
.
.
.

With the following command I get a nice graph (development of cover over 
the years):


qplot(dateofsurvey, cover, data=mydata, geom=area, fill=cover_of,
main = Development of cover, ZU-316,
ylab=projective Cover[%], xlab = Year)

As I have those categories (cover grasses, cover herbs...) I would like 
to assign special colours to each (for example cover grasses = dark 
green, cover open soil = brown ...), but I did not get it so far.
I tried several variations with area_geom, scale_manual but without 
success...

For example (which does not work, it just shows the standard colourscheme):

mycolorscheme - c(khaki, darkgreen,
   lightgreen, yellow, saddlebrown)
mycolors - rep(mycolorscheme,3)

myplot - qplot(dateofsurvey, wert, data=mydata, geom=area,
fill=cover_of, main = Development of cover, ZU-316,
ylab=projective Cover[%], xlab = Year)
myplot + geom_area(colour = mycolours)

What am I doing wrong?

Thank you in advance,
Albin


--
| Albin Blaschka, Mag.rer.nat.
| Etrichstrasse 26, A-5020 Salzburg
| * www.albinblaschka.info * www.thinkanimal.info *
| - It's hard to live in the mountains, hard but not hopeless!

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


Re: [R] How to convert backslash to slash?

2008-09-24 Thread Shengqiao Li


On Wed, 24 Sep 2008, jim holtman wrote:


It probably depends on how you are prompting the user for input.  Here
is what happens with 'readline' and you will see that the string after
input does have the backslashes escaped.


x - readline(Input File: )

Input File: c:\dir1\dir2\file.name

x

[1] c:\\dir1\\dir2\\file.name

gsub(, /, x)  # notice the double escape

[1] c:/dir1/dir2/file.name




Great! Thanks. By the way, it would be nice if R have a third way to quote 
a string and automatically escape the backslashes in memory. For instance:


#not run now
s- `C:\Acer'

print(s)
[1] C:\\Acer






On Wed, Sep 24, 2008 at 8:53 AM, Shengqiao Li [EMAIL PROTECTED] wrote:


On Wed, 24 Sep 2008, Duncan Murdoch wrote:


Shengqiao Li wrote:


On Tue, 23 Sep 2008, Duncan Murdoch wrote:



On 23/09/2008 4:00 PM, Shengqiao Li wrote:


How to use sub, gsub, etc. to replace \ in a string to /?

For example,convert C:\foo\bar to C:/foo/bar.


If those are R strings, there are no backslashes in the first one.  It
has a formfeed and a backspace in it.



I did notice that this string  was special. It's a legimate R string. If
f and b are replaced by d, it will not.


I didn't say it was not legitimate, I said that it contains no
backslashes. If you replace f or b with d, you do not have a legitimate
string.


My purpose is to convert a Windows file path (eg. copied from Explorer
location bar) to a R file path through some R function inside R terminal.
The File-Change dir... takes a file path like C:\Acer, but setwd
function will fail.


That's not true.  If you enter a backslash in the string, setwd() works
fine.

Your problem is that you are confusing R source code with the strings that
it represents.  The R source code for the file path C:\Acer is C:\\Acer.
 The
R source code C:\foo\bar contains no backslashes, it contains the
characters C, :, formfeed, o, o,  backspace, a, r.

If you have the string C:\Acer in the Windows clipboard, then you can read
it from there using readClipboard().  (There are many other ways to read the
clipboard as well;
using 'clipboard' as a filename generally works.) You can then pass it to
setwd(), and it will be fine.


Thank you for your reply. readClipboard is a partial solution to this case.
More generally, if I want to wrtie a R program in which users are asked to
input a file path. I want this program to be robust and tolerant, that is
users can type in C:\Acer or C:/Acer.  What's the way to do this?

Shengqiao Li



Duncan Murdoch


I guess there must be some ways in R to replace a backslash by slash, eg.
C:\Acer - C:/Acer. The first problem may be how to pass and save this kind
of strings. encodeString does not work for this, it will just ignore \.
 Shengqiao Li



Duncan Murdoch




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





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

What is the problem that you are trying to solve?



__
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] time calculation for simulation

2008-09-24 Thread Ralph Scherer
Hello list,

I want to compare time needed for a simulation between R and Ra (time 
optimized loops).
Does anybody know, how I can count time needed for a simulation in R?

Bests,
Ralph

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


Re: [R] qplot, stacked area, own colourscheme

2008-09-24 Thread hadley wickham
On Wed, Sep 24, 2008 at 8:39 AM, Albin Blaschka
[EMAIL PROTECTED] wrote:

 Dear list,

 I would like to apply my own colours to a stacked area plot, done with
 qplot, but I have not succeeded...

 What do I have so far (I am dealing with the development of cover of
 specific groups of plants):


 library(ggplot2)
 library(RODBC)
 channel - odbcConnect(myusername, case=tolower)
 sql - select trial, cover_of, dateofsurvey, cover from mytable
 mydata - (sqlQuery(channel, sql))

 What I get is the following dataframe (simplified, there are more
 categories, not real data):

trial   cover_ofdateofsurveycover
 1ZU-316 Cover dead material 2004-09-160
 2ZU-316 Cover grasses   2004-09-16   16
 3ZU-316 Cover herbs 2004-09-16   14
 4ZU-316 Cover legumes   2004-09-16   10
 5ZU-316 Cover open soil 2004-09-16   30
 6ZU-316 Cover dead material 2005-09-185
 7ZU-316 Cover grasses   2005-09-18   26
 8ZU-316 Cover herbs 2005-09-18   14
 9ZU-316 Cover legumes   2005-09-18   15
 10   ZU-316 Cover open soil 2005-09-18   20
 11   ZU-316 Cover dead material 2006-09-067
 12   ZU-316 Cover grasses   2006-09-06   36
 13   ZU-316 Cover herbs 2006-09-06   20
 14   ZU-316 Cover legumes   2006-09-06   15
 15   ZU-316 Cover open soil 2006-09-06   20
 .
 .
 .

 With the following command I get a nice graph (development of cover over the
 years):

 qplot(dateofsurvey, cover, data=mydata, geom=area, fill=cover_of,
main = Development of cover, ZU-316,
ylab=projective Cover[%], xlab = Year)

 As I have those categories (cover grasses, cover herbs...) I would like to
 assign special colours to each (for example cover grasses = dark green,
 cover open soil = brown ...), but I did not get it so far.
 I tried several variations with area_geom, scale_manual but without
 success...
 For example (which does not work, it just shows the standard colourscheme):

 mycolorscheme - c(khaki, darkgreen,
   lightgreen, yellow, saddlebrown)
 mycolors - rep(mycolorscheme,3)

 myplot - qplot(dateofsurvey, wert, data=mydata, geom=area,
fill=cover_of, main = Development of cover, ZU-316,
ylab=projective Cover[%], xlab = Year)
 myplot + geom_area(colour = mycolours)

You want to modify the scale (the thing that converts data values to
colours), not the geom:

+ scale_fill_manual(values = mycolorscheme)

(And it's fill you want to change, not colour)

This will also update the legend.

Hadley


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

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


Re: [R] time calculation for simulation

2008-09-24 Thread jim holtman
?system.time

On Wed, Sep 24, 2008 at 9:46 AM, Ralph Scherer
[EMAIL PROTECTED] wrote:
 Hello list,

 I want to compare time needed for a simulation between R and Ra (time
 optimized loops).
 Does anybody know, how I can count time needed for a simulation in R?

 Bests,
 Ralph

 __
 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?

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


Re: [R] climatological standard deviation

2008-09-24 Thread milton ruser
Dear Yogesh,

Send us a minimal reproducive code, with a sample of your data structure.
It will help us to help you :-)

Best wishes,

miltinho astronauta
brazil

On Wed, Sep 24, 2008 at 2:00 AM, Yogesh Tiwari [EMAIL PROTECTED]wrote:

 Hello R users,

 I have a montly time series over a several year period.
 It's easy to compute a monthly climatology (12 values), Now, I would like
 to
 calculate the corresponding standard deviation, ie the 12 values
 calculated from the january values, february values, etc.
 What's the best way for such a calculation ?
 Regards,
 Yogesh

 --
 Yogesh K. Tiwari (Dr.rer.nat),
 Scientist,
 Indian Institute of Tropical Meteorology,
 Homi Bhabha Road,
 Pashan,
 Pune-411008
 INDIA

 Phone: 0091-99 2273 9513 (Cell)
 : 0091-20-258 93 600 (O) (Ext.250)
 Fax : 0091-20-258 93 825

[[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.htmlhttp://www.r-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


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


Re: [R] rgl: ellipse3d with axes

2008-09-24 Thread Duncan Murdoch

Michael Friendly wrote:
Last week I asked about data ellipses with rgl:::ellipse3d() with lines 
showing the principal axes.
(The goal is a visual demonstration of PCA as a rotation of variable 
space to component space.)
I was trying, unsuccessfully, to use princomp() to generate the PCA axes 
and plot them using

segments3d:

  

PC - princomp(trees)
sdev - PC$sdev # component standard deviations
sd - sqrt(diag(cov))   # variable standard deviations

# vectors in variable space of principal components
vec - matrix(mu,3,3, byrow=TRUE) + diag(sd) %*% PC$loadings

for (j in 1:3) {
 mat - rbind(mu, vec[j,])
 segments3d(mat, col=red)
}
  
However, it occurred to me that these axes are just the orthogonal axes 
of the unit sphere
that is transformed (using chol()) in ellipse3d, so plotting the axes 
transformed in the

same way would give me what I want.

Looking at the result returned by ellipse3d, I see a normals component, 
but I'm not sure if this
represents what I want, or, if it is, how to use it to draw the ellipse 
major axes in the plot.


  e1 -ellipse3d(cov, centre=mu, level=0.68)
  str(e1)
List of 6
 $ vb   : num [1:4, 1:386] 4.95 2.64 2.03 1.00 6.74 ...
 $ ib   : num [1:4, 1:384] 1 195 99 196 51 197 99 195 27 198 ...
 $ primitivetype: chr quad
 $ homogeneous  : logi TRUE
 $ material : list()
 $ normals  : num [1:4, 1:386]  0.290 -0.902 -0.320  1.000  0.635 ...
 - attr(*, class)= chr qmesh3d
  


The normals component contains the surface normals.  It is used to help 
in rendering the surface, but isn't much use for your purposes. 

Unfortunately, I'm not familiar enough with the internals of princomp to 
tell you how to get the axes you want.


Duncan Murdoch

-Michael




__
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] rowSums()

2008-09-24 Thread Doran, Harold
Say I have the following data:

testDat - data.frame(A = c(1,NA,3), B = c(NA, NA, 3))

 testDat
   A  B
1  1 NA
2 NA NA
3  3  3

rowsums() with na.rm=TRUE generates the following, which is not desired:

 rowSums(testDat[, c('A', 'B')], na.rm=T)
[1] 1 0 6

rowsums() with na.rm=F generates the following, which is also not
desired:


 rowSums(testDat[, c('A', 'B')], na.rm=F)
[1] NA NA  6

I see why this occurs, but what I hope to have returned would be:
[1] 1 NA  6

To get what I want I could do the following, but normally my ideas are
bad ideas and there are codified and proper ways to do things. 

rr - numeric(nrow(testDat))
for(i in 1:nrow(testDat)) rr[i] - if(all(is.na(testDat[i,]))) NA else
sum(testDat[i,], na.rm=T)

 rr
[1]  1 NA  6

Is there a proper way to do this? In my real data, nrow is over
100,000

Thanks,
Harold

 sessionInfo()
R version 2.7.2 (2008-08-25) 
i386-pc-mingw32 

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base


other attached packages:
[1] MiscPsycho_1.2  lattice_0.17-13 statmod_1.3.6  

loaded via a namespace (and not attached):
[1] grid_2.7.2

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


Re: [R] How to convert backslash to slash?

2008-09-24 Thread jim holtman
Your users will have to learn that if they are inputting quoted
strings into R, then, by convention, a backslash is used to 'escape'
certain character sequences and if you want a backslash, you have to
escape it ('\\').  You can also have your users upgrade to a system
that does not use backslashes in its file names, or learn that you can
alway use a virgule (/) in the file names.

On Wed, Sep 24, 2008 at 9:59 AM, Shengqiao Li [EMAIL PROTECTED] wrote:

 On Wed, 24 Sep 2008, jim holtman wrote:

 It probably depends on how you are prompting the user for input.  Here
 is what happens with 'readline' and you will see that the string after
 input does have the backslashes escaped.

 x - readline(Input File: )

 Input File: c:\dir1\dir2\file.name

 x

 [1] c:\\dir1\\dir2\\file.name

 gsub(, /, x)  # notice the double escape

 [1] c:/dir1/dir2/file.name


 Great! Thanks. By the way, it would be nice if R have a third way to quote a
 string and automatically escape the backslashes in memory. For instance:

 #not run now
 s- `C:\Acer'

 print(s)
 [1] C:\\Acer





 On Wed, Sep 24, 2008 at 8:53 AM, Shengqiao Li [EMAIL PROTECTED] wrote:

 On Wed, 24 Sep 2008, Duncan Murdoch wrote:

 Shengqiao Li wrote:

 On Tue, 23 Sep 2008, Duncan Murdoch wrote:


 On 23/09/2008 4:00 PM, Shengqiao Li wrote:

 How to use sub, gsub, etc. to replace \ in a string to /?

 For example,convert C:\foo\bar to C:/foo/bar.

 If those are R strings, there are no backslashes in the first one.  It
 has a formfeed and a backspace in it.


 I did notice that this string  was special. It's a legimate R string.
 If
 f and b are replaced by d, it will not.

 I didn't say it was not legitimate, I said that it contains no
 backslashes. If you replace f or b with d, you do not have a legitimate
 string.

 My purpose is to convert a Windows file path (eg. copied from Explorer
 location bar) to a R file path through some R function inside R
 terminal.
 The File-Change dir... takes a file path like C:\Acer, but setwd
 function will fail.

 That's not true.  If you enter a backslash in the string, setwd() works
 fine.

 Your problem is that you are confusing R source code with the strings
 that
 it represents.  The R source code for the file path C:\Acer is
 C:\\Acer.
  The
 R source code C:\foo\bar contains no backslashes, it contains the
 characters C, :, formfeed, o, o,  backspace, a, r.

 If you have the string C:\Acer in the Windows clipboard, then you can
 read
 it from there using readClipboard().  (There are many other ways to read
 the
 clipboard as well;
 using 'clipboard' as a filename generally works.) You can then pass it
 to
 setwd(), and it will be fine.

 Thank you for your reply. readClipboard is a partial solution to this
 case.
 More generally, if I want to wrtie a R program in which users are asked
 to
 input a file path. I want this program to be robust and tolerant, that is
 users can type in C:\Acer or C:/Acer.  What's the way to do this?

 Shengqiao Li


 Duncan Murdoch

 I guess there must be some ways in R to replace a backslash by slash,
 eg.
 C:\Acer - C:/Acer. The first problem may be how to pass and save this
 kind
 of strings. encodeString does not work for this, it will just ignore
 \.
  Shengqiao Li


 Duncan Murdoch



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




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

 What is the problem that you are trying to solve?





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

What is the problem that you are trying to solve?

__
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] Error results from MS Access via RODBC

2008-09-24 Thread stefan . petersson

I have an MS Access database with one table and one column holding rep(1:10)

I use:

library(RODBC)
channel - odbcConnect(test)
sqlQuery(channel, paste(SELECT col FROM tblTest), believeNRows=FALSE)

and get: 
 49
 50
 51
 52
 53
 54
 55
 56
 57
 12337

What? The above should, of course, read:
 1
 2
 3
 4
 5
 6
 7
 8
 9
 10

I tried the 'odbcQuery' / 'sqlGetResults' dance. But no love... From a console, 
'mdb-sql' and 'isql' gives correct output, so the odbc seems to be working OK. 
Text columns show up fine when I select them with the above RODBC procedure. 
I've fiddled with pretty much all the options that go with 'sqlQuery' with the 
same output every time.

I've compacted and repaired the database. I've created other mdb's, with the 
same result. When I connect to other DB's via RODBC, like MySQL, data is 
correct...

What am I missing?

Some output:

--
~# dpkg -l libmdb* mdbtools

ii libmdbodbc 0.5.99.0.6pre1.0.20 MDB tools ODBC module
ii libmdbtools 0.5.99.0.6pre1.0.20 mdbtools libraries
ii mdbtools 0.5.99.0.6pre1.0.20 JET / MS Access database (MDB) tools
--
~# mdb-ver db.mdb

 JET4
--
R odbcGetInfo(channel)

 DBMS_Name 
 DBMS_Ver 
 Driver_ODBC_Ver 
 Data_Source_Name test
 Driver_Name test
 Driver_Ver test
 ODBC_Ver 03.52
 Server_Name 03.52
--
R version

platform: i486-pc-linux-gnu
arch: i486
os: linux-gnu
system: i486, linux-gnu
status
major: 2
minor: 7.2
year: 2008
month: 08
day: 25
svn rev: 46428
language: R
version.string R version 2.7.2 (2008-08-25)
--
R sessionInfo()

R version 2.7.2 (2008-08-25) 
i486-pc-linux-gnu 

locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base 

other attached packages:
[1] RODBC_1.2-3

__
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] lower / upper case letters in a plot

2008-09-24 Thread Jörg Groß

Hi,

How can I generate lower case letters for my axis-titles?



Thanks,
Jörg
__
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.


Re: [R] cannot allocate memory

2008-09-24 Thread DumpsterBear
 I am getting Error: cannot allocate vector of size 197 MB.
 I know that similar problems were discussed a lot already, but I
 didn't find any satisfactory answers so far!

 Details:
 *** I have XP (32bit) with 4GB ram. At the time when the problem
 appeared I had 1.5GB of available physical memory.
 *** I increased R memory limit to 3GB via memory.limit(3000)


 Have you told Windows to allow processes of more than 2GB?

Yes, I did. But this only matters if R requests a memory block of size
bigger than 2GB
at one time. As I wrote, I had 1.5GB available of physical memory out of my 4GB.

 gc(), I think.

Yes, indeed.

Many thanks, Adam

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


Re: [R] Changing a plot

2008-09-24 Thread Ben Bolker
R Help rhelp.stats at gmail.com writes:

 
 Hello list,
 
 I've been working on this problem for a while and I haven't been able
 to come up with a solution.
 
 I have a couple of functions that plot a bunch of data, then a single
 point on top of it.  What I want is to be able to change the plot of
 the point without replotting all the data.  Consider the following
 example:
 
 x = rnorm(100,1,0.5)
 y = rnorm(100,1,0.5)
 plot(x,y,pch=16)
 points(x[35],y[35],pch=19,col=6,cex=3)
 
 What I want to be able to do is to change the purple point to a
 different value without replotting everything.
 

  R's default (base) graphics model is a 'canvas' -- things get
drawn, but nothing ever gets erased. (The cheap solution is
to overplot in the background color, but that 
won't work if there's stuff underneath the point
that you want to preserve.) You probably need to move
to the grid graphics package (hint: buy or borrow Paul Murrell's
book) to do something like this.

  Ben Bolker

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


Re: [R] rgl: ellipse3d with axes

2008-09-24 Thread Michael Friendly

Duncan Murdoch wrote:


The normals component contains the surface normals.  It is used to 
help in rendering the surface, but isn't much use for your purposes.
Unfortunately, I'm not familiar enough with the internals of princomp 
to tell you how to get the axes you want.


Duncan Murdoch


OK, then let me repharase it. The axes of the unit  sphere are like

axes - matrix(
   c(0, 0, -1,   0, 0, 1,
  0, -1, 0,   0, 1,  0,
  -1, 0, 0,   1, 0, 0),  6, 3, byrow=TRUE)
taken in pairs.  I'd like to transform these coordinates the same was as 
in ellipse3d() and add them to the plot.


--
Michael Friendly Email: friendly AT yorku DOT ca 
Professor, Psychology Dept.

York University  Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Streethttp://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT  M3J 1P3 CANADA

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


Re: [R] qplot, stacked area, own colourscheme

2008-09-24 Thread Albin Blaschka

hadley wickham schrieb:

On Wed, Sep 24, 2008 at 8:39 AM, Albin Blaschka
[EMAIL PROTECTED] wrote:

[snip]


As I have those categories (cover grasses, cover herbs...) I would like to
assign special colours to each (for example cover grasses = dark green,
cover open soil = brown ...), but I did not get it so far.
I tried several variations with area_geom, scale_manual but without
success...



You want to modify the scale (the thing that converts data values to
colours), not the geom:
+ scale_fill_manual(values = mycolorscheme)
(And it's fill you want to change, not colour)
This will also update the legend.

Hadley



Thank you very much, it works now - the right keywords were the problem: 
it seems I went wrong because for me scale had only a meaning in a 
spatial context (mother tongue is german), for example scale on a map or 
scale (range) of an axis...and I was fixed to changeing colours, but 
fill is now logical...


best wishes,
Albin


--
| Albin Blaschka, Mag.rer.nat.
| Etrichstrasse 26, A-5020 Salzburg
| * www.albinblaschka.info * www.thinkanimal.info *
| - It's hard to live in the mountains, hard but not hopeless!

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


Re: [R] lower / upper case letters in a plot

2008-09-24 Thread Dimitris Rizopoulos

check:

?tolower()


Best,
Dimitris


Jörg Groß wrote:

Hi,

How can I generate lower case letters for my axis-titles?



Thanks,
Jörg
__
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.



--
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014

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


Re: [R] rowSums()

2008-09-24 Thread Adaikalavan Ramasamy

I guess this would be the fastest way would be:

 rs - rowSums( testDat, na.rm=T)
 rs[ which( rowMeans(is.na(testDat)) == 1 ) ] - NA

since both rowSums and rowMeans are internally coded in C.

Regards, Adai



Doran, Harold wrote:

Say I have the following data:

testDat - data.frame(A = c(1,NA,3), B = c(NA, NA, 3))


testDat

   A  B
1  1 NA
2 NA NA
3  3  3

rowsums() with na.rm=TRUE generates the following, which is not desired:


rowSums(testDat[, c('A', 'B')], na.rm=T)

[1] 1 0 6

rowsums() with na.rm=F generates the following, which is also not
desired:



rowSums(testDat[, c('A', 'B')], na.rm=F)

[1] NA NA  6

I see why this occurs, but what I hope to have returned would be:
[1] 1 NA  6

To get what I want I could do the following, but normally my ideas are
bad ideas and there are codified and proper ways to do things. 


rr - numeric(nrow(testDat))
for(i in 1:nrow(testDat)) rr[i] - if(all(is.na(testDat[i,]))) NA else
sum(testDat[i,], na.rm=T)


rr

[1]  1 NA  6

Is there a proper way to do this? In my real data, nrow is over
100,000

Thanks,
Harold


sessionInfo()
R version 2.7.2 (2008-08-25) 
i386-pc-mingw32 


locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base


other attached packages:
[1] MiscPsycho_1.2  lattice_0.17-13 statmod_1.3.6  


loaded via a namespace (and not attached):
[1] grid_2.7.2

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


Re: [R] Changing a plot

2008-09-24 Thread Adaikalavan Ramasamy
One way is to keep a copy of the original and then return to it when you 
need it.


 x - rnorm(100,1,0.5)
 y - rnorm(100,1,0.5)
 plot(x,y,pch=16)
 original - recordPlot()

 for( i in 1:10 ){
   points( x[i], y[i], pch=19, col=yellow, cex=3)
   points( x[i], y[i], pch=16)
   Sys.sleep(1)  # slow the graphs a bit
   replayPlot(original)
 }

Regards, Adai



R Help wrote:

Hello list,

I've been working on this problem for a while and I haven't been able
to come up with a solution.

I have a couple of functions that plot a bunch of data, then a single
point on top of it.  What I want is to be able to change the plot of
the point without replotting all the data.  Consider the following
example:

x = rnorm(100,1,0.5)
y = rnorm(100,1,0.5)
plot(x,y,pch=16)
points(x[35],y[35],pch=19,col=6,cex=3)

What I want to be able to do is to change the purple point to a
different value without replotting everything.

I know this seems like an odd suggestion, but it comes up a lot with
the work I'm doing.  I've prepared a package on CRAN called
ResearchMethods for a course I'm working on, and there are several
functions in there who's GUIs could work better if I could figure this
out.

If anyone has any ideas, or needs some further explanation, feel free
to contact me.

Thanks a lot,
Sam Stewart

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


Re: [R] rowSums()

2008-09-24 Thread Chuck Cleland
On 9/24/2008 10:06 AM, Doran, Harold wrote:
 Say I have the following data:
 
 testDat - data.frame(A = c(1,NA,3), B = c(NA, NA, 3))
 
 testDat
A  B
 1  1 NA
 2 NA NA
 3  3  3
 
 rowsums() with na.rm=TRUE generates the following, which is not desired:
 
 rowSums(testDat[, c('A', 'B')], na.rm=T)
 [1] 1 0 6
 
 rowsums() with na.rm=F generates the following, which is also not
 desired:
 
 
 rowSums(testDat[, c('A', 'B')], na.rm=F)
 [1] NA NA  6
 
 I see why this occurs, but what I hope to have returned would be:
 [1] 1 NA  6
 
 To get what I want I could do the following, but normally my ideas are
 bad ideas and there are codified and proper ways to do things. 
 
 rr - numeric(nrow(testDat))
 for(i in 1:nrow(testDat)) rr[i] - if(all(is.na(testDat[i,]))) NA else
 sum(testDat[i,], na.rm=T)
 
 rr
 [1]  1 NA  6
 
 Is there a proper way to do this? In my real data, nrow is over
 100,000

  I don't know if it is proper, but here is a slightly different way
that I find easier to read:

apply(testDat, 1, function(x){
ifelse(all(is.na(x)), NA, sum(x, na.rm=TRUE))
})

[1]  1 NA  6

hope this helps,

Chuck

 Thanks,
 Harold
 
 sessionInfo()
 R version 2.7.2 (2008-08-25) 
 i386-pc-mingw32 
 
 locale:
 LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
 States.1252;LC_MONETARY=English_United
 States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
 
 attached base packages:
 [1] stats graphics  grDevices utils datasets  methods   base
 
 
 other attached packages:
 [1] MiscPsycho_1.2  lattice_0.17-13 statmod_1.3.6  
 
 loaded via a namespace (and not attached):
 [1] grid_2.7.2
 
 __
 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. 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc. (www.ndri.org)
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

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


Re: [R] lower / upper case letters in a plot

2008-09-24 Thread Jörg Groß

Oh, ok ...

perhaps it was the wrong description;

I want lowered cases...
In LaTeX I get them with x_1 for example.
Or x^2 for upper cases.

But how can I make this in R?


Am 24.09.2008 um 16:17 schrieb Dimitris Rizopoulos:


check:

?tolower()


Best,
Dimitris


Jörg Groß wrote:

Hi,
How can I generate lower case letters for my axis-titles?
Thanks,
Jörg
__
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.


--
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014


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


Re: [R] How to convert backslash to slash?

2008-09-24 Thread Gabor Grothendieck
On Wed, Sep 24, 2008 at 9:59 AM, Shengqiao Li [EMAIL PROTECTED] wrote:

 On Wed, 24 Sep 2008, jim holtman wrote:

 It probably depends on how you are prompting the user for input.  Here
 is what happens with 'readline' and you will see that the string after
 input does have the backslashes escaped.

 x - readline(Input File: )

 Input File: c:\dir1\dir2\file.name

 x

 [1] c:\\dir1\\dir2\\file.name

 gsub(, /, x)  # notice the double escape

 [1] c:/dir1/dir2/file.name


 Great! Thanks. By the way, it would be nice if R have a third way to quote a
 string and automatically escape the backslashes in memory. For instance:

 #not run now
 s- `C:\Acer'

 print(s)
 [1] C:\\Acer


I agree that that some sort of facility would be convenient.  Creating
latex output is
another situation where not having to escape backslashes would be convenient.
Other languages do have special purpose constructs for this.

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


Re: [R] lower / upper case letters in a plot

2008-09-24 Thread Dimitris Rizopoulos

so you mean subscripts and superscripts, then check:

?plotmath


Best,
Dimitris


Jörg Groß wrote:

Oh, ok ...

perhaps it was the wrong description;

I want lowered cases...
In LaTeX I get them with x_1 for example.
Or x^2 for upper cases.

But how can I make this in R?


Am 24.09.2008 um 16:17 schrieb Dimitris Rizopoulos:


check:

?tolower()


Best,
Dimitris


Jörg Groß wrote:

Hi,
How can I generate lower case letters for my axis-titles?
Thanks,
Jörg
__
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.


--
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014


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



--
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014

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


Re: [R] rowSums()

2008-09-24 Thread Dimitris Rizopoulos

try the following:

testDat - data.frame(A = c(1,NA,3), B = c(NA, NA, 3))

ind - rowSums(is.na(testDat)) == length(testDat)
out - rowSums(testDat, na.rm = TRUE)
out[ind] - NA
out


I hope it helps.

Best,
Dimitris

Doran, Harold wrote:

Say I have the following data:

testDat - data.frame(A = c(1,NA,3), B = c(NA, NA, 3))


testDat

   A  B
1  1 NA
2 NA NA
3  3  3

rowsums() with na.rm=TRUE generates the following, which is not desired:


rowSums(testDat[, c('A', 'B')], na.rm=T)

[1] 1 0 6

rowsums() with na.rm=F generates the following, which is also not
desired:



rowSums(testDat[, c('A', 'B')], na.rm=F)

[1] NA NA  6

I see why this occurs, but what I hope to have returned would be:
[1] 1 NA  6

To get what I want I could do the following, but normally my ideas are
bad ideas and there are codified and proper ways to do things. 


rr - numeric(nrow(testDat))
for(i in 1:nrow(testDat)) rr[i] - if(all(is.na(testDat[i,]))) NA else
sum(testDat[i,], na.rm=T)


rr

[1]  1 NA  6

Is there a proper way to do this? In my real data, nrow is over
100,000

Thanks,
Harold


sessionInfo()
R version 2.7.2 (2008-08-25) 
i386-pc-mingw32 


locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base


other attached packages:
[1] MiscPsycho_1.2  lattice_0.17-13 statmod_1.3.6  


loaded via a namespace (and not attached):
[1] grid_2.7.2

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



--
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014

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


Re: [R] lower / upper case letters in a plot

2008-09-24 Thread Adaikalavan Ramasamy

An example would help.

You generally control the titles using arguments like main, xlab, ylab, 
sub in the plotting functions or afterwards using title() function. You 
can get the upper/lower case using toupper()/tolower() functions. See 
help(par), help(title), help(tolower). Here is an example:



string - My x-axis corresponding to something
plot( rnorm(10), xlab=toupper(string) )

Regards, Adai



Jörg Groß wrote:

Hi,

How can I generate lower case letters for my axis-titles?



Thanks,
Jörg
__
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.


Re: [R] rowSums()

2008-09-24 Thread Marc Schwartz
on 09/24/2008 09:06 AM Doran, Harold wrote:
 Say I have the following data:
 
 testDat - data.frame(A = c(1,NA,3), B = c(NA, NA, 3))
 
 testDat
A  B
 1  1 NA
 2 NA NA
 3  3  3
 
 rowsums() with na.rm=TRUE generates the following, which is not desired:
 
 rowSums(testDat[, c('A', 'B')], na.rm=T)
 [1] 1 0 6
 
 rowsums() with na.rm=F generates the following, which is also not
 desired:
 
 
 rowSums(testDat[, c('A', 'B')], na.rm=F)
 [1] NA NA  6
 
 I see why this occurs, but what I hope to have returned would be:
 [1] 1 NA  6
 
 To get what I want I could do the following, but normally my ideas are
 bad ideas and there are codified and proper ways to do things. 
 
 rr - numeric(nrow(testDat))
 for(i in 1:nrow(testDat)) rr[i] - if(all(is.na(testDat[i,]))) NA else
 sum(testDat[i,], na.rm=T)
 
 rr
 [1]  1 NA  6
 
 Is there a proper way to do this? In my real data, nrow is over
 100,000
 
 Thanks,
 Harold

The behavior you observe is documented in ?rowSums in the Value section:

If there are no values in a range to be summed over (after removing
missing values with na.rm = TRUE), that component of the output is set
to 0 (*Sums) or NA (*Means), consistent with sum and mean.


So:

 sum(c(NA, NA), na.rm = TRUE)
[1] 0


As per the definition of the sum of an empty set being 0, which I got
burned on myself a while back.

You could feasibly use:

  Res - rowSums(testDat, na.rm = TRUE)
  is.na(Res) - rowSums(is.na(testDat)) == ncol(testDat)

HTH,

Marc Schwartz

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


Re: [R] rowSums()

2008-09-24 Thread Chuck Cleland
On 9/24/2008 10:38 AM, Marc Schwartz wrote:
 on 09/24/2008 09:06 AM Doran, Harold wrote:
 Say I have the following data:

 testDat - data.frame(A = c(1,NA,3), B = c(NA, NA, 3))

 testDat
A  B
 1  1 NA
 2 NA NA
 3  3  3

 rowsums() with na.rm=TRUE generates the following, which is not desired:

 rowSums(testDat[, c('A', 'B')], na.rm=T)
 [1] 1 0 6

 rowsums() with na.rm=F generates the following, which is also not
 desired:


 rowSums(testDat[, c('A', 'B')], na.rm=F)
 [1] NA NA  6

 I see why this occurs, but what I hope to have returned would be:
 [1] 1 NA  6

 To get what I want I could do the following, but normally my ideas are
 bad ideas and there are codified and proper ways to do things. 

 rr - numeric(nrow(testDat))
 for(i in 1:nrow(testDat)) rr[i] - if(all(is.na(testDat[i,]))) NA else
 sum(testDat[i,], na.rm=T)

 rr
 [1]  1 NA  6

 Is there a proper way to do this? In my real data, nrow is over
 100,000

 Thanks,
 Harold
 
 The behavior you observe is documented in ?rowSums in the Value section:
 
 If there are no values in a range to be summed over (after removing
 missing values with na.rm = TRUE), that component of the output is set
 to 0 (*Sums) or NA (*Means), consistent with sum and mean.

  Based on the difference in behavior for Sums and Means, this might be
another possibility:

rowMeans(testDat, na.rm=TRUE) * rowSums(!is.na(testDat))

[1]  1 NA  6

 So:
 
 sum(c(NA, NA), na.rm = TRUE)
 [1] 0
 
 
 As per the definition of the sum of an empty set being 0, which I got
 burned on myself a while back.
 
 You could feasibly use:
 
   Res - rowSums(testDat, na.rm = TRUE)
   is.na(Res) - rowSums(is.na(testDat)) == ncol(testDat)
 
 HTH,
 
 Marc Schwartz
 
 __
 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. 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc. (www.ndri.org)
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

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


Re: [R] *solved* lower / upper case letters in a plot

2008-09-24 Thread Jörg Groß


Great thanks and sorry for my bad english!


Am 24.09.2008 um 16:32 schrieb Dimitris Rizopoulos:


so you mean subscripts and superscripts, then check:

?plotmath


Best,
Dimitris


Jörg Groß wrote:

Oh, ok ...
perhaps it was the wrong description;
I want lowered cases...
In LaTeX I get them with x_1 for example.
Or x^2 for upper cases.
But how can I make this in R?
Am 24.09.2008 um 16:17 schrieb Dimitris Rizopoulos:

check:

?tolower()


Best,
Dimitris


Jörg Groß wrote:

Hi,
How can I generate lower case letters for my axis-titles?
Thanks,
Jörg
__
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.


--
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014

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


--
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014


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


Re: [R] How to convert backslash to slash?

2008-09-24 Thread hadley wickham
 I agree that that some sort of facility would be convenient.  Creating
 latex output is
 another situation where not having to escape backslashes would be convenient.

And regular expressions, of course.

Hadley

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

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


Re: [R] Counting character occurrences in data frame

2008-09-24 Thread Hutchinson,David [PYR]
Thanks Charles, ftable() works perfectly. 

-Original Message-
From: Charles C. Berry [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 23, 2008 5:06 PM
To: Hutchinson,David [PYR]
Cc: r-help@r-project.org
Subject: Re: [R] Counting character occurrences in data frame



See

?ftable
?as.data.frame
?xtabs

e.g.

ftable( xtabs( ~code+year+month, your.df ), col.vars=1 )
as.data.frame( xtabs(~code+year+month, your.df ) )

HTH,

Chuck

On Tue, 23 Sep 2008, Hutchinson,David [PYR] wrote:

 Hi R-Users,

 I have a data frame containing year, month, day, and code columns. The
 code column is a unique character of set ('E','A','B') - I am trying
to
 determine an efficient way of summarizing the count of each of these
 codes by month and year without having to use for...loops and subsets.
 Does anyone have any suggestions?

 Thanks in advance,
 Dave

 Here is a snapshot of my data frame:

 year month day code
 8006 193512   1E
 8007 193512   2
 8008 193512   3E
 8009 193512   4
 8010 193512   5E
 8011 193512   6E

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


Charles C. Berry(858) 534-2098
 Dept of Family/Preventive
Medicine
E mailto:[EMAIL PROTECTED]  UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego
92093-0901

__
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] How do I Convert 1 to the number 1?

2008-09-24 Thread Tom La Bone

Is there an elegant way in R to change a number reported as a less-than
number in text format, 1 for example, to the numeric equivalent 1? I have
been trying to use as.numeric, but have not come up with anything clever
yet.

Tom
 
-- 
View this message in context: 
http://www.nabble.com/How-do-I-Convert-%22%3C1%22-to-the-number-1--tp19651018p19651018.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.


Re: [R] rgl: ellipse3d with axes

2008-09-24 Thread Duncan Murdoch

On 24/09/2008 10:12 AM, Michael Friendly wrote:

Duncan Murdoch wrote:
The normals component contains the surface normals.  It is used to 
help in rendering the surface, but isn't much use for your purposes.
Unfortunately, I'm not familiar enough with the internals of princomp 
to tell you how to get the axes you want.


Duncan Murdoch


OK, then let me repharase it. The axes of the unit  sphere are like

axes - matrix(
c(0, 0, -1,   0, 0, 1,
   0, -1, 0,   0, 1,  0,
   -1, 0, 0,   1, 0, 0),  6, 3, byrow=TRUE)
taken in pairs.  I'd like to transform these coordinates the same was as 
in ellipse3d() and add them to the plot.


That's easy, but it doesn't give you the principal axes of the ellipse. 
 Just use


axes %*% chol(cov)

If you start with a unit sphere, this will give you points on its 
surface, but not the ones you want.  For those you need the SVD or 
eigenvectors.  This looks like it does what you want:


axes - matrix(
c(0, 0, 0, # added origin
   0, 0, -1,   0, 0, 1,
   0, -1, 0,   0, 1,  0,
   -1, 0, 0,   1, 0, 0),  7, 3, byrow=TRUE)
axes - axes[c(1,2,1,3,1,4,1,5,1,6,1,7),]  # add the origin before each

cov - cov(trees)
eigen - eigen(cov)
shade3d(ellipse3d(cov, t=1, alpha=0.2, col='red'))
segments3d(axes %*% sqrt(diag(eigen$values)) %*% t(eigen$vectors))

Duncan Murdoch

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


Re: [R] How to draw the graph of f(x,y) = x * y ?

2008-09-24 Thread Farley, Robert
You could always try 
 F(x,y) = f(x) + 0*y

That is zero out the degenerate dimensions.  Of course you'll be
plotting what is essentially a two dimensional object as if it were
three dimensional.  The degeneracy in y means a 2-D curve will be
extruded along the Y dimension.

 
Robert Farley
Metro
www.Metro.net 
 
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Paul Smith
Sent: Wednesday, September 24, 2008 06:20
To: [EMAIL PROTECTED]
Subject: Re: [R] How to draw the graph of f(x,y) = x * y ?

On Wed, Sep 24, 2008 at 4:05 AM, Ben Bolker [EMAIL PROTECTED] wrote:
 The function curve() draws the graph of functions from R to R. Is
 there some homologous function to curve() to draw functions from R^2
 to R?

  There is a curve3d function in the emdbook package on CRAN.

Thanks, Ben and Robin. I think curve3d should be included in the base
of R. It would help many users, I believe.

I do not know whether curve3d could be extended to draw constant
functions and functions like f(x,y) = x. With the current version, I
get the following:

 curve3d(1)
Error in curve3d(1) :
  'expr' must be a function or an expression containing 'x' and 'y'
 curve3d(x)
Error in eval(expr, envir, enclos) : could not find function x


Paul

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


[R] looping through variables

2008-09-24 Thread K. Fleischer
Hello everyone,

I have the following problem:

My analysis includes many predictor variables (50) in the form of 
raster maps (asc), but I am trying to avoid having to type all their 
names over and over again in the analysis (e.g. for vectorisation, for 
deletion of NA's, etc.)

So ideally I would like to store them in some way that their names 
only have to be typed once and can always be referred back to.

First step would be to automate the vectorisation of the raster maps:

# these are the raster maps which need to combined somehow ??
variables - (temperature, precipitation, elevation, vegcover) 

VariablesNew=c()

For (i in 1:length(variables)) {
Varnew - as.vector(variables[i])
VariablesNew - cbind(VariablesNew, Varnew)
}

This should return a data frame called VariablesNew with each column 
representing one of the variables. 

So the BIG QUESTION is how to input the variable names that they can 
be referred to easily and, the variable itself can be pulled out and 
not just its name!!
I believe this cant be too difficult??

Thanx in advance,
Katrin

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


Re: [R] How to convert backslash to slash?

2008-09-24 Thread Duncan Murdoch

On 24/09/2008 10:53 AM, hadley wickham wrote:

I agree that that some sort of facility would be convenient.  Creating
latex output is
another situation where not having to escape backslashes would be convenient.


And regular expressions, of course.


There were proposals to do this last year (I think you participated in 
the discussion), but there was no agreement on how to do it.  One was 
triple quotes as in Python, e.g.


'''c:\foo\bar'''

and another was some variation on heredocs from several languages, or 
\verb from TeX.


Duncan Murdoch

__
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] keep the row indexes/names when do aggregate

2008-09-24 Thread zhihuali

Hi, R-users,

If I have a data frame like this:
x-data.frame(g=c(g1,g2,g1,g1,g2),v=c(1,7,3,2,8))
   g v
1 g1 1
2 g2 7
3 g1 3
4 g1 2
5 g2 8


It contains two groups, g1 and g2. Now for each group I want the max v:

 aggregate(x$v,list(g=x$g),max)
   g x
1 g1 3
2 g2 8

Beautiful. But what if I want to keep the row index of (g1 3) and (g2 8) in the 
original x? 
So I want is:
do something
   g x
 3 g1 3
 5 g2 8

Of course it'd may make much more sense if the row indexes are some row names 
that I want to keep.

Is there a simple way to do that?

Thanks a lot!

Z


 


_
[[elided Hotmail spam]]

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


Re: [R] rgl: ellipse3d with axes

2008-09-24 Thread Duncan Murdoch

On 24/09/2008 11:11 AM, Duncan Murdoch wrote:

On 24/09/2008 10:12 AM, Michael Friendly wrote:

Duncan Murdoch wrote:
The normals component contains the surface normals.  It is used to 
help in rendering the surface, but isn't much use for your purposes.
Unfortunately, I'm not familiar enough with the internals of princomp 
to tell you how to get the axes you want.


Duncan Murdoch

OK, then let me repharase it. The axes of the unit  sphere are like

axes - matrix(
c(0, 0, -1,   0, 0, 1,
   0, -1, 0,   0, 1,  0,
   -1, 0, 0,   1, 0, 0),  6, 3, byrow=TRUE)
taken in pairs.  I'd like to transform these coordinates the same was as 
in ellipse3d() and add them to the plot.


That's easy, but it doesn't give you the principal axes of the ellipse. 
  Just use


axes %*% chol(cov)

If you start with a unit sphere, this will give you points on its 
surface, but not the ones you want.  For those you need the SVD or 
eigenvectors.  This looks like it does what you want:


axes - matrix(
 c(0, 0, 0, # added origin
0, 0, -1,   0, 0, 1,
0, -1, 0,   0, 1,  0,
-1, 0, 0,   1, 0, 0),  7, 3, byrow=TRUE)
axes - axes[c(1,2,1,3,1,4,1,5,1,6,1,7),]  # add the origin before each


Why did I add the origin?  It's not needed, your axes were fine.  Sorry.

Duncan Murdoch

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


Re: [R] Weights for polr

2008-09-24 Thread Gregory Wawro

Thanks for directing my attention to the survey package and svyolr().

Best,
Greg

.

Gregory Wawro   [EMAIL PROTECTED]
Associate Professor phone:  212-854-8540
Dept. of Political Science  fax:212-222-0598
741 International Affairs   http://www.columbia.edu/~gjw10/
Columbia University
New York, NY 10027

.






On Mon, 22 Sep 2008, Thomas Lumley wrote:


On Mon, 22 Sep 2008, Gregory Wawro wrote:


Hello,

I'm estimating an ordered logit model on a probability weighted survey 
sample.


You could use svyolr() in the survey package.

polr permits case weights with the weights option, but I cannot figure 
out from existing documentation what it actually does with these weights.


They are frequency weights.

I'm concerned about this because I get somewhat different results using 
Stata's ologit command with the pweights option


You should get the same point estimates, but different standard errors.

and very different results using proc logistic in SAS with its weight 
option.


Again, it should be the same point estimates but different standard errors.

 So my basic question is whether or not it is appropriate to use the weight 
option for polr with my data.


No.

-thomas

Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle



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


Re: [R] keep the row indexes/names when do aggregate

2008-09-24 Thread Gabor Grothendieck
Rather than aggregate, use order and duplicated as in this post:

https://stat.ethz.ch/pipermail/r-help/2008-September/173139.html

On Wed, Sep 24, 2008 at 11:21 AM, zhihuali [EMAIL PROTECTED] wrote:

 Hi, R-users,

 If I have a data frame like this:
x-data.frame(g=c(g1,g2,g1,g1,g2),v=c(1,7,3,2,8))
   g v
 1 g1 1
 2 g2 7
 3 g1 3
 4 g1 2
 5 g2 8


 It contains two groups, g1 and g2. Now for each group I want the max v:

 aggregate(x$v,list(g=x$g),max)
   g x
 1 g1 3
 2 g2 8

 Beautiful. But what if I want to keep the row index of (g1 3) and (g2 8) in 
 the original x?
 So I want is:
do something
   g x
  3 g1 3
  5 g2 8

 Of course it'd may make much more sense if the row indexes are some row names 
 that I want to keep.

 Is there a simple way to do that?

 Thanks a lot!

 Z





 _
 [[elided Hotmail spam]]

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


[R] (nlme) Repeated measures with continuous covariate in lme

2008-09-24 Thread Robert Buitenwerf

Dear readers,
 
I have a basic question about how to use lme for my design. I haven't been able 
to find an example in r-help that made it clear to me how to tackle this 
problem and unfortunately I also cannot get hold of Pinheiro  Bates 2000. I 
hope someone can help.
 
Data for the response variable foan were collected in:
·   60 plots
·   plots were re-sampled yearly for 15 years (certain years are missing 
for certain plots)
·   plots are divided over 4 reserves (but not equally, so the design is 
unbalanced)
·   rain is a continuous covariate, which has the same value for all plots 
within one year.
 
Since plots are random within reserves, but reserves can be seen as fixed 
factors, it seems I should use a mixed-model and so I have come up with the 
following models:
 
model.1 - lme(foan ~ year * reserve, data=data, random= ~1 | plot)
 
model.2 - lme(foan ~ year * reserve, data=data, random= ~year | plot)
 
Model.2 does not provide a better fit than model.1, so apparently the slope of 
the relationship between foan and year does not vary for plots. 
 
I want to know if (and how) the response variable changes over the years, while 
correcting for variance explained by rain. My question is how to incorporate 
rain in this model. Can I simply use:
 
model.3 - lme(foan ~ year * reserve * rain, data=data, random= ~ 1 | plot)
 
This somehow seems wrong (forgive my ignorance) since rain has the same value 
within each year. On the other hand it has different values within each plot. I 
hope someone can point me in the right direction.
 
 
Thanks in advance,
 
Robert Buitenwerf
 
South African Environmental Observation Network
Phalaborwa
South Africa
_
[[elided Hotmail spam]]

[[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] Graph question

2008-09-24 Thread Georgina Sarah Humphreys
If I have a set of data comprising a list of numbers of eggs on mosquito guts 
that range from 1 to 157.  How can I get R to draw a barchart of the 
distribution of the data (i.e. x axis= number of eggs on a gut, y axis=number 
of mosquitoes found with that number of eggs)?  Data is listed below.

Thanks,
Georgina

Number of eggs on each mosquito gut:
 [1]   1   1   1   1   4   2   1  12  12   1   2   1  12   6  11  33  33  94  17
 [20]   3  14  12  54   1  16  10   7  12   4   7  22   1  34   2  11  34  22  
27
 [39]   4   1  27   1   1 157   1   7  31   3   6  24   6   7  23  10  54   3  
12
 [58]  12   5   2  27   2   7   6  84   3  68   1   4   6  41   1  50  27  30  
14
 [77]   3   1   1   1  30   1  68   1   7   1  10   5  11   4  19   1   7   9  
33
 [96]   2  33  57  12   6   2  57   3 115  19  22  10  19   6  11  30  57   4

PhD Student
Division of Infection and Immunity
B5-29, GBRC
120 University Place
Glasgow
G12 8TA
Tel: 0141 330 5650

__
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] climatological standard deviation- (question re-posted)

2008-09-24 Thread Yogesh Tiwari
Sorry for re-posting the question, I did not get any reply.
Kindly reply please  if any one can.
###
Hello R users,

I have a montly time series over a several year period.
It's easy to compute a monthly climatology (12 values), Now, I would like to
calculate the corresponding standard deviation, ie the 12 values
calculated from the january values, february values, etc.
What's the best way for such a calculation ?
Regards,
Yogesh

-- 
Yogesh K. Tiwari (Dr.rer.nat),
Scientist,
Indian Institute of Tropical Meteorology,
Homi Bhabha Road,
Pashan,
Pune-411008
INDIA

Phone: 0091-99 2273 9513 (Cell)
: 0091-20-258 93 600 (O) (Ext.250)
Fax : 0091-20-258 93 825



-- 
Yogesh K. Tiwari (Dr.rer.nat),
Scientist,
Indian Institute of Tropical Meteorology,
Homi Bhabha Road,
Pashan,
Pune-411008
INDIA

Phone: 0091-99 2273 9513 (Cell)
: 0091-20-258 93 600 (O) (Ext.250)
Fax : 0091-20-258 93 825

[[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] Simulations / repetitions help!

2008-09-24 Thread Lauren_G

Dear all,

My question concerns using repetitions and simulations (loops?) in R.  I am
very new R user, so any help that can be offered would be greatly
appreciated!  

I am using fitdistr() to determine the distribution of empirical univariate
datasets, and ks.test to assess the goodness of fit.  Because the null
distribution of the KS statistic is not known when the distribution
parameters are estimated from the data I would like to use simulations to
generate a more accurate p-value (following the methods explained in the
second to last paragraph on page 11 of Clauset et al. [2007] available at
http://arxiv.org/abs/0706.1062 - also attached)

Specifically:

I would like to generate a random dataset (‘x’) from a distribution (e.g.
exponential):

x-rweibull(1500,shape,scale)

calculate the parameters of the best-fit distribution:

fitdistr(x,weibull)
  shape  scale
  14.8727621811.098046257  
 ( 0.250069835) ( 0.002030626)

 and assess the goodness-of-fit of ‘x’ to this best-fit distribution.  

ks.test(x,pweibull,14.9,1.1)
data:  x 
D = 0.215, p-value  2.2e-16
alternative hypothesis: two-sided 

I would like to repeat this c.500 times using a new random dataset each
time, calculating D for each dataset relative to its own best fit model
(i.e. using the parameters generated by fitdistr each time).  As a final
output I would like a matrix listing all 500 D values.  

I am very new to R, so any advice anyone could give me (no matter how simple
it may seem) would be greatly appreciated!

Many thanks

Lauren
http://www.nabble.com/file/p19648673/clauset_et_al_2007.pdf
clauset_et_al_2007.pdf 
-- 
View this message in context: 
http://www.nabble.com/Simulations---repetitions-help%21-tp19648673p19648673.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.


[R] t tests/ANOVA

2008-09-24 Thread Georgina Sarah Humphreys
I have a set of data that comprises genome numbers in single eggs from three 
different parasite clones - 3D7, HB3, and MIX.  I can draw a boxplot of the 
genome numbers for each clonefed but how do I carry out a t test or ANOVA to 
compare if the means are signifcantly different? (Data is listed below)

Many thanks,
Georgina Humphreys

clonefedgenomes
HB3 21.3
HB3 23.5
HB3 25.9
3D7 27.2
HB3 28.1
MIX 35.1
MIX 37.9
MIX 42.1
MIX 42.4
HB3 46.3
HB3 46.3
MIX 48.4
MIX 52.1
HB3 54.6
MIX 55.4
3D7 57.6
HB3 58.4
3D7 62.1
MIX 63.6
MIX 66.5
3D7 69.1
3D7 76.2
MIX 77.5
MIX 80.4
MIX 85.5
MIX 85.9
HB3 96
HB3 106.3
3D7 108.1
MIX 113.8
MIX 117.4
MIX 118
3D7 122.8
3D7 131.4
MIX 138.7
MIX 142.6
MIX 143
3D7 144
MIX 151.6
MIX 155.2
MIX 162.4
MIX 168.4
MIX 169.3
3D7 172.3
HB3 173
HB3 191.9
MIX 192.7
HB3 200
MIX 206.3
3D7 210.2
HB3 223.7
HB3 223.9
3D7 232.1
HB3 238.6
MIX 240.8
3D7 254.3
3D7 257.6
3D7 261.8
3D7 269.9
HB3 277
MIX 289.1
MIX 293.2
MIX 295.2
MIX 295.7
MIX 310.4
3D7 311.9
3D7 311.9
MIX 313.1
MIX 317.8
MIX 332.2
3D7 334.9
3D7 338.2
MIX 340
MIX 360.5
3D7 372.8
3D7 376.6
HB3 390.3
MIX 419.1
3D7 420
MIX 427.4
MIX 443
MIX 449.7
MIX 452.8
MIX 501.4
3D7 502.9
3D7 505.5
3D7 506.3
3D7 529
MIX 534.4
MIX 540.6
MIX 542
3D7 545.2
MIX 547.2
MIX 554.2
MIX 556.5
3D7 564.9
3D7 575.1
3D7 580.6
MIX 591.5
3D7 655.5
3D7 666.1
3D7 667.2
3D7 699
3D7 741.2
3D7 744.8
3D7 752.2
MIX 795.9
3D7 810.9
HB3 816.4
MIX 849.2
3D7 852.9
3D7 875.4
3D7 891.3
MIX 906.5
MIX 922.3
MIX 949.6
MIX 986.1
MIX 994.3
MIX 1005.3
MIX 1061.3
MIX 1159.5
3D7 1163.2
MIX 1177.5
3D7 1211.3
3D7 1249.7
3D7 1318.3
MIX 1579.3
MIX 1585.2
MIX 1590.3
MIX 1788.7
MIX 2012.9
3D7 2067.4

PhD Student
Division of Infection and Immunity
B5-29, GBRC
120 University Place
Glasgow
G12 8TA
Tel: 0141 330 5650

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


Re: [R] How do I Convert 1 to the number 1?

2008-09-24 Thread John Fox
Dear Tom,

I don't know whether it qualifies as elegant or clever, but you should
be able to use sub(), as in

 as.numeric(sub(, , c(1,  -2, 1)))
[1]  1 -2  1

I hope this helps,
 John

On Wed, 24 Sep 2008 08:08:21 -0700 (PDT)
 Tom La Bone [EMAIL PROTECTED] wrote:
 
 Is there an elegant way in R to change a number reported as a
 less-than
 number in text format, 1 for example, to the numeric equivalent 1?
 I have
 been trying to use as.numeric, but have not come up with anything
 clever
 yet.
 
 Tom
  
 -- 
 View this message in context:

http://www.nabble.com/How-do-I-Convert-%22%3C1%22-to-the-number-1--tp19651018p19651018.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.


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

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


Re: [R] Bug in is ?

2008-09-24 Thread ctu
Thank you for all of you. Intuitively, 7 is an integer for people who  
live in this planet. It is just very difficult for me to believe that  
R does not think 7 is an integer but 7L is.

is.integer(7)  # R 2.7.2

[1] FALSE
Thus, based on Martin's comments, I try it again on the S-PLUS 8.0 and  
it shows

is.integer(7)   # S-PLUS 8.0

[1] T

Hopefully, someday and someone will fix it therefore, R users don't  
need to use as.integer(7) to tell R that 7 is an integer.


Thanks again
Chunhao


Quoting Martin Maechler [EMAIL PROTECTED]:


KJ == Keith Jewell [EMAIL PROTECTED]
on Wed, 24 Sep 2008 09:46:08 +0100 writes:


KJ 7 is an integer, but it's also a real.
KJ In R '?is'  and '?is.integer' are clear that you're testing   
the class(es) of

KJ objects, not their values.
KJ I can't comment on the relationship with S Programming

I can:

In S, and S-plus upto version 3.4,
numeric constants such as '7' where  double as they are in R.

Then in S-plus 5.1, they became integer,
and there were tools so users could change all(!!) their S
scripts to use '7.' instead of '7' in all places where numeric
constants were seen, in order to keep behavior back compatible.

R never made such a step (backwards ;-), and never will,
notably since in R we had introduced the explicit long (= long
integer) constants, using the 'L' suffix,
i.e.,  7L is integer
7 is double

Note however that for both, is.numeric(.) is fulfilled and
class(.) and mode(.) return numeric.
Only typeof(.), storage.mode(.)  or  str(.)
(or functions building on these) tell you the difference.

Martin Maechler, ETH Zurich and R core team

[And, yes, if you think further and are wondering:
 If we'd design things from scratch, we would only have S4
 classes and double would be a proper class and
 numeric would be the class union of {integer, double}
]


KJ [EMAIL PROTECTED] wrote in message
KJ news:[EMAIL PROTECTED]
 This is really bothering me! In the Dr. Venables and Dr.   
Ripley's book  S

 Programming Page 105
 shows that
 c(is(10,integer),is(10.5,integer))
 [1] T F

 But I try this in R 2.7.2 it shows
 c(is(10,integer),is(10.5,integer))
 [1] FALSE FALSE
 Does anyone know what is going on here?

 Appreciate,
 Chunhao

 Quoting Yihui Xie [EMAIL PROTECTED]:

 Yes, everyone will agree 7 is an integer, but I don't think
 computers will agree too :-) R thinks it's a double-precision number,
 except when you explicitly specify it as an integer (say,
 as.integer()).

 class(7)
 [1] numeric

 is.double(7)
 [1] TRUE

 Regards,
 Yihui
 --
 Yihui Xie [EMAIL PROTECTED]
 Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
 Mobile: +86-15810805877
 Homepage: http://www.yihui.name
 School of Statistics, Room 1037, Mingde Main Building,
 Renmin University of China, Beijing, 100872, China



 On Wed, Sep 24, 2008 at 12:40 PM,  [EMAIL PROTECTED] wrote:
 Hi R users
 Is there anything wrong in is function? (R 2.7.2)
 I believe that everyone will agree that 7 is an integer,   
right? but

 why R
 shows 7 is not an integer

 is.integer(7)

 [1] FALSE

 is(7,integer)

 [1] FALSE

 is(as.integer(7), integer)

 [1] TRUE

 Thank you very much in advance
 Chunhao

KJ __
KJ R-help@r-project.org mailing list
KJ https://stat.ethz.ch/mailman/listinfo/r-help
KJ PLEASE do read the posting guide   
http://www.R-project.org/posting-guide.html

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



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


Re: [R] climatological standard deviation- (question re-posted)

2008-09-24 Thread Nordlund, Dan (DSHS/RDA)
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Yogesh Tiwari
 Sent: Wednesday, September 24, 2008 5:43 AM
 To: [EMAIL PROTECTED]
 Subject: [R] climatological standard deviation- (question re-posted)
 
 Sorry for re-posting the question, I did not get any reply.
 Kindly reply please  if any one can.
 ###
 Hello R users,
 
 I have a montly time series over a several year period.
 It's easy to compute a monthly climatology (12 values), Now, 
 I would like to
 calculate the corresponding standard deviation, ie the 12 values
 calculated from the january values, february values, etc.
 What's the best way for such a calculation ?
 Regards,
 Yogesh
 
 -- 
 Yogesh K. Tiwari (Dr.rer.nat),
 Scientist,
 Indian Institute of Tropical Meteorology,
 Homi Bhabha Road,
 Pashan,
 Pune-411008
 INDIA

Actually, you did get a response from someone asking for more information about 
what you were doing, and for some sample data so that the advice given would 
actually be useful.  I presume everyone is waiting for the additional 
information.

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA  98504-5204
 
 

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


Re: [R] climatological standard deviation- (question re-posted)

2008-09-24 Thread Sarah Goslee
On Wed, Sep 24, 2008 at 8:43 AM, Yogesh Tiwari
[EMAIL PROTECTED] wrote:
 Sorry for re-posting the question, I did not get any reply.
 Kindly reply please  if any one can.

Most likely that's because you didn't clearly explain the problem. Please read
the posting guide (see link at bottom of each and every message on this
list), and provide an example of your data, a clear description of what
you're trying to do, and what you have tried that hasn't worked.

Sarah

 ###
 Hello R users,

 I have a montly time series over a several year period.
 It's easy to compute a monthly climatology (12 values), Now, I would like to
 calculate the corresponding standard deviation, ie the 12 values
 calculated from the january values, february values, etc.
 What's the best way for such a calculation ?
 Regards,
 Yogesh

 --


-- 
Sarah Goslee
http://www.functionaldiversity.org

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


Re: [R] Why horizontal bars instead of a line

2008-09-24 Thread Sarah Goslee
Since x$GrSe isn't a number, what do you expect R to do?

On Wed, Sep 24, 2008 at 11:28 AM, Schreiber, Stefan
[EMAIL PROTECTED] wrote:
 Hey list!


 It looks simple, though it's not possible for me to plot the following
 properly:

 (some made-up data)

 GrSeClone1  Clone2  Clone3  Clone4  Clone...
 G1999   2   3   6   5
 G2000   2   5   7   4
 G2001   5   3   7   3
 G2002   4   5   8   3
 G...



 GrSe=Growing Season.

 I've read the file as x and then tried:plot(x$GrSe,x$Clone1)

 The output is 4 horizontal bars. Even if I write
 plot(x$GrSe,x$Clone1,type=n) R is still plotting!
 I figured already that if I delete the G in front of the years it'll
 work, however, I'd like to keep the G.
 Is that possible?

 Hope it is an appropriate question for the list.

 Thanks,
 Stefan






-- 
Sarah Goslee
http://www.functionaldiversity.org

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


Re: [R] climatological standard deviation- (question re-posted)

2008-09-24 Thread stephen sefick
package zoo rollapply if I had to guess at what you want to do, but
heed the advice given above.

On Wed, Sep 24, 2008 at 12:11 PM, Sarah Goslee [EMAIL PROTECTED] wrote:
 On Wed, Sep 24, 2008 at 8:43 AM, Yogesh Tiwari
 [EMAIL PROTECTED] wrote:
 Sorry for re-posting the question, I did not get any reply.
 Kindly reply please  if any one can.

 Most likely that's because you didn't clearly explain the problem. Please read
 the posting guide (see link at bottom of each and every message on this
 list), and provide an example of your data, a clear description of what
 you're trying to do, and what you have tried that hasn't worked.

 Sarah

 ###
 Hello R users,

 I have a montly time series over a several year period.
 It's easy to compute a monthly climatology (12 values), Now, I would like to
 calculate the corresponding standard deviation, ie the 12 values
 calculated from the january values, february values, etc.
 What's the best way for such a calculation ?
 Regards,
 Yogesh

 --


 --
 Sarah Goslee
 http://www.functionaldiversity.org

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




-- 
Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods. We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

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


Re: [R] Graph question

2008-09-24 Thread stephen sefick
look at
histogram and densityplot in the lattice package

On Wed, Sep 24, 2008 at 9:26 AM, Georgina Sarah Humphreys
[EMAIL PROTECTED] wrote:
 If I have a set of data comprising a list of numbers of eggs on mosquito guts 
 that range from 1 to 157.  How can I get R to draw a barchart of the 
 distribution of the data (i.e. x axis= number of eggs on a gut, y axis=number 
 of mosquitoes found with that number of eggs)?  Data is listed below.

 Thanks,
 Georgina

 Number of eggs on each mosquito gut:
  [1]   1   1   1   1   4   2   1  12  12   1   2   1  12   6  11  33  33  94  
 17
  [20]   3  14  12  54   1  16  10   7  12   4   7  22   1  34   2  11  34  22 
  27
  [39]   4   1  27   1   1 157   1   7  31   3   6  24   6   7  23  10  54   3 
  12
  [58]  12   5   2  27   2   7   6  84   3  68   1   4   6  41   1  50  27  30 
  14
  [77]   3   1   1   1  30   1  68   1   7   1  10   5  11   4  19   1   7   9 
  33
  [96]   2  33  57  12   6   2  57   3 115  19  22  10  19   6  11  30  57   4

 PhD Student
 Division of Infection and Immunity
 B5-29, GBRC
 120 University Place
 Glasgow
 G12 8TA
 Tel: 0141 330 5650

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




-- 
Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods. We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

__
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] weights option in lmer

2008-09-24 Thread maria jose juan jorda

Hi all, I
am trying to run a linear mixed effect models in lmer() from the lme4
package using the weights option.



I am using the
R version  2.7.2 (2008-08-25) and lmer version in lme4_0.999375-26, which I 
think it is the latest version!





 I am getting and error message when I add the
option weights in the lmer function. This is the error message I
get Error en mer_finalize(ans) : Calculated PWRSS for a LMM is negative.

 

I have been
reading in the last few weeks all the forum questions and answers about this
issue. Certainly this has been discussed MANY  times before especially with
older versions of lmer (much less in the newer versions). I have been trying
different things following peoples advice with not happy end, even I tried older
version of lmer where the weight option was not giving an error message but it
was not affecting the model at all, hoping maybe It did work some time in the
past.

 

This is an simple
example of one of my models with varying intercept and slope. I am
looking how
the mean size of fish has been changing over time in different stocks.
This is a simple model but it will get more complicated in the future. 
I just need to make the option of weights to work before the model
becomes more complex.



 

MODEL WITH
NO WEIGHTS

 M1- lmer(meansize_scaled~year + (year |stock ), data=cas)   # two levels

 

 M1

Linear
mixed model fit by REML 

Formula:
meansize_scaled ~ year + (year | stock) 

   Data: cas 

   AIC  
BIC logLik deviance REMLdev

 -2777 -2742  
1395-2807   -2789

Random
effects:

 Groups  
NameVariance   Std.Dev. 
Corr   

 stock   
(Intercept) 1.0964e-02 0.1047097   


  year3.2435e-06 0.0018010 -0.273 

 Residual 2.0193e-02 0.1421010

Number of
obs: 2692, groups: stock, 9

 

Fixed
effects:

 Estimate Std. Error t value

(Intercept)
0.4869771  0.0360736  13.500

year0.0001034  0.0006642  
0.156

 

Correlation
of Fixed Effects:

 (Intr)

year -0.341

 

 

MODEL WITH
WEIGHTS. 


M2- lmer(meansize_scaled~year + (year |stock ), data=cas,
weights=N_fish)   # two level model

Error en
mer_finalize(ans) : Calculated PWRSS for a LMM is negative
As you see above I get the message error.

I read read
read in the [R] and [R-sig-ME] and I did not get any clear solutions to the
weight problem in lmer. My feeling is that the weight option in lmer just not
work! At least at the present time, maybe in the future it will change. 

 

Can anybody
share with me how they have deal with this issue?

 

Should I
give up with lmer and try to do this analysis using other tools? maybe try to 
learn the function lme from nlme package?

 

I just
would like to know if I need to give up with weight option in lmer or if I am
missing something obvious but I did not find it yet.





I want to emphasize that I really appreciate all the hard work of everybody 
(specially Douglas Bates) 
for always working hard answering everybody´s questions and improving the lmer 
function!!
SincerelyMaria

))):)   ))):)   ))):)   ))):)   ))):)   ))):)   ))):)   ))):)  

Maria Jose Juan Jorda
Phd Student

AZTI - Tecnalia / Unidad de Investigación Marina 
Herrera Kaia Portualde z/g
20110 Pasaia, Gipuzkoa, Spain

Recursos Marinos y Pesquerias
Depart. Biologia Animal, Vegetal y Ecologia
Universidade A Coruña
Campus A Zapateira s/n
15071, A Coruña, Spain

Tel. +34981167000 ext. 2204
Fax. +34981167065
[EMAIL PROTECTED]
_
[[elided Hotmail spam]]

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


Re: [R] rgl: ellipse3d with axes

2008-09-24 Thread Michael Friendly

Thanks Duncan ( others)

Here is a function that does what I want in this case, and tries to do 
it to work generally
with ellipse3d.  (Note that I reverse the order of centre and scale 
'cause I was bitten

by trying ellipse3d.axes(cov, mu))

# draw axes in the data ellipse computed by ellipse3d
ellipse3d.axes -
function (x, centre = c(0, 0, 0), scale = c(1, 1, 1), level = 0.95,
   t = sqrt(qchisq(level, 3)), which = 1:3, ...)
{
   stopifnot(is.matrix(x)) # should test for square, symmetric
   cov - x[which, which]
   eigen - eigen(cov)
   # coordinate axes, (-1, 1), in pairs
   axes - matrix(
 c(0, 0, -1,   0, 0, 1,
   0, -1, 0,   0, 1, 0,
  -1, 0, 0,1, 0, 0),  6, 3, byrow=TRUE)

   # transform to PC axes
   axes - axes %*% sqrt(diag(eigen$values)) %*% t(eigen$vectors)
   result - scale3d(axes, t, t, t)
   if (!missing(scale))
   if (length(scale) != 3) scale - rep(scale, length.out=3)
   result - scale3d(result, scale[1], scale[2], scale[3])
   if (!missing(centre))
   if (length(centre) != 3) scale - rep(centre, length.out=3)
   result - translate3d(result, centre[1], centre[2], centre[3])
   segments3d(result, ...)
   invisible(result)
}

Test case:

library(rgl)
data(iris)
iris3 - iris[,1:3]
cov - cov(iris3)
mu - mean(iris3)
col -c(blue, green, red)[iris$Species]
plot3d(iris3, type=s, size=0.5, col=col, cex=2, box=FALSE)
plot3d( ellipse3d(cov, centre=mu, level=0.68), col=gray, alpha=0.2,  
add = TRUE)


axes - ellipse3d.axes(cov, centre=mu)

One thing I can't explain, compared to your example is why the my axes 
extend outside the ellipse,

whereas yours didn't.

One final remark-  I knew that axes %*% chol(cov) did not give the 
orthogonal PC axes I wanted,
but at least it gave me something on the right scale and location. But 
these axes also turn out to be
useful for visualizing multivariate scatter and statistical concepts.  
chol() gives the factorization of
cov that corresponds to the Gram-Schmidt orthogonalization of a data 
matrix -- orthogonal axes
in the order x1,  x2|x1,  x3|x1, x2, ..., and vector length and 
orientation in this coordinate system

correspond to Type I SS in linear models.
Thus, I could see generalizing my ellipse3d.axes function further to 
allow a type=c(pca, chol)

argument.

-Michael



Duncan Murdoch wrote:
That's easy, but it doesn't give you the principal axes of the 
ellipse.  Just use


axes %*% chol(cov)

If you start with a unit sphere, this will give you points on its 
surface, but not the ones you want.  For those you need the SVD or 
eigenvectors.  This looks like it does what you want:


axes - matrix(
c(0, 0, 0, # added origin
   0, 0, -1,   0, 0, 1,
   0, -1, 0,   0, 1,  0,
   -1, 0, 0,   1, 0, 0),  7, 3, byrow=TRUE)
axes - axes[c(1,2,1,3,1,4,1,5,1,6,1,7),]  # add the origin before each

cov - cov(trees)
eigen - eigen(cov)
shade3d(ellipse3d(cov, t=1, alpha=0.2, col='red'))
segments3d(axes %*% sqrt(diag(eigen$values)) %*% t(eigen$vectors))

Duncan Murdoch



--
Michael Friendly Email: friendly AT yorku DOT ca 
Professor, Psychology Dept.

York University  Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Streethttp://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT  M3J 1P3 CANADA

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


Re: [R] Bug in is ?

2008-09-24 Thread Keith Jewell
Have you tried is.integer(7.0) in S-Plus? (I have)
Do you think 7.0 is integer?

IMHO in R there is nothing to be fixed (in this regard) except your 
understanding.

This is a computer language, not English; intuition isn't reliable, so we 
have help pages.
is.integer(x) is not intended to indicate whether the value of x is a whole 
number, it indicates whether x has class integer.
All objects of class integer have whole number values, but not all objects 
with whole number values have class integer.
If you want to know whether a value is a whole number you could try (but 
there may be a better way, and beware of computer precision)
x == as.integer(x)

If you want a value to be stored in an object of class integer you'd 
better say so (using as.integer or L or ...), else how is R to know what you 
want? As Martin has pointed out, the system could guess based on the 
presence or absence of a decimal point; I share his opinion that this would 
be a bad thing.

Nuff said.

Keith J

[EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Thank you for all of you. Intuitively, 7 is an integer for people who 
 live in this planet. It is just very difficult for me to believe that  R 
 does not think 7 is an integer but 7L is.
 is.integer(7)  # R 2.7.2
 [1] FALSE
 Thus, based on Martin's comments, I try it again on the S-PLUS 8.0 and  it 
 shows
 is.integer(7)   # S-PLUS 8.0
 [1] T

 Hopefully, someday and someone will fix it therefore, R users don't  need 
 to use as.integer(7) to tell R that 7 is an integer.

 Thanks again
 Chunhao


 Quoting Martin Maechler [EMAIL PROTECTED]:

 KJ == Keith Jewell [EMAIL PROTECTED]
 on Wed, 24 Sep 2008 09:46:08 +0100 writes:

 KJ 7 is an integer, but it's also a real.
 KJ In R '?is'  and '?is.integer' are clear that you're testing   the 
 class(es) of
 KJ objects, not their values.
 KJ I can't comment on the relationship with S Programming

 I can:

 In S, and S-plus upto version 3.4,
 numeric constants such as '7' where  double as they are in R.

 Then in S-plus 5.1, they became integer,
 and there were tools so users could change all(!!) their S
 scripts to use '7.' instead of '7' in all places where numeric
 constants were seen, in order to keep behavior back compatible.

 R never made such a step (backwards ;-), and never will,
 notably since in R we had introduced the explicit long (= long
 integer) constants, using the 'L' suffix,
 i.e.,  7L is integer
 7 is double

 Note however that for both, is.numeric(.) is fulfilled and
 class(.) and mode(.) return numeric.
 Only typeof(.), storage.mode(.)  or  str(.)
 (or functions building on these) tell you the difference.

 Martin Maechler, ETH Zurich and R core team

 [And, yes, if you think further and are wondering:
  If we'd design things from scratch, we would only have S4
  classes and double would be a proper class and
  numeric would be the class union of {integer, double}
 ]


 KJ [EMAIL PROTECTED] wrote in message
 KJ news:[EMAIL PROTECTED]
  This is really bothering me! In the Dr. Venables and Dr. 
 Ripley's book  S
  Programming Page 105
  shows that
  c(is(10,integer),is(10.5,integer))
  [1] T F
 
  But I try this in R 2.7.2 it shows
  c(is(10,integer),is(10.5,integer))
  [1] FALSE FALSE
  Does anyone know what is going on here?
 
  Appreciate,
  Chunhao
 
  Quoting Yihui Xie [EMAIL PROTECTED]:
 
  Yes, everyone will agree 7 is an integer, but I don't think
  computers will agree too :-) R thinks it's a double-precision 
 number,
  except when you explicitly specify it as an integer (say,
  as.integer()).
 
  class(7)
  [1] numeric
 
  is.double(7)
  [1] TRUE
 
  Regards,
  Yihui
  --
  Yihui Xie [EMAIL PROTECTED]
  Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
  Mobile: +86-15810805877
  Homepage: http://www.yihui.name
  School of Statistics, Room 1037, Mingde Main Building,
  Renmin University of China, Beijing, 100872, China
 
 
 
  On Wed, Sep 24, 2008 at 12:40 PM,  [EMAIL PROTECTED] wrote:
  Hi R users
  Is there anything wrong in is function? (R 2.7.2)
  I believe that everyone will agree that 7 is an integer, 
 right? but
  why R
  shows 7 is not an integer
 
  is.integer(7)
 
  [1] FALSE
 
  is(7,integer)
 
  [1] FALSE
 
  is(as.integer(7), integer)
 
  [1] TRUE
 
  Thank you very much in advance
  Chunhao

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

 __
 R-help@r-project.org mailing list
 

[R] logistic regression model validation through bootstrapping

2008-09-24 Thread Van Dyke, Alison
I'm new to R and to validation of logistic regression models via bootstrapping. 
 I see that there are various approaches to bootstrapping, and I am wondering 
(1) which approach would be best for internal validation of predictive 
discrimination, (2) are there any good resources that could be recommended to 
explain the optimal approach, and (3) what packages in R should I use to 
achieve this approach.  Many thanks for the input.
 
Alison Van Dyke
MD/PhD Candidate, Class of 2011
Cancer Biology
Wayne State University
[EMAIL PROTECTED]
 

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


Re: [R] logistic regression model validation through bootstrapping

2008-09-24 Thread Frank E Harrell Jr

Van Dyke, Alison wrote:

I'm new to R and to validation of logistic regression models via bootstrapping. 
 I see that there are various approaches to bootstrapping, and I am wondering 
(1) which approach would be best for internal validation of predictive 
discrimination, (2) are there any good resources that could be recommended to 
explain the optimal approach, and (3) what packages in R should I use to 
achieve this approach.  Many thanks for the input.
 
Alison Van Dyke

MD/PhD Candidate, Class of 2011
Cancer Biology
Wayne State University
[EMAIL PROTECTED]
 



One possibility:
library(Design)
?validate.lrm

--
Frank E Harrell Jr   Professor and Chair   School of Medicine
 Department of Biostatistics   Vanderbilt University

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


Re: [R] rgl: ellipse3d with axes

2008-09-24 Thread Duncan Murdoch

On 24/09/2008 12:32 PM, Michael Friendly wrote:

Thanks Duncan ( others)

Here is a function that does what I want in this case, and tries to do 
it to work generally
with ellipse3d.  (Note that I reverse the order of centre and scale 
'cause I was bitten

by trying ellipse3d.axes(cov, mu))

# draw axes in the data ellipse computed by ellipse3d
ellipse3d.axes -
function (x, centre = c(0, 0, 0), scale = c(1, 1, 1), level = 0.95,
t = sqrt(qchisq(level, 3)), which = 1:3, ...)
{
stopifnot(is.matrix(x)) # should test for square, symmetric
cov - x[which, which]
eigen - eigen(cov)
# coordinate axes, (-1, 1), in pairs
axes - matrix(
  c(0, 0, -1,   0, 0, 1,
0, -1, 0,   0, 1, 0,
   -1, 0, 0,1, 0, 0),  6, 3, byrow=TRUE)

# transform to PC axes
axes - axes %*% sqrt(diag(eigen$values)) %*% t(eigen$vectors)
result - scale3d(axes, t, t, t)
if (!missing(scale))
if (length(scale) != 3) scale - rep(scale, length.out=3)
result - scale3d(result, scale[1], scale[2], scale[3])
if (!missing(centre))
if (length(centre) != 3) scale - rep(centre, length.out=3)
result - translate3d(result, centre[1], centre[2], centre[3])
segments3d(result, ...)
invisible(result)
}

Test case:

library(rgl)
data(iris)
iris3 - iris[,1:3]
cov - cov(iris3)
mu - mean(iris3)
col -c(blue, green, red)[iris$Species]
plot3d(iris3, type=s, size=0.5, col=col, cex=2, box=FALSE)
plot3d( ellipse3d(cov, centre=mu, level=0.68), col=gray, alpha=0.2,  
add = TRUE)


axes - ellipse3d.axes(cov, centre=mu)

One thing I can't explain, compared to your example is why the my axes 
extend outside the ellipse,

whereas yours didn't.


That's just because you specified level in the ellipse3d call, but not 
in the ellipes3d.axes call.


One thing that looks a little strange is that the PC axes don't appear 
to be orthogonal:  this is because the scaling is not the same on all 
coordinates.  It might look better doing the first plot as


plot3d(iris3, type=s, size=0.5, col=col, cex=2, box=FALSE, aspect=iso)

Duncan Murdoch



One final remark-  I knew that axes %*% chol(cov) did not give the 
orthogonal PC axes I wanted,
but at least it gave me something on the right scale and location. But 
these axes also turn out to be
useful for visualizing multivariate scatter and statistical concepts.  
chol() gives the factorization of
cov that corresponds to the Gram-Schmidt orthogonalization of a data 
matrix -- orthogonal axes
in the order x1,  x2|x1,  x3|x1, x2, ..., and vector length and 
orientation in this coordinate system

correspond to Type I SS in linear models.
Thus, I could see generalizing my ellipse3d.axes function further to 
allow a type=c(pca, chol)

argument.

-Michael



Duncan Murdoch wrote:
That's easy, but it doesn't give you the principal axes of the 
ellipse.  Just use


axes %*% chol(cov)

If you start with a unit sphere, this will give you points on its 
surface, but not the ones you want.  For those you need the SVD or 
eigenvectors.  This looks like it does what you want:


axes - matrix(
c(0, 0, 0, # added origin
   0, 0, -1,   0, 0, 1,
   0, -1, 0,   0, 1,  0,
   -1, 0, 0,   1, 0, 0),  7, 3, byrow=TRUE)
axes - axes[c(1,2,1,3,1,4,1,5,1,6,1,7),]  # add the origin before each

cov - cov(trees)
eigen - eigen(cov)
shade3d(ellipse3d(cov, t=1, alpha=0.2, col='red'))
segments3d(axes %*% sqrt(diag(eigen$values)) %*% t(eigen$vectors))

Duncan Murdoch





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


Re: [R] How to draw the graph of f(x,y) = x * y ?

2008-09-24 Thread Paul Smith
On Wed, Sep 24, 2008 at 4:14 PM, Farley, Robert [EMAIL PROTECTED] wrote:
 You could always try
  F(x,y) = f(x) + 0*y

 That is zero out the degenerate dimensions.  Of course you'll be
 plotting what is essentially a two dimensional object as if it were
 three dimensional.  The degeneracy in y means a 2-D curve will be
 extruded along the Y dimension.

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 On Behalf Of Paul Smith
 Sent: Wednesday, September 24, 2008 06:20
 To: [EMAIL PROTECTED]
 Subject: Re: [R] How to draw the graph of f(x,y) = x * y ?

 On Wed, Sep 24, 2008 at 4:05 AM, Ben Bolker [EMAIL PROTECTED] wrote:
 The function curve() draws the graph of functions from R to R. Is
 there some homologous function to curve() to draw functions from R^2
 to R?

  There is a curve3d function in the emdbook package on CRAN.

 Thanks, Ben and Robin. I think curve3d should be included in the base
 of R. It would help many users, I believe.

 I do not know whether curve3d could be extended to draw constant
 functions and functions like f(x,y) = x. With the current version, I
 get the following:

 curve3d(1)
 Error in curve3d(1) :
  'expr' must be a function or an expression containing 'x' and 'y'
 curve3d(x)
 Error in eval(expr, envir, enclos) : could not find function x


Thanks, Robert. your suggestion works to plot

f(x,y) = x + 0*y,

but it does not work in the case of

f(x,y) = 1 + 0*x +0*y.

Paul

__
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] Fortunes Candidates from Keith Jewell?

2008-09-24 Thread Bert Gunter
IMHO Keith Jewell has a couple of jewels here (sorry Keith -- couldn't
resist):  nice possible fortunes package candidates:

IMHO in R there is nothing to be fixed (in this regard) except your 
understanding.

 This is a computer language, not English; intuition isn't reliable, so we 
have help pages.

Cheers to all,

Bert Gunter

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


Re: [R] Bug in is ?

2008-09-24 Thread ctu

Hi Keith,
No doubt, 7.0 is integer in math. But if people can write 7 why people  
need to write 7.0 (I do not see any reason to do this). My point is  
that R maybe can do something like S-plus. No point to argue. don't  
you think so?

Thanks
Chunhao




Quoting Keith Jewell [EMAIL PROTECTED]:


Have you tried is.integer(7.0) in S-Plus? (I have)
Do you think 7.0 is integer?

IMHO in R there is nothing to be fixed (in this regard) except your
understanding.

This is a computer language, not English; intuition isn't reliable, so we
have help pages.
is.integer(x) is not intended to indicate whether the value of x is a whole
number, it indicates whether x has class integer.
All objects of class integer have whole number values, but not all objects
with whole number values have class integer.
If you want to know whether a value is a whole number you could try (but
there may be a better way, and beware of computer precision)
x == as.integer(x)

If you want a value to be stored in an object of class integer you'd
better say so (using as.integer or L or ...), else how is R to know what you
want? As Martin has pointed out, the system could guess based on the
presence or absence of a decimal point; I share his opinion that this would
be a bad thing.

Nuff said.

Keith J

[EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

Thank you for all of you. Intuitively, 7 is an integer for people who
live in this planet. It is just very difficult for me to believe that  R
does not think 7 is an integer but 7L is.

is.integer(7)  # R 2.7.2

[1] FALSE
Thus, based on Martin's comments, I try it again on the S-PLUS 8.0 and  it
shows

is.integer(7)   # S-PLUS 8.0

[1] T

Hopefully, someday and someone will fix it therefore, R users don't  need
to use as.integer(7) to tell R that 7 is an integer.

Thanks again
Chunhao


Quoting Martin Maechler [EMAIL PROTECTED]:


KJ == Keith Jewell [EMAIL PROTECTED]
on Wed, 24 Sep 2008 09:46:08 +0100 writes:


KJ 7 is an integer, but it's also a real.
KJ In R '?is'  and '?is.integer' are clear that you're testing   the
class(es) of
KJ objects, not their values.
KJ I can't comment on the relationship with S Programming

I can:

In S, and S-plus upto version 3.4,
numeric constants such as '7' where  double as they are in R.

Then in S-plus 5.1, they became integer,
and there were tools so users could change all(!!) their S
scripts to use '7.' instead of '7' in all places where numeric
constants were seen, in order to keep behavior back compatible.

R never made such a step (backwards ;-), and never will,
notably since in R we had introduced the explicit long (= long
integer) constants, using the 'L' suffix,
i.e.,  7L is integer
7 is double

Note however that for both, is.numeric(.) is fulfilled and
class(.) and mode(.) return numeric.
Only typeof(.), storage.mode(.)  or  str(.)
(or functions building on these) tell you the difference.

Martin Maechler, ETH Zurich and R core team

[And, yes, if you think further and are wondering:
 If we'd design things from scratch, we would only have S4
 classes and double would be a proper class and
 numeric would be the class union of {integer, double}
]


KJ [EMAIL PROTECTED] wrote in message
KJ news:[EMAIL PROTECTED]
 This is really bothering me! In the Dr. Venables and Dr.
Ripley's book  S
 Programming Page 105
 shows that
 c(is(10,integer),is(10.5,integer))
 [1] T F

 But I try this in R 2.7.2 it shows
 c(is(10,integer),is(10.5,integer))
 [1] FALSE FALSE
 Does anyone know what is going on here?

 Appreciate,
 Chunhao

 Quoting Yihui Xie [EMAIL PROTECTED]:

 Yes, everyone will agree 7 is an integer, but I don't think
 computers will agree too :-) R thinks it's a double-precision
number,
 except when you explicitly specify it as an integer (say,
 as.integer()).

 class(7)
 [1] numeric

 is.double(7)
 [1] TRUE

 Regards,
 Yihui
 --
 Yihui Xie [EMAIL PROTECTED]
 Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
 Mobile: +86-15810805877
 Homepage: http://www.yihui.name
 School of Statistics, Room 1037, Mingde Main Building,
 Renmin University of China, Beijing, 100872, China



 On Wed, Sep 24, 2008 at 12:40 PM,  [EMAIL PROTECTED] wrote:
 Hi R users
 Is there anything wrong in is function? (R 2.7.2)
 I believe that everyone will agree that 7 is an integer,
right? but
 why R
 shows 7 is not an integer

 is.integer(7)

 [1] FALSE

 is(7,integer)

 [1] FALSE

 is(as.integer(7), integer)

 [1] TRUE

 Thank you very much in advance
 Chunhao

KJ __
KJ R-help@r-project.org mailing list
KJ https://stat.ethz.ch/mailman/listinfo/r-help
KJ PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
KJ and provide 

Re: [R] Options for viewing / using results from lm

2008-09-24 Thread Greg Snow
I don't remember which version View was added in, but it was more recent than 
2.4.1.  I would suggest upgrading (2.4.1 is ancient in R terms).

You can get something similar with:

 invisible(edit(mydata))

But you will have to close the window to continue with R (View lets you look at 
the data (but not edit it), while still working at the command prompt).

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
801.408.8111

From: Michael Just [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 24, 2008 1:03 AM
To: Greg Snow
Cc: r-help@r-project.org; [EMAIL PROTECTED]
Subject: Re: [R] Options for viewing / using results from lm

Hello,
Thanks for the response.

However, I have this problem with view.

 View(fit1)
Error: could not find function View

I have R 2.4.1 and even tried loading 'utils'.

As for saving residuals in a spreadsheet I used something like this:

res.fit1-fit1$residuals
res.fit2-fit2$residuals

write.csv(res.fit1, file=res.fit1.csv)
write.csv(res.fit2, file=res.fit2.csv)

Thanks,
M Just

On Tue, Sep 23, 2008 at 9:07 PM, Greg Snow [EMAIL PROTECTED]mailto:[EMAIL 
PROTECTED] wrote:
The View function (note the uppercase V) is in the utils package, one of the 
standard ones that loads automatically.

From: Michael Just [EMAIL PROTECTED]mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 23, 2008 2:49 PM
To: Greg Snow
Cc: r-help@r-project.orgmailto:r-help@r-project.org; [EMAIL 
PROTECTED]mailto:[EMAIL PROTECTED]

Subject: Re: [R] Options for viewing / using results from lm

Greg,
Thanks for the pseudocode and cbind suggestions I think these should be quite 
helpful. What package is the function 'view' in? As for exporting elsewhere, 
basically I would to have the values of residuals saved in a spreadsheet in 
addition to any visualizations created within R.

Thanks,
M Just
On Tue, Sep 23, 2008 at 3:26 PM, Greg Snow [EMAIL PROTECTED]mailto:[EMAIL 
PROTECTED] wrote:
You can do things like this pseudocode:

 fit1 - lm( y ~ x1, data=mydata )
 fit2 - lm( y ~ x2, data=mydata )
 fit3 - lm( y ~ x1*x2, data=mydata )
...

 mydata$r1 - resid(fit1)
 mydata$r2 - resid(fit2)
 mydata$r3 - resid(fit3)

Or

 mydata - cbind(mydata, r1=resid(fit1), r2=resid(fit2), ...

To view the data in a spreadsheet like table:

 View(mydata)

And scroll over to the r columns, using indexing or the subset function can 
reorder the columns to make this easier.

A simple plot:

 pairs( mydata[ , paste('r',1:10, sep='')], col=c('red','green','blue')[ 
 mydata$g1 ],
+ panel=panel.smooth )

Or there are various other ways to explore the data within R.  If you really 
feel the need to use another tool, do like the above, then use write.table to 
export it to a csv file or paste it to a spreadsheet.   There is also the 
rggobi package which will automate the exporting to the ggobi program which 
allows a lot more visualization options.

Hope this helps,


--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]mailto:[EMAIL PROTECTED]
801.408.8111


 -Original Message-
 From: [EMAIL PROTECTED]mailto:[EMAIL PROTECTED] [mailto:[EMAIL 
 PROTECTED]mailto:[EMAIL PROTECTED]
 project.orghttp://project.org] On Behalf Of Michael Just
 Sent: Tuesday, September 23, 2008 2:06 PM
 To: r-help@r-project.orgmailto:r-help@r-project.org
 Cc: [EMAIL PROTECTED]mailto:[EMAIL PROTECTED]
 Subject: Re: [R] Options for viewing / using results from lm

 Hello,

 Why do you think it is better done in another program? Keeping it in R
 saves you from the exporting, which you say you are having trouble
 with.

 I think it might be better for viewing capabilities. If I had columns
 of
 residuals right next to each other I could spot differences amongst
 locations. Right? If I can take the residual values and put them back
 into
 my main data file I can then have the options to use grouping values
 that
 exist there. (Like I asked here:
 http://tolstoy.newcastle.edu.au/R/e5/help/08/09/2186.html)

  Q2: How can I take the residuals and create an object(s) for further
 http://tolstoy.newcastle.edu.au/R/e5/help/08/09/2259.html#2265qlink2*
 analysis.
 *
 **

 See ?residuals.

 Try the following:

 x - sample(1:20, 100, replace=TRUE)
 y - rnorm(100)
 fit.lm - lm(y ~ x)
 plot(residuals(fit.lm))
 plot(x,residuals(fit.lm))


 When I was thinking further analysis, for example, could I take the
 residuals for all metrics in one extent and compare them to all
 residuals
 for all metrics in another extent? Even though the were created with 16
 different models?

 In 'plot(residuals(fit.lm))' what is the index 'counting'?


 Thank you kindly for you $0.25,

 Cheers,

 M Just

 [[alternative HTML version deleted]]

 __
 R-help@r-project.orgmailto: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-
 

[R] lattice xyplot symbols instead of colors and legend matching plot symbols or colors

2008-09-24 Thread stephen sefick
I would like to use the data below where the plots are close to what I
want.  Instead of color I would like to use different symbols, and
have the symbols in the legend match the graphs.  I am also going to
add a regression line to these I know about the type=r (which is
fine for these particular graphs) argument, but it fits the subsets
instead of the entire data set-- should I use a list of regression
fits in the order of the arguments in an abline panel to do this?  Ok,
I think that is all for right now.  If I need to clarify please tell
me.
thanks

f - structure(list(GPP = c(1.213695235, 3.817313822, 1.267930498,
10.45692825, 3.268295623, 3.505286001, 4.468225245, 0.915653726,
1.635617261, 3.726133898, 1.363453706, 13.99650967, 0.417618143,
0.741080504, 0.412440872, 3.515743675, 8.248491445, 1.537773727,
3.249103284, 0.768531626, 2.633107621, 3.113199095, 0.773824094,
0.680150068, 0.026385752, 0.369310858, 8.049276658, 7.487378383,
0.763580377, 0.333244629, 5.475999014, 9.235631398), TSS = c(2.8,
8.4, 11, 1.3, 4.2, 2, 3.4, 14, 8.2, 3.1, 1.4, 0.9, 6.1, 9.2,
11, 1.2, 1.3, 11, 8.5, 13, 4.4, 1.4, 2.1, 25, 9.3, 6.1, 1.6,
1.5, 24, 9.6, 1.8, 1.4), Iron = c(0.74, 0.54, 0.23, 0.13, 0.4,
0.13, 0.15, 0.58, 0.38, 0.22, 0.13, 0.07, 0.32, 0.26, 0.86, 0.13,
0.09, 0.58, 0.35, 0.59, 0.33, 0.19, 0.21, 0.81, 0.34, 0.31, 0.07,
0.16, 0.54, 0.36, 0.13, 0.07), TIN.TP = c(3.117647059, 2.736842105,
2.25, 22, 3, 2.428571429, 6.428571429, NA, NA, 2.384615385, 3,
NA, 3.25, NA, 3.16667, 9, 23, 3.5, 11, 3.91667, 3.4,
3.4, 8.75, 2.7, 3.58333, 2.75, 17, NA, 2.9,
2.5, 2.5, 11), RiverMile = c(148L, 179L, 185L, 202L,
179L, 185L, 190L, 119L, 148L, 179L, 185L, 202L, 119L, 202L, 148L,
190L, 202L, 148L, 202L, 119L, 179L, 185L, 190L, 61L, 119L, 148L,
202L, 202L, 119L, 148L, 185L, 202L)), .Names = c(GPP, TSS,
Iron, TIN.TP, RiverMile), class = data.frame, row.names = c(1L,
2L, 3L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 15L, 16L, 19L,
22L, 23L, 30L, 34L, 36L, 37L, 38L, 39L, 43L, 44L, 45L, 46L, 47L,
49L, 50L, 51L, 52L))

xyplot(GPP~(1/Iron)+(1/TSS)+TIN.TP, groups=RiverMile,data=f,
scales=list(relation=free), pch=20, auto.key=TRUE)

-- 
Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods. We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

__
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] possible interesting R projects for undergrads

2008-09-24 Thread Erin Hodgess
Dear R People:

I finally (Yay!) got R installed in a classroom!

Anyhow, I have a respectful request, please:  could anyone recommend
some nice undergrad projects in R, please?

This is in a statistical computation class; first time being run.

Thanks,
Erin


-- 
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: [EMAIL PROTECTED]

__
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] Add title in sink output and possibility of plot-like output for text

2008-09-24 Thread Michael Just
Hello,
I have been using sink to create text file outputs.

sink(summ_model1and2.txt)
 summary(model1)
 summary(model2)
 sink()

Q1: Is there a way I could add a line of the text above the summary to act
like a title?

Also, I have been using the following to save plots from the lm function:

 pdf(small.bin.ENN_MN_withQ.pdf)
 par(mfrow = c(2, 2), oma = c(0, 0, 2, 0))
 plot(small.bin.ENN_MN)
 plot(small.bin.ENN_MN.q)
 dev.off()

Q2: Is there a way I could save the output from 'summary' into a c(2,2)
window like I do with the plots?

Thank you kindly,
Cheers,
M Just

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


Re: [R] Generating series of distributions with the same skewness and different kurtosis or with same kurtosis and different skewness?

2008-09-24 Thread Greg Snow
And here is one way of using JohnsonFit to display how a distribution changes 
with changes in the moments:

library(TeachingDemos)
library(SuppDists)

tmpfun - function(m1=0,m2=1,m3=-0.2,m4=3.7, xmin=-3, xmax=3){
parms - JohnsonFit( c(m1,m2,m3,m4), 'use')
plot(function(x) dJohnson(x,parms), xmin, xmax)
}

tmplst - list( Parameters=list(
m1=list('slider', init=0, from=-1, to=1, resolution=0.1),
m2=list('slider', init=1, from=0 , to=3, resolution=0.1),
m3=list('slider', init=-0.2, from=-1, to=1, resolution=0.1),
m4=list('slider', init=3.7, from=0 , to=10, resolution=0.5)),
xmin=list('numentry', init=-3, width=5),
xmax=list('numentry', init=3 , width=5) )

tkexamp( tmpfun, tmplst, plotloc='left' )


of course assuming that you have SuppDists and TeachingDemos packages 
installed, play around with this (and possibly change parameters and/or limits 
in tmplst) before demoing it as there are many combinations of the parameters 
that cause errors.


--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
801.408.8111


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 project.org] On Behalf Of Gabor Grothendieck
 Sent: Wednesday, September 24, 2008 6:29 AM
 To: zhijie zhang
 Cc: [EMAIL PROTECTED]
 Subject: Re: [R] Generating series of distributions with the same
 skewness and different kurtosis or with same kurtosis and different
 skewness?

 Check out JohnsonFit in SuppDists.

 On Tue, Sep 23, 2008 at 10:59 AM, zhijie zhang [EMAIL PROTECTED]
 wrote:
  Dear R users,
   I hope to explain the concepts of skewness and kurtosis by
 generating
  series of distributions with same skewness and different kurtosis or
 with
  same kurtosis and different skewness, but it seems that i cannot find
 the
  right functions.
   I have searched the mailing list, but no answers were found.
   Is it possible to do that in R? Which function could be used?
   Thanks a lot.
 
  --
  With Kind Regards,
 
  oooO:
  (..):
  :\.(:::Oooo::
  ::\_)::(..)::
  :::)./:::
  ::(_/
  :
 
 [**
 *]
  Zhi Jie,Zhang ,PHD
  Tel:+86-21-54237149
  Dept. of Epidemiology,School of Public Health,Fudan University
  Address:No. 138 Yi Xue Yuan Road,Shanghai,China
  Postcode:200032
  Email:[EMAIL PROTECTED] [EMAIL PROTECTED]
  Website: www.statABC.com
 
 [**
 *]
  oooO:
  (..):
  :\.(:::Oooo::
  ::\_)::(..)::
  :::)./:::
  ::(_/
  :
 
 [[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.

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


Re: [R] Proper power computation for one-sided binomial tests.

2008-09-24 Thread Collin Lynch
Thank you Peter.  That is incredibly helpfyul, and much much smaller!

Best,
Collin.

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


Re: [R] Modifying output to Google Docs

2008-09-24 Thread Duncan Temple Lang


The command line app is fine, although there are some potential security
issues or annoyances with a smooth work flow.

But it would be more flexible and powerful to do it directly in R.
And we don't need to know or program in C. The RCurl (https, getForm() 
and postForm()) and XML packages provide all we need.


It took a couple of hours of reading the Google documentation,
designing and writing the R code and _testing_, but in relatively
few lines of code, the RGoogleDocs package enables an R user
to query, delete, download and upload documents to her Google account.
This was one of the motivations for developing the XML and RCurl 
packages, i.e. to be able to quickly develop utilities in R to

communicate with Web apps.  So Ajay's suggestion was a nice
exercise to see if the packages do make it easy.

The package currently has no Rd files, but there is a brief user's 
guide. The package is available from

http://www.omegahat.org/RGoogleDocs

For binary files, you will want to grab a beta-version of RCurl
at http://www.omegahat.org/Prerelease/RCurl_0.91-0.tar.gz

 D.

Barry Rowlingson wrote:

2008/9/23 Ajay ohri [EMAIL PROTECTED]:


By outputting PDF directly to a Google Doc, it becomes light and portable
for people to view and collaborate on projects  in different parts of the
world.
If you extend this to Google spreadsheets this functionality is especially
useful for financial reporting or marketing metrics reports or collaborative
presentations to be made.


 There's command-line tools (written in python, but probably in other
languages elsewhere) to do this:

http://code.google.com/p/gdatacopier/

 their example is:

./gdoc-cp.py --username [EMAIL PROTECTED] --import --local
files/doc.txt --title New Document

 So all you need to do is call that from R with system() and wrap it
up in some R functions.

Barry

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


Re: [R] Modifying output to Google Docs

2008-09-24 Thread Ajay ohri
Wow.
Dont you get to name it on me or something  (like the RPackageGoogleAjayDoc
?) Just kidding
This is fabulous and the reason this community is so innovative

Now if only someone can create a package for me to use R from Amazon EC2 and
be free of the  damn RAM problem forever to
create it as a SaaS.

Regards,

Ajay
On Wed, Sep 24, 2008 at 11:29 PM, Duncan Temple Lang 
[EMAIL PROTECTED] wrote:


 The command line app is fine, although there are some potential security
 issues or annoyances with a smooth work flow.

 But it would be more flexible and powerful to do it directly in R.
 And we don't need to know or program in C. The RCurl (https, getForm() and
 postForm()) and XML packages provide all we need.

 It took a couple of hours of reading the Google documentation,
 designing and writing the R code and _testing_, but in relatively
 few lines of code, the RGoogleDocs package enables an R user
 to query, delete, download and upload documents to her Google account.
 This was one of the motivations for developing the XML and RCurl packages,
 i.e. to be able to quickly develop utilities in R to
 communicate with Web apps.  So Ajay's suggestion was a nice
 exercise to see if the packages do make it easy.

 The package currently has no Rd files, but there is a brief user's guide.
 The package is available from
http://www.omegahat.org/RGoogleDocs

 For binary files, you will want to grab a beta-version of RCurl
 at http://www.omegahat.org/Prerelease/RCurl_0.91-0.tar.gz

  D.

 Barry Rowlingson wrote:

 2008/9/23 Ajay ohri [EMAIL PROTECTED]:

  By outputting PDF directly to a Google Doc, it becomes light and portable
 for people to view and collaborate on projects  in different parts of the
 world.
 If you extend this to Google spreadsheets this functionality is
 especially
 useful for financial reporting or marketing metrics reports or
 collaborative
 presentations to be made.


  There's command-line tools (written in python, but probably in other
 languages elsewhere) to do this:

 http://code.google.com/p/gdatacopier/

  their example is:

 ./gdoc-cp.py --username [EMAIL PROTECTED] --import --local
 files/doc.txt --title New Document

  So all you need to do is call that from R with system() and wrap it
 up in some R functions.

 Barry

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




-- 
Regards,

Ajay Ohri
http://tinyurl.com/liajayohri

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


Re: [R] Proper power computation for one-sided binomial tests.

2008-09-24 Thread Johannes Hüsing


Am 23.09.2008 um 23:57 schrieb Peter Dalgaard:

For this kind of problem I'd go directly for the binomial 
distribution. If the actual probability is 0, this is essentially 
deterministic and you can look at


 binom.test(0,99,p=.03, alt=less)



This means that you don't sample from the p=.03 population?
Note that there is a 5 per cent chance to have 0 failures in 99
trials with p=.03.

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


Re: [R] Why horizontal bars instead of a line

2008-09-24 Thread Greg Snow
Remember that computers are not as smart as you.  Some smart people have 
written instructions for the computer on what to do in certain cases, but they 
can't anticipate everything, so when you tell the computer to do something that 
was different from what is anticipated, it either gives an error or the results 
of a wrong guess.

In your case, since GrSe has a G in the front and your data is probably in a 
data frame, the plot function sees a factor (generally what gets created 
automatically when characters are seen) and passes the data to plot.factor 
which plots boxplots (and with 1 point per year, the 5 number summary for the 
boxplot gives all the same value, hence the horizontal line).

What you probably want to do is to plot your clone data against a numerical 
representation of the year (without the G), but suppress the axis labels and 
add the labels yourself (with the G), see ?axis for detail on doing this.

Hope this helps,

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
801.408.8111


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 project.org] On Behalf Of Schreiber, Stefan
 Sent: Wednesday, September 24, 2008 9:28 AM
 To: r-help@r-project.org
 Subject: [R] Why horizontal bars instead of a line

 Hey list!


 It looks simple, though it's not possible for me to plot the following
 properly:

 (some made-up data)

 GrSeClone1  Clone2  Clone3  Clone4  Clone...
 G1999   2   3   6   5
 G2000   2   5   7   4
 G2001   5   3   7   3
 G2002   4   5   8   3
 G...



 GrSe=Growing Season.

 I've read the file as x and then tried:plot(x$GrSe,x$Clone1)

 The output is 4 horizontal bars. Even if I write
 plot(x$GrSe,x$Clone1,type=n) R is still plotting!
 I figured already that if I delete the G in front of the years it'll
 work, however, I'd like to keep the G.
 Is that possible?

 Hope it is an appropriate question for the list.

 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.


Re: [R] lattice xyplot symbols instead of colors and legend matching plot symbols or colors

2008-09-24 Thread stephen sefick
xyplot(GPP~(1/Iron)+(1/TSS)+TIN.TP, groups=RiverMile,data=f,
scales=list(relation=free), par.settings = list(
  superpose.symbol = list(
pch = c(1:7),
fill = c(red, blue),
col = black)), auto.key=TRUE,
panel=function(...){
panel.xyplot(...)
panel.abline(lm(GPP~I(1/Iron), data=f))
panel.abline(lm(GPP~I(1/TSS), data=f))
panel.abline(lm(GPP~I(TIN.TP), data=f))
})

now how do I get the panel abline to only plot in the appropriate
panel GPP~1/Iron and the regression line for this panel only in that
panel
thanks

On Wed, Sep 24, 2008 at 1:15 PM, stephen sefick [EMAIL PROTECTED] wrote:
 I would like to use the data below where the plots are close to what I
 want.  Instead of color I would like to use different symbols, and
 have the symbols in the legend match the graphs.  I am also going to
 add a regression line to these I know about the type=r (which is
 fine for these particular graphs) argument, but it fits the subsets
 instead of the entire data set-- should I use a list of regression
 fits in the order of the arguments in an abline panel to do this?  Ok,
 I think that is all for right now.  If I need to clarify please tell
 me.
 thanks

 f - structure(list(GPP = c(1.213695235, 3.817313822, 1.267930498,
 10.45692825, 3.268295623, 3.505286001, 4.468225245, 0.915653726,
 1.635617261, 3.726133898, 1.363453706, 13.99650967, 0.417618143,
 0.741080504, 0.412440872, 3.515743675, 8.248491445, 1.537773727,
 3.249103284, 0.768531626, 2.633107621, 3.113199095, 0.773824094,
 0.680150068, 0.026385752, 0.369310858, 8.049276658, 7.487378383,
 0.763580377, 0.333244629, 5.475999014, 9.235631398), TSS = c(2.8,
 8.4, 11, 1.3, 4.2, 2, 3.4, 14, 8.2, 3.1, 1.4, 0.9, 6.1, 9.2,
 11, 1.2, 1.3, 11, 8.5, 13, 4.4, 1.4, 2.1, 25, 9.3, 6.1, 1.6,
 1.5, 24, 9.6, 1.8, 1.4), Iron = c(0.74, 0.54, 0.23, 0.13, 0.4,
 0.13, 0.15, 0.58, 0.38, 0.22, 0.13, 0.07, 0.32, 0.26, 0.86, 0.13,
 0.09, 0.58, 0.35, 0.59, 0.33, 0.19, 0.21, 0.81, 0.34, 0.31, 0.07,
 0.16, 0.54, 0.36, 0.13, 0.07), TIN.TP = c(3.117647059, 2.736842105,
 2.25, 22, 3, 2.428571429, 6.428571429, NA, NA, 2.384615385, 3,
 NA, 3.25, NA, 3.16667, 9, 23, 3.5, 11, 3.91667, 3.4,
 3.4, 8.75, 2.7, 3.58333, 2.75, 17, NA, 2.9,
 2.5, 2.5, 11), RiverMile = c(148L, 179L, 185L, 202L,
 179L, 185L, 190L, 119L, 148L, 179L, 185L, 202L, 119L, 202L, 148L,
 190L, 202L, 148L, 202L, 119L, 179L, 185L, 190L, 61L, 119L, 148L,
 202L, 202L, 119L, 148L, 185L, 202L)), .Names = c(GPP, TSS,
 Iron, TIN.TP, RiverMile), class = data.frame, row.names = c(1L,
 2L, 3L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 15L, 16L, 19L,
 22L, 23L, 30L, 34L, 36L, 37L, 38L, 39L, 43L, 44L, 45L, 46L, 47L,
 49L, 50L, 51L, 52L))

 xyplot(GPP~(1/Iron)+(1/TSS)+TIN.TP, groups=RiverMile,data=f,
 scales=list(relation=free), pch=20, auto.key=TRUE)

 --
 Stephen Sefick
 Research Scientist
 Southeastern Natural Sciences Academy

 Let's not spend our time and resources thinking about things that are
 so little or so large that all they really do for us is puff us up and
 make us feel like gods. We are mammals, and have not exhausted the
 annoying little problems of being mammals.

-K. Mullis




-- 
Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods. We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

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


  1   2   >