[R] problem with working on R-Project from C#

2009-01-07 Thread venkata kirankumar
Hi,
i got a problem with initialising R-Project from C#
in this i m sending what are all the code line I had been written and the
error where i got



sc1 = new STATCONNECTORSRVLib.StatConnector();

sc1.Init(R);

and error at
SCN_E_INVALIDINTERPRETERVERSION -2147221487 0x80040011


can any one suggest how can i resolve it


thanks  regards;
kiran

[[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] Sweave in LATEX

2009-01-07 Thread Mr Derik


I have solved the problem. It seems that the \Sexpr{} sequence is processed
by R rather than latex. If you use:

Sweave(Sweave-test-1.Rnw, syntax=SweaveSyntaxNoweb)

When processing in R then this is handled in the appropriate way.



Duncan Murdoch-2 wrote:
 
 On 1/6/2009 6:44 AM, Mr Derik wrote:
 Hello
 
 I have been setting up my computer to run Sweave. I have got the whole
 thing
 working on example files, except that my MikTex returns an Undefined
 Control Sequence error for \Sexpr and my output file contains verbatim
 code
 sequences at the apropriate point in the text rather than the R output.
 The
 rest of the output file is fine with tables, R code sequences and figures
 in
 the right place and correctly formatted. I have searched everywhere for
 advice on what to do about this, any ideas would be gratefully received. 
 
 
 You need to give more details.  Which version of R are you running?  How 
 are you running Sweave?  Are you including \usepackage{Sweave} in your 
 Sweave document?  (This is not always necessary, but is usually a good 
 idea).
 
 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.
 
 

-- 
View this message in context: 
http://www.nabble.com/Sweave-in-LATEX-tp21308911p21326922.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] request for StatConnecter oriented problem

2009-01-07 Thread venkata kirankumar
hi, i got a problem with initialising R-Project from C#
in this i m sending what are all the code line I had been written and the
error where i got



sc1 = new STATCONNECTORSRVLib.StatConnector();

sc1.Init(R);

and error at
SCN_E_INVALIDINTERPRETERVERSION -2147221487 0x80040011


can any one suggest how can i resolve it


thanks  regards;
kiran

[[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] Two Noobie questions

2009-01-07 Thread Simon Pickett

Allen,

I would suggest reading about the str() function. It's great for getting 
inside model outputs and seeing how they are constructed so you can 
extract all the specific calculations you want.


Its a bit fiddly to get used to but there are plenty of examples on this 
forum.


Hope this helps.

Simon.


- Original Message - 
From: AllenL allen.laroc...@gmail.com

To: r-help@r-project.org
Sent: Tuesday, January 06, 2009 7:47 PM
Subject: Re: [R] Two Noobie questions




Thanks for your help!

I combined the above two to get the following, which seems to work (if
somewhat inelegant):

int.List-unlist(lapply(lmList, function(x) {coef(x)[1]}),use.names=FALSE)
lmList is my list of lm objects.
-Allen





David Winsemius wrote:



On Jan 6, 2009, at 1:50 PM, AllenL wrote:



1. I have a list of lm (linear model) objects. Is it possible to
select,
through subscripts, a particular element (say, the intercept) from
all the
models? I've tried something like this:


?coef
if your list of models is ml, then perhaps something like this
partially tested idea:

lapply(ml, function(x) coef(x)[1] )

This is what I get using that formulation an available logistic model:

  coef(lr.TC_HDL_BMI)[1]
Intercept
-6.132448





List[[1:length(list)]][1]
All members of the list are similar. My goal is to have a list of the
intercepts and lists of other estimated parameters. Is it better to
convert
to a matrix? How to do this?

2. Connected to this, how do I convert from a list back to a vector?
This
problem arose from using split to split a vector by a factor, then
selecting a subset of this (ie. length10), leaving me with subset
list of
my original. Unsplit(newList, factor) doesn't work, presumably due
to my
removal of some values. Thoughts?


?unlist

  ll - list(1,2,3,4)
  ll
[[1]]
[1] 1

[[2]]
[1] 2

[[3]]
[1] 3

[[4]]
[1] 4

  unlist(ll)
[1] 1 2 3 4
  str(unlist(ll))
  num [1:4] 1 2 3 4
  is.vector(unlist(ll))
[1] TRUE

--
David Winsemius



Thanks!
-Allen



--
View this message in context:
http://www.nabble.com/Two-Noobie-questions-tp21316554p21316554.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-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.




--
View this message in context: 
http://www.nabble.com/Two-Noobie-questions-tp21316554p21317630.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-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] Importing data from SPSS with Arabic encoding

2009-01-07 Thread Florent Bresson
Dear R-users,

I'm facing a problem with the import of data in R. I have a sav file that, I 
presume, uses some Arabic encoding (but I don't know which one) and I would 
like to read it with R. When I use the function read.spss (I also tried 
spss.get(Hmisc)), I get the following message:
 read.spss(Hhld.sav)
Erreur dans read.spss(Hhld.sav) :
  erreur à la lecture de l'entête du fichier système
De plus : Warning message:
In read.spss(Hhld.sav) :
  Hhld.sav : position 0 : le nom de la variable commence avec un caractère non 
autorisé

The second and last lines can be translated into error reading system-file 
header and Hhld.sav: position 0: Variable name begins with invalid 
character. That's why I suppose it is a problem with the encoding. Does 
someone has an idea of the solution to my problem?

Thanks

Florent Bresson




__
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] Importing data from SPSS with Arabic encoding

2009-01-07 Thread Prof Brian Ripley

On Wed, 7 Jan 2009, Florent Bresson wrote:


Dear R-users,

I'm facing a problem with the import of data in R. I have a sav file that, I 
presume, uses some Arabic encoding (but I don't know which one) and I would 
like to read it with R. When I use the function read.spss (I also tried 
spss.get(Hmisc)), I get the following message:

read.spss(Hhld.sav)

Erreur dans read.spss(Hhld.sav) :
 erreur à la lecture de l'entête du fichier système
De plus : Warning message:
In read.spss(Hhld.sav) :
 Hhld.sav : position 0 : le nom de la variable commence avec un caractère non 
autorisé

The second and last lines can be translated into error reading 
system-file header and Hhld.sav: position 0: Variable name begins with 
invalid character. That's why I suppose it is a problem with the 
encoding. Does someone has an idea of the solution to my problem?


1) Please read the posting guide and supply the details you were asked to 
supply. E.g. what OS, what locale, what version of foreigh?


2) Read the help for read.spss, especially its 'reencode' argument. You 
will need to know what the encoding was, but most likely the output before 
the error which (you did not show us) told you (and would have told us).


BTW, if you start R with LANGUAGE=en set, you will get English messages to 
quote here.



PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
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] Large Dataset

2009-01-07 Thread Thomas Lumley


There are several approaches to analyzing data sets much larger than memory, 
and the best approach does depend on the problem. It's certainly possible to 
process gigabytes of data on a 32-bit R system - the examples I've worked on 
are whole-genome association studies with 10^5-10^6 variables and 10^3-10^4 
observations. Other people have worked with much larger data sets.

Some approaches are:

- incremental reading using a connection to the file, reading a few thousand 
lines at a time.  The statistics Edwin wants can all be computed in a single 
pass through the data. This is what the biglm package does for linear models.

- storing the data in a relational database and then either
   *) using SQL commands (the mean, min, max are all built in to SQL) to do
   most of the work and just reading results (or interim results) into R
   *) reading appropriate chunks of the data into R and doing the computations
   there

- storing the data in netCDF or HDF5 formats and loading chunks into R.  These 
are less flexible than relational databases but more efficient for certain 
sorts of subsets.

- memory-mapping the data file (the ff package does this) to read sections of 
data. I haven't tried this, so I'm not sort where its advantages and 
disadvantages are.


The bigmemory package does not address quite the same problem.  It deals with 
objects that fit in memory, but are large enough that copying them is a bad 
idea, and it also deals with sharing between processors.

  -thomas





On Tue, 6 Jan 2009, Simon Pickett wrote:


Hi,

I am not very knowledgeable about this kind of stuff but my guess is that if 
you have a fairly slow computer and massive data sets there isnt alot you can 
do except get a better computer, buy more RAM or use something like SAS 
instead?


Hopefully someone else will chip in Edwin, best of luck.

Simon.


- Original Message - From: Edwin Sendjaja edw...@web.de
To: Simon Pickett simon.pick...@bto.org
Cc: r-help@r-project.org
Sent: Tuesday, January 06, 2009 2:53 PM
Subject: Re: [R] Large Dataset



Hi Simon,

My RAM is only 3.2 GB (actually it should be 4 GB, but my Motherboard doesnt
support it.

R use almost of all my RAM and half of my swap. I think memory.limit will 
not

solve my problem.  It seems that I need  RAM.

Unfortunately, I can't buy more RAM.

Why R is slow reading big data set?


Edwin


Only a couple of weeks ago I had to deal with this.

adjust the memory limit as follows, although you might not want 4000, that
is quite high

memory.limit(size = 4000)

Simon.

- Original Message -
From: Edwin Sendjaja edw...@web.de
To: Simon Pickett simon.pick...@bto.org
Cc: r-help@r-project.org
Sent: Tuesday, January 06, 2009 12:24 PM
Subject: Re: [R] Large Dataset

 Hi Simon,

 Thank for your reply.
 I have read ?Memory but I dont understand how to use. I am not sure if
 that
 can solve my problem. Can you tell me more detail?

 Thanks,

 Edwin

 type

 ?memory

 into R and that will explain what to do...

 S
 - Original Message -
 From: Edwin Sendjaja edw...@web.de
 To: r-help@r-project.org
 Sent: Tuesday, January 06, 2009 11:41 AM
 Subject: [R] Large Dataset

  Hi alI,
 
  I  have a 3.1 GB Dataset ( with  11 coloumns and lots data in int  
 and

  string).
  If I use read.table; it takes very long. It seems that my RAM is not
  big
  enough (overload) I have 3.2 RAM and  7GB SWAP, 64 Bit Ubuntu.
 
  Is there a best sultion to read a large data R? I have seen, that
  people
  suggest to use bigmemory package, ff. But it seems very complicated.
  I dont
  know how to start with that packages.
 
  i have tried to use bigmemory. But I got some kind of errors.  Then 
  I

  gave up.
 
 
  can someone give me an simple example how ot use ff or bigmemory?or
  maybe
  re
  better sollution?
 
 
 
  Thank you in advance,
 
 
  Edwin
 
  __
  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.



Thomas Lumley   Assoc. Professor, Biostatistics
tlum...@u.washington.eduUniversity 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.


[R] Re : Importing data from SPSS with Arabic encoding

2009-01-07 Thread Florent Bresson
Thanks Brian for your help. I am sorry, I should have red the help page more 
carefully. I am working on Kubuntu 8.04 with R 2.8.0. The problem with the file 
is that I do not know what the encoding is. I do not understand what you mean 
with [...] but most likely the output before the error which (you did not show 
us) told you (and would have told us) since I just ran R, loaded the foreign 
package and then tried to get the data with the function read.spss().

I have just seen that I can get a list of the supported encodings using the 
function iconvlist(). Would it be possible to define some function to test 
which encodings fit my file?

Thanks in advance



- Message d'origine 
De : Prof Brian Ripley rip...@stats.ox.ac.uk
À : Florent Bresson f_bres...@yahoo.fr
Cc : r-h...@stat.math.ethz.ch
Envoyé le : Mercredi, 7 Janvier 2009, 10h49mn 06s
Objet : Re: [R] Importing data from SPSS with Arabic encoding

On Wed, 7 Jan 2009, Florent Bresson wrote:

 Dear R-users,
 
 I'm facing a problem with the import of data in R. I have a sav file that, I 
 presume, uses some Arabic encoding (but I don't know which one) and I would 
 like to read it with R. When I use the function read.spss (I also tried 
 spss.get(Hmisc)), I get the following message:
 read.spss(Hhld.sav)
 Erreur dans read.spss(Hhld.sav) :
  erreur à la lecture de l'entête du fichier système
 De plus : Warning message:
 In read.spss(Hhld.sav) :
  Hhld.sav : position 0 : le nom de la variable commence avec un caractère non 
 autorisé
 
 The second and last lines can be translated into error reading system-file 
 header and Hhld.sav: position 0: Variable name begins with invalid 
 character. That's why I suppose it is a problem with the encoding. Does 
 someone has an idea of the solution to my problem?

1) Please read the posting guide and supply the details you were asked to 
supply. E.g. what OS, what locale, what version of foreigh?

2) Read the help for read.spss, especially its 'reencode' argument. You will 
need to know what the encoding was, but most likely the output before the error 
which (you did not show us) told you (and would have told us).

BTW, if you start R with LANGUAGE=en set, you will get English messages to 
quote here.

 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


-- Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595




__
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] Subscript

2009-01-07 Thread Timthy Chang

A similar question:

mtext(text=log2 intensity ) 
How can I change 2 to be subscript? (see picture below)


http://www.nabble.com/file/p21326192/log2_intensity.jpg 
-- 
View this message in context: 
http://www.nabble.com/Subscript-tp12241351p21326192.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] Help with contrasts

2009-01-07 Thread Paschal

Hello All R Gurus

I'm a relatively new user to R and I'm having so problems fully grasping the
contrasts notion. So any help will be appreciated.
Lately I've been playing around with lme and I was looking at the help files
of anova.lme where there is this example


options(contrasts = c(contr.treatment, contr.poly))
fm1BW.lme - lme(weight ~ Time * Diet, BodyWeight,
   random = ~ Time)
fm2BW.lme - update(fm1BW.lme, weights = varPower())
# Test a specific contrast
anova(fm2BW.lme, L = c(Time:Diet2 = 1, Time:Diet3 = -1))

after running it I get the following result

F-test for linear combination(s)
Time:Diet2 Time:Diet3 
 1 -1 
  numDF denDF  F-value p-value
1 1   157 2.862598  0.0926

My question is how can I test for the Time:Diet1 interaction term and
compare all three diets.

Best regards,
Paschal

-- 
View this message in context: 
http://www.nabble.com/Help-with-contrasts-tp21326943p21326943.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] A (Not So) Short Introduction to S4 (ex Contributed Documentation)

2009-01-07 Thread Christophe Genolini

Here is the link :

http://christophe.genolini.free.fr/webTutorial/index.php

Any comments are welcome.

Christophe





On Tue, Jan 6, 2009 at 8:17 PM, Ben Bolker bol...@ufl.edu wrote:


 Christophe Genolini cgenolin at u-paris10.fr writes:

  


 Hi the list,

 I wrote a tutorial about S4. Is it possible to have a link to it in the
 page Contributed Documentation or R Documentation on the CRAN web
 site ? Who shall I contact ?

 Christophe



  Try c...@r-project.org .  Posting to the development list
 (r-de...@r-project.org) might also be appropriate.
  I would be curious to see the tutorial myself.

  Ben Bolker

 _


I would too.

On Tue, Jan 6, 2009 at 8:17 PM, Ben Bolker bol...@ufl.edu wrote:


 Christophe Genolini cgenolin at u-paris10.fr writes:

  


 Hi the list,

 I wrote a tutorial about S4. Is it possible to have a link to it in the
 page Contributed Documentation or R Documentation on the CRAN web
 site ? Who shall I contact ?

 Christophe



  Try c...@r-project.org .  Posting to the development list
 (r-de...@r-project.org) might also be appropriate.
  I would be curious to see the tutorial myself.

  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] Subscript

2009-01-07 Thread Henrique Dallazuanna
Try this:

 mtext(text=bquote(log[2]~intensity))

On Wed, Jan 7, 2009 at 5:36 AM, Timthy Chang henchao.ch...@gmail.comwrote:


 A similar question:

 mtext(text=log2 intensity )
 How can I change 2 to be subscript? (see picture below)


 http://www.nabble.com/file/p21326192/log2_intensity.jpg
 --
 View this message in context:
 http://www.nabble.com/Subscript-tp12241351p21326192.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.




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

[[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] for loop and if problem

2009-01-07 Thread Sake


Sake wrote:
 
 Hi,
 
 I'm heaving difficulties with a dataset containing gene names and
 positions of those genes.
 Not such a big problem, but each gene has multiple exons so it's hard to
 say where de gene starts and where it ends. I want the starting and ending
 position of each gene in my dataset.
 Attached is the dataset:
 http://www.nabble.com/file/p21312449/genlistchrompos.csv
 genlistchrompos.csv 
 Column 'B' is the gene name, 'G' is the starting position and 'H' is the
 stop position.
 You can load the dataset by using: data-read.csv(genlistchrompos.csv,
 sep=;)
 I hope someone can help me, it's giving me headaches for a week now:-((.
 
 Thanks! 
 
 

Thanks for the tips, i'm going to test them today!
The B,G,H columns I mentioned are the columns you see when you open the file
in Excel, I should have said that. Sorry for the confusion about that:-)
I thought I had to use the 'if' statement because I only want to search for
the Min and Max if the Gene name is the same as the one directly under it.
And the 'for loop' I wanted to use to apply the 'if' statement to the entire
row of gene names.

Edit:
I have tested:
aggregate(data[, c(Exon_Start.Chr.)], by = list(data$Gene), min) 
aggregate(data[, c(Exon_Stop.Chr.)], by = list(data$Gene), max)

And it worked like a charm!
thanx!
-- 
View this message in context: 
http://www.nabble.com/for-loop-and-if-problem-tp21312449p21326557.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] can the pdf output page break be controlled manually?

2009-01-07 Thread Mark Heckmann
I would like to control where to make a page break in my pdf file.
The following code renders three pages of output. But I would like to be
able to control the page breaks.

pdf(file=test.pdf, paper=a4)
  par(mfrow=c(2,2))
  hist(rnorm(100))
hist(rnorm(100))
  hist(rnorm(100))
plot.new()

par(mfrow=c(1,1))
hist(rnorm(100))
hist(rnorm(100))
dev.off()

It would be much more convenient though, to enter a page break command
within the code instead of plot.new().

Is there a way to do this?

TIA, Mark

__
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] Subscript

2009-01-07 Thread Dimitris Rizopoulos

try something like this:

plot(0:1, 0:1, type = n)
text(0.5, 0.5, expression(paste(plain(log)[2],  intensity)))

and check ?plotmath for more info.

I hope it helps.

Best,
Dimitris


Timthy Chang wrote:

A similar question:

mtext(text=log2 intensity ) 
How can I change 2 to be subscript? (see picture below)



http://www.nabble.com/file/p21326192/log2_intensity.jpg 


--
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] Re : Importing data from SPSS with Arabic encoding

2009-01-07 Thread Prof Brian Ripley

Florent Bresson wrote:

Thanks Brian for your help. I am sorry, I should have red the help page more carefully. I 
am working on Kubuntu 8.04 with R 2.8.0. The problem with the file is that I do not know 
what the encoding is. I do not understand what you mean with [...] but most likely 
the output before the error which (you did not show us) told you (and would have told 
us) since I just ran R, loaded the foreign package and then tried to get the data 
with the function read.spss().


And you did not show us all the R output.  read.spss will produce
notes or warnings if it finds one.

And PLEASE, you still have not given us the information asked for
in the posting guide, such as the output of sessionInfo(). Not doing so
really does make the work of the helpers a lot harder.



I have just seen that I can get a list of the supported encodings using the 
function iconvlist(). Would it be possible to define some function to test 
which encodings fit my file?


No, you need to ask the person who gave you the file.


Thanks in advance



- Message d'origine 
De : Prof Brian Ripley rip...@stats.ox.ac.uk
À : Florent Bresson f_bres...@yahoo.fr
Cc : r-h...@stat.math.ethz.ch
Envoyé le : Mercredi, 7 Janvier 2009, 10h49mn 06s
Objet : Re: [R] Importing data from SPSS with Arabic encoding

On Wed, 7 Jan 2009, Florent Bresson wrote:


Dear R-users,

I'm facing a problem with the import of data in R. I have a sav file that, I 
presume, uses some Arabic encoding (but I don't know which one) and I would 
like to read it with R. When I use the function read.spss (I also tried 
spss.get(Hmisc)), I get the following message:

read.spss(Hhld.sav)

Erreur dans read.spss(Hhld.sav) :
 erreur à la lecture de l'entête du fichier système
De plus : Warning message:
In read.spss(Hhld.sav) :
 Hhld.sav : position 0 : le nom de la variable commence avec un caractère non 
autorisé

The second and last lines can be translated into error reading system-file header and 
Hhld.sav: position 0: Variable name begins with invalid character. That's why I suppose 
it is a problem with the encoding. Does someone has an idea of the solution to my problem?


1) Please read the posting guide and supply the details you were asked to 
supply. E.g. what OS, what locale, what version of foreigh?

2) Read the help for read.spss, especially its 'reencode' argument. You will 
need to know what the encoding was, but most likely the output before the error 
which (you did not show us) told you (and would have told us).

BTW, if you start R with LANGUAGE=en set, you will get English messages to 
quote here.


PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



-- Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595


  



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
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] NA and NaN question

2009-01-07 Thread Pascal A. Niklaus
Hi all,

I ran into a problem in some of my code that could be traced back to 'mean' 
sometimes returning NA and sometimes NaN, depending on the value of na.rm:

 mean(c())
[1] NA

 mean(c(NA),na.rm=T)
[1] NaN

However, I don't understand the reasoning behind this and would appreciate and 
explanation. 

I understand that the mean of an empty vector is not definied, but I don't 
understand why it matters whether the vector was empty from the beginning or 
only after removing the NAs.

Pascal Niklaus

__
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] R-help Digest, Vol 71, Issue 7

2009-01-07 Thread Christophe Genolini

Thanks for your answer
Here it is :

http://christophe.genolini.free.fr/webTutorial/index.php

Any comments are welcome...

Christophe

__
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] for loop and if problem

2009-01-07 Thread Gabor Grothendieck
On Wed, Jan 7, 2009 at 3:51 AM, Sake tlep.nav.e...@hccnet.nl wrote:
 aggregate(data[, c(Exon_Start.Chr.)], by = list(data$Gene), min)
 aggregate(data[, c(Exon_Stop.Chr.)], by = list(data$Gene), max)

That could be written:

aggregate(data[Excon_Start.Chr.], data[Gene], min)
aggregate(data[Excon_Start.Chr.], data[Gene], max)

__
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] illustrating a report

2009-01-07 Thread Wydou

Hi all

I would like to know a bit more about illustrating an a4 page within R.
Finally I would like to have a pdf with multiple pages containing some
statistics.
I'm already able to produce a pdf, containing a plot in the center of one a4
page. As a next step I would like to set a title on top of this a4 page
(maybe with absolute positions, if not possible to set it relative?). The
plots then should be centered horizontaly but not vertically...

Can you give me some advice, how to realise this?

Thank you already in advance.
Stephan
-- 
View this message in context: 
http://www.nabble.com/illustrating-a-report-tp21328500p21328500.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] NA and NaN question

2009-01-07 Thread Prof Brian Ripley

Pascal A. Niklaus wrote:

Hi all,

I ran into a problem in some of my code that could be traced back to 'mean' 
sometimes returning NA and sometimes NaN, depending on the value of na.rm:



mean(c())

[1] NA


mean(c(NA),na.rm=T)

[1] NaN

However, I don't understand the reasoning behind this and would appreciate and 
explanation. 

I understand that the mean of an empty vector is not definied, 


Not so, it is well-defined as 0/0 = NaN.

but I don't 
understand why it matters whether the vector was empty from the beginning 


You didn't try that case:  mean(numeric(0)) is also NaN.  The issue is that

 typeof(c())
[1] NULL

is not numeric (not evan a vector), and so mean() of it is undefined.

 or only after removing the NAs.

Speculation (and wrong).



Pascal Niklaus

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



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
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] NA and NaN question

2009-01-07 Thread Wacek Kusnierczyk
Pascal A. Niklaus wrote:
 Hi all,

 I ran into a problem in some of my code that could be traced back to 'mean' 
 sometimes returning NA and sometimes NaN, depending on the value of na.rm:

   
 mean(c())
 
 [1] NA

   
 mean(c(NA),na.rm=T)
 
 [1] NaN

 However, I don't understand the reasoning behind this and would appreciate 
 and 
 explanation. 
   

note the types:

typeof(c())
typeof(c(NA))
typeof(c(NA)[-na.omit(c(NA))])

now,

mean(NULL)
mean(logical(0))

mean(c())
# NA, because you take the mean of a vector of non-{numeric,logical}
type (see the warning message)
mean(c(NA), na.rm=TRUE)
# NaN, because you take the mean of a zero-length logical vector
mean(c(NA), na.rm=FALSE)
# NA, because you take the mean of a logical vector containing an NA


you can argue that ?mean underspecifies this (it doesn't say anything
about the value for a zero-length logical, numeric, or complex vector,
though you can guess it will be the value of 0/0).

vQ

__
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] illustrating a report

2009-01-07 Thread Philipp Pagel
 I would like to know a bit more about illustrating an a4 page within R.
 Finally I would like to have a pdf with multiple pages containing some
 statistics.
 I'm already able to produce a pdf, containing a plot in the center of one a4
 page. As a next step I would like to set a title on top of this a4 page
 (maybe with absolute positions, if not possible to set it relative?). The
 plots then should be centered horizontaly but not vertically...
 
 Can you give me some advice, how to realise this?

You want Sweave() ;-)

With Sweave you can mix R and LaTeX code to produce nicely
formatted reports.

cu
Philipp

-- 
Dr. Philipp Pagel
Lehrstuhl f�r Genomorientierte Bioinformatik
Technische Universit�t M�nchen
Wissenschaftszentrum Weihenstephan
85350 Freising, Germany
http://mips.gsf.de/staff/pagel

__
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] NA and NaN question

2009-01-07 Thread Wacek Kusnierczyk
Wacek Kusnierczyk wrote:
 Pascal A. Niklaus wrote:
   
 Hi all,

 I ran into a problem in some of my code that could be traced back to 'mean' 
 sometimes returning NA and sometimes NaN, depending on the value of na.rm:

   
 
 mean(c())
 
   
 [1] NA

   
 
 mean(c(NA),na.rm=T)
 
   
 [1] NaN

 However, I don't understand the reasoning behind this and would appreciate 
 and 
 explanation. 
   
 

 note the types:

 typeof(c())
 typeof(c(NA))
 typeof(c(NA)[-na.omit(c(NA))])

   

wrong, an artifact of some experimenting; should have been:

typeof(na.omit(c(NA)))

vQ

__
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] Duplicated messages

2009-01-07 Thread Martin Maechler
 BertG == Bert Gunter gunter.ber...@gene.com
 on Tue, 6 Jan 2009 10:13:29 -0800 writes:

BertG  Folks: I am getting duplicate messages on
BertG posts. Please correct my details if I'm wrong, but I
BertG believe it's because folks are posting to **both**
BertG the addresses, r-help@r-project.org and
BertG r-h...@stat.math.eth.ch . I believe the first is just
BertG an alias for the second, and that's why the suplicate
BertG posts occur. 


BertG So please choose one or the other, not both.

yes, indeed !

(thank you, Bert)

__
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] R in the NY Times

2009-01-07 Thread Zaslavsky, Alan M.
This article is accompanied by nice pictures of Robert and Ross.

Data Analysts Captivated by Power of R
  http://www.nytimes.com/2009/01/07/technology/business-computing/07program.html

January 7, 2009
Data Analysts Captivated by R’s Power
By ASHLEE VANCE

To some people R is just the 18th letter of the alphabet. To others, it’s the 
rating on racy movies, a measure of an attic’s insulation or what pirates in 
movies say.

R is also the name of a popular programming language used by a growing number 
of data analysts inside corporations and academia. It is becoming their lingua 
franca partly because data mining has entered a golden age, whether being used 
to set ad prices, find new drugs more quickly or fine-tune financial models. 
Companies as diverse as Google, Pfizer, Merck, Bank of America, the 
InterContinental Hotels Group and Shell use it.

But R has also quickly found a following because statisticians, engineers and 
scientists without computer programming skills find it easy to use.

“R is really important to the point that it’s hard to overvalue it,” said Daryl 
Pregibon, a research scientist at Google, which uses the software widely. “It 
allows statisticians to do very intricate and complicated analyses without 
knowing the blood and guts of computing systems.”

It is also free. R is an open-source program, and its popularity reflects a 
shift in the type of software used inside corporations. Open-source software is 
free for anyone to use and modify. I.B.M., Hewlett-Packard and Dell make 
billions of dollars a year selling servers that run the open-source Linux 
operating system, which competes with Windows from Microsoft. Most Web sites 
are displayed using an open-source application called Apache, and companies 
increasingly rely on the open-source MySQL database to store their critical 
information. Many people view the end results of all this technology via the 
Firefox Web browser, also open-source software.

R is similar to other programming languages, like C, Java and Perl, in that it 
helps people perform a wide variety of computing tasks by giving them access to 
various commands. For statisticians, however, R is particularly useful because 
it contains a number of built-in mechanisms for organizing data, running 
calculations on the information and creating graphical representations of data 
sets.

Some people familiar with R describe it as a supercharged version of 
Microsoft’s Excel spreadsheet software that can help illuminate data trends 
more clearly than is possible by entering information into rows and columns.

What makes R so useful — and helps explain its quick acceptance — is that 
statisticians, engineers and scientists can improve the software’s code or 
write variations for specific tasks. Packages written for R add advanced 
algorithms, colored and textured graphs and mining techniques to dig deeper 
into databases.

Close to 1,600 different packages reside on just one of the many Web sites 
devoted to R, and the number of packages has grown exponentially. One package, 
called BiodiversityR, offers a graphical interface aimed at making calculations 
of environmental trends easier.

Another package, called Emu, analyzes speech patterns, while GenABEL is used to 
study the human genome.

The financial services community has demonstrated a particular affinity for R; 
dozens of packages exist for derivatives analysis alone.

“The great beauty of R is that you can modify it to do all sorts of things,” 
said Hal Varian, chief economist at Google. “And you have a lot of prepackaged 
stuff that’s already available, so you’re standing on the shoulders of giants.”

R first appeared in 1996, when the statistics professors Ross Ihaka and Robert 
Gentleman of the University of Auckland in New Zealand released the code as a 
free software package.

According to them, the notion of devising something like R sprang up during a 
hallway conversation. They both wanted technology better suited for their 
statistics students, who needed to analyze data and produce graphical models of 
the information. Most comparable software had been designed by computer 
scientists and proved hard to use.

Lacking deep computer science training, the professors considered their coding 
efforts more of an academic game than anything else. Nonetheless, starting in 
about 1991, they worked on R full time. “We were pretty much inseparable for 
five or six years,” Mr. Gentleman said. “One person would do the typing and one 
person would do the thinking.”

Some statisticians who took an early look at the software considered it rough 
around the edges. But despite its shortcomings, R immediately gained a 
following with people who saw the possibilities in customizing the free 
software.

John M. Chambers, a former Bell Labs researcher who is now a consulting 
professor of statistics at Stanford University, was an early champion. At Bell 
Labs, Mr. Chambers had helped develop S, another statistics software 

Re: [R] R Threatens SAS According to The NYT

2009-01-07 Thread Martin Maechler
 ao == ajay ohri ajayo...@yahoo.com
 on Wed, 7 Jan 2009 11:07:13 +0530 writes:

ao  On Wed, Jan 7, 2009 at 11:05 AM, ajay ohri
ao ajayo...@yahoo.com wrote:
 
 FYI..not a R -Help Topic, buy I dont know which list to
 post discussions like this.  Regards, Ajay

R-help is fine.

Thanks a lot, Ajay, for the pointer!

At the bottom of the page it says

 __  A version of this article appeared in print on January 7, 2009, 
 __  on page B6 of the New York edition.

Now if any the NYT (print version) subscribers on R-help are
willing to fulfill a New Year's wish for me,
I'd be very grateful for a (digital scan) copy of that page.

Martin Maechler,
ETH Zurich


[..]

 Thought you might be interested in reading this article,
 which appears in the 1/6/9 online edition of The New York
 Times:
 
 
http://www.nytimes.com/2009/01/07/technology/business-computing/07program.html
 
 The headline is Data Analysts Captivated by R's Power,
 and towards the end of the story is the following
 paragraph:
 
 While it is difficult to calculate exactly how many
 people use R, those most familiar with the software
 estimate that close to 250,000 people work with it
 regularly. The popularity of R at universities could
 threaten SAS Institute, the privately held business
 software company that specializes in data analysis
 software. SAS, with more than $2 billion in annual
 revenue, has been the preferred tool of scholars and
 corporate managers. 
 
 Andrew Karp Sierra Information Services www.SierraInfomation.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] R in the NY Times

2009-01-07 Thread Bill Pikounis
Pardon my exuberance, but this is simply awesome. What a treat to find
on the front web page of the NY Times this morning under Technology. I
think the article is very well written by the author, and I think it
captures top highlights of why the software and community are so
special.

Continued high gratitude to all of R-core and the R community for its
unique accomplishments. Every bit of praise is well-earned and
deserved.

I have continuously claimed to colleagues (primarily pharma industry)
for the past 8 years or so that R is the most exciting going on in the
area of statistics.

Thanks,
Bill



Bill Pikounis
Statistician



On Wed, Jan 7, 2009 at 08:10, Zaslavsky, Alan M.
zasla...@hcp.med.harvard.edu wrote:
 This article is accompanied by nice pictures of Robert and Ross.

 Data Analysts Captivated by Power of R
  
 http://www.nytimes.com/2009/01/07/technology/business-computing/07program.html

 January 7, 2009
 Data Analysts Captivated by R's Power
 By ASHLEE VANCE


__
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] can the pdf output page break be controlled manually?

2009-01-07 Thread jim holtman
Try just leaving off the 'plot.new()'; When you change mfrow it
creates a new page.

On Wed, Jan 7, 2009 at 5:01 AM, Mark Heckmann mark.heckm...@gmx.de wrote:
 I would like to control where to make a page break in my pdf file.
 The following code renders three pages of output. But I would like to be
 able to control the page breaks.

 pdf(file=test.pdf, paper=a4)
  par(mfrow=c(2,2))
  hist(rnorm(100))
hist(rnorm(100))
  hist(rnorm(100))
plot.new()

par(mfrow=c(1,1))
hist(rnorm(100))
hist(rnorm(100))
 dev.off()

 It would be much more convenient though, to enter a page break command
 within the code instead of plot.new().

 Is there a way to do this?

 TIA, Mark

 __
 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] R in the NY Times

2009-01-07 Thread Frank E Harrell Jr
This is great to see.  It's interesting that SAS Institute feels that 
non-peer-reviewed software with hidden implementations of analytic 
methods that cannot be reproduced by others should be trusted when 
building aircraft engines.


Frank


Zaslavsky, Alan M. wrote:

This article is accompanied by nice pictures of Robert and Ross.

Data Analysts Captivated by Power of R
  http://www.nytimes.com/2009/01/07/technology/business-computing/07program.html

January 7, 2009
Data Analysts Captivated by R’s Power
By ASHLEE VANCE

To some people R is just the 18th letter of the alphabet. To others, it’s the 
rating on racy movies, a measure of an attic’s insulation or what pirates in 
movies say.

R is also the name of a popular programming language used by a growing number 
of data analysts inside corporations and academia. It is becoming their lingua 
franca partly because data mining has entered a golden age, whether being used 
to set ad prices, find new drugs more quickly or fine-tune financial models. 
Companies as diverse as Google, Pfizer, Merck, Bank of America, the 
InterContinental Hotels Group and Shell use it.

But R has also quickly found a following because statisticians, engineers and 
scientists without computer programming skills find it easy to use.

“R is really important to the point that it’s hard to overvalue it,” said Daryl 
Pregibon, a research scientist at Google, which uses the software widely. “It 
allows statisticians to do very intricate and complicated analyses without 
knowing the blood and guts of computing systems.”

It is also free. R is an open-source program, and its popularity reflects a 
shift in the type of software used inside corporations. Open-source software is 
free for anyone to use and modify. I.B.M., Hewlett-Packard and Dell make 
billions of dollars a year selling servers that run the open-source Linux 
operating system, which competes with Windows from Microsoft. Most Web sites 
are displayed using an open-source application called Apache, and companies 
increasingly rely on the open-source MySQL database to store their critical 
information. Many people view the end results of all this technology via the 
Firefox Web browser, also open-source software.

R is similar to other programming languages, like C, Java and Perl, in that it 
helps people perform a wide variety of computing tasks by giving them access to 
various commands. For statisticians, however, R is particularly useful because 
it contains a number of built-in mechanisms for organizing data, running 
calculations on the information and creating graphical representations of data 
sets.

Some people familiar with R describe it as a supercharged version of 
Microsoft’s Excel spreadsheet software that can help illuminate data trends 
more clearly than is possible by entering information into rows and columns.

What makes R so useful — and helps explain its quick acceptance — is that 
statisticians, engineers and scientists can improve the software’s code or 
write variations for specific tasks. Packages written for R add advanced 
algorithms, colored and textured graphs and mining techniques to dig deeper 
into databases.

Close to 1,600 different packages reside on just one of the many Web sites 
devoted to R, and the number of packages has grown exponentially. One package, 
called BiodiversityR, offers a graphical interface aimed at making calculations 
of environmental trends easier.

Another package, called Emu, analyzes speech patterns, while GenABEL is used to 
study the human genome.

The financial services community has demonstrated a particular affinity for R; 
dozens of packages exist for derivatives analysis alone.

“The great beauty of R is that you can modify it to do all sorts of things,” 
said Hal Varian, chief economist at Google. “And you have a lot of prepackaged 
stuff that’s already available, so you’re standing on the shoulders of giants.”

R first appeared in 1996, when the statistics professors Ross Ihaka and Robert 
Gentleman of the University of Auckland in New Zealand released the code as a 
free software package.

According to them, the notion of devising something like R sprang up during a 
hallway conversation. They both wanted technology better suited for their 
statistics students, who needed to analyze data and produce graphical models of 
the information. Most comparable software had been designed by computer 
scientists and proved hard to use.

Lacking deep computer science training, the professors considered their coding 
efforts more of an academic game than anything else. Nonetheless, starting in 
about 1991, they worked on R full time. “We were pretty much inseparable for 
five or six years,” Mr. Gentleman said. “One person would do the typing and one 
person would do the thinking.”

Some statisticians who took an early look at the software considered it rough 
around the edges. But despite its shortcomings, R immediately gained a 
following with people who saw the 

Re: [R] can the pdf output page break be controlled manually?

2009-01-07 Thread Duncan Murdoch

On 1/7/2009 5:01 AM, Mark Heckmann wrote:

I would like to control where to make a page break in my pdf file.
The following code renders three pages of output. But I would like to be
able to control the page breaks.

pdf(file=test.pdf, paper=a4)
  par(mfrow=c(2,2))
  hist(rnorm(100))
hist(rnorm(100))
  hist(rnorm(100))
plot.new()

par(mfrow=c(1,1))
hist(rnorm(100))
hist(rnorm(100))
dev.off()

It would be much more convenient though, to enter a page break command
within the code instead of plot.new().


The par(mfrow=c(1,1)) command will cause a page break, so just do 
nothing.  I don't know if that's much more convenient than entering 
plot.new(), but it's a little better.


Duncan Murdoch




Is there a way to do this?

TIA, Mark

__
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] R in the NY Times

2009-01-07 Thread Frank E Harrell Jr

Bill Pikounis wrote:

Pardon my exuberance, but this is simply awesome. What a treat to find
on the front web page of the NY Times this morning under Technology. I
think the article is very well written by the author, and I think it
captures top highlights of why the software and community are so
special.

Continued high gratitude to all of R-core and the R community for its
unique accomplishments. Every bit of praise is well-earned and
deserved.

I have continuously claimed to colleagues (primarily pharma industry)
for the past 8 years or so that R is the most exciting going on in the
area of statistics.

Thanks,
Bill


Amen to that, and in addition, R is now the top tool for everyday 
analysis, not just a research statistician's tool.


Frank





Bill Pikounis
Statistician



On Wed, Jan 7, 2009 at 08:10, Zaslavsky, Alan M.
zasla...@hcp.med.harvard.edu wrote:

This article is accompanied by nice pictures of Robert and Ross.

Data Analysts Captivated by Power of R
 http://www.nytimes.com/2009/01/07/technology/business-computing/07program.html

January 7, 2009
Data Analysts Captivated by R's Power
By ASHLEE VANCE



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




--
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] R in the NY Times

2009-01-07 Thread Simon Pickett
I would like to add that I would have spent many more years doing my PhD if 
it wasnt for R! all data management, statistics and graphics were conducted 
using it. This was the direction my university and many more research 
institutes appear to be heading.


It probably doesnt get said enough and I am sure I speak for all young 
researchers I am very much in debt for all the kind souls who have helped me 
and other newbies on this forum over the years,


Thanks very much R team.


- Original Message - 
From: Frank E Harrell Jr f.harr...@vanderbilt.edu

To: Bill Pikounis billpikou...@gmail.com
Cc: r-help@r-project.org
Sent: Wednesday, January 07, 2009 2:25 PM
Subject: Re: [R] R in the NY Times



Bill Pikounis wrote:

Pardon my exuberance, but this is simply awesome. What a treat to find
on the front web page of the NY Times this morning under Technology. I
think the article is very well written by the author, and I think it
captures top highlights of why the software and community are so
special.

Continued high gratitude to all of R-core and the R community for its
unique accomplishments. Every bit of praise is well-earned and
deserved.

I have continuously claimed to colleagues (primarily pharma industry)
for the past 8 years or so that R is the most exciting going on in the
area of statistics.

Thanks,
Bill


Amen to that, and in addition, R is now the top tool for everyday 
analysis, not just a research statistician's tool.


Frank





Bill Pikounis
Statistician



On Wed, Jan 7, 2009 at 08:10, Zaslavsky, Alan M.
zasla...@hcp.med.harvard.edu wrote:

This article is accompanied by nice pictures of Robert and Ross.

Data Analysts Captivated by Power of R

http://www.nytimes.com/2009/01/07/technology/business-computing/07program.html

January 7, 2009
Data Analysts Captivated by R's Power
By ASHLEE VANCE



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




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



__
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] R in the NY Times

2009-01-07 Thread Kevin E. Thorpe

Zaslavsky, Alan M. wrote:

This article is accompanied by nice pictures of Robert and Ross.

Data Analysts Captivated by Power of R 
http://www.nytimes.com/2009/01/07/technology/business-computing/07program.html



January 7, 2009 Data Analysts Captivated by R’s Power By ASHLEE VANCE


SAS says it has noticed R’s rising popularity at universities,
despite educational discounts on its own software, but it dismisses
the technology as being of interest to a limited set of people
working on very hard tasks.

“I think it addresses a niche market for high-end data analysts that
want free, readily available code, said Anne H. Milley, director of
technology product marketing at SAS. She adds, “We have customers who
build engines for aircraft. I am happy they are not using freeware
when I get on a jet.”



Thanks for posting.  Does anyone else find the statement by SAS to be 
humourous yet arrogant and short-sighted?


Kevin

--
Kevin E. Thorpe
Biostatistician/Trialist, Knowledge Translation Program
Assistant Professor, Dalla Lana School of Public Health
University of Toronto
email: kevin.tho...@utoronto.ca  Tel: 416.864.5776  Fax: 416.864.6057

__
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] R in the NY Times-IAsians perspective

2009-01-07 Thread Ajay ohri
R and its GUI Rattle helped me establish a data mining consulting startup on
my own, without taking bank credit .
People I met on the forum and especially books like
rforsasandspssusers.com/  http://rforsasandspssusers.com/

helped me ease the transition to the new Object Oriented method from the
earlier -

even a monkey can create shakespeare if he types enough kind of analytics
software.

.Since I am in India , the cost differences can cause almost a digital
divide in who can and who cant use sophisticated software.
Thanks to the Angels hereYes we Can R...


Regards,

Ajay

www.decisionstats.com



On Wed, Jan 7, 2009 at 8:03 PM, Simon Pickett simon.pick...@bto.org wrote:

 I would like to add that I would have spent many more years doing my PhD if
 it wasnt for R! all data management, statistics and graphics were conducted
 using it. This was the direction my university and many more research
 institutes appear to be heading.

 It probably doesnt get said enough and I am sure I speak for all young
 researchers I am very much in debt for all the kind souls who have helped me
 and other newbies on this forum over the years,

 Thanks very much R team.


 - Original Message - From: Frank E Harrell Jr 
 f.harr...@vanderbilt.edu
 To: Bill Pikounis billpikou...@gmail.com
 Cc: r-help@r-project.org
 Sent: Wednesday, January 07, 2009 2:25 PM
 Subject: Re: [R] R in the NY Times



  Bill Pikounis wrote:

 Pardon my exuberance, but this is simply awesome. What a treat to find
 on the front web page of the NY Times this morning under Technology. I
 think the article is very well written by the author, and I think it
 captures top highlights of why the software and community are so
 special.

 Continued high gratitude to all of R-core and the R community for its
 unique accomplishments. Every bit of praise is well-earned and
 deserved.

 I have continuously claimed to colleagues (primarily pharma industry)
 for the past 8 years or so that R is the most exciting going on in the
 area of statistics.

 Thanks,
 Bill


 Amen to that, and in addition, R is now the top tool for everyday
 analysis, not just a research statistician's tool.

 Frank


 

 Bill Pikounis
 Statistician



 On Wed, Jan 7, 2009 at 08:10, Zaslavsky, Alan M.
 zasla...@hcp.med.harvard.edu wrote:

 This article is accompanied by nice pictures of Robert and Ross.

 Data Analysts Captivated by Power of R


 http://www.nytimes.com/2009/01/07/technology/business-computing/07program.html

 January 7, 2009
 Data Analysts Captivated by R's Power
 By ASHLEE VANCE


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



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


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


Re: [R] R in the NY Times

2009-01-07 Thread Marc Schwartz
on 01/07/2009 08:44 AM Kevin E. Thorpe wrote:
 Zaslavsky, Alan M. wrote:
 This article is accompanied by nice pictures of Robert and Ross.

 Data Analysts Captivated by Power of R
 http://www.nytimes.com/2009/01/07/technology/business-computing/07program.html



 January 7, 2009 Data Analysts Captivated by R’s Power By ASHLEE VANCE


 SAS says it has noticed R’s rising popularity at universities,
 despite educational discounts on its own software, but it dismisses
 the technology as being of interest to a limited set of people
 working on very hard tasks.

 “I think it addresses a niche market for high-end data analysts that
 want free, readily available code, said Anne H. Milley, director of
 technology product marketing at SAS. She adds, “We have customers who
 build engines for aircraft. I am happy they are not using freeware
 when I get on a jet.”

 
 Thanks for posting.  Does anyone else find the statement by SAS to be
 humourous yet arrogant and short-sighted?
 
 Kevin

It is an ignorant comment by a marketing person who has been spoon fed
her lines...it is also a comment being made from a very defensive and
insecure posture.

Congrats to R Core and the R Community. This is yet another sign of R's
growth and maturity.

Regards,

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.


[R] Frailty by strata interactions in coxph ( or coxme)‏

2009-01-07 Thread Christos Argyropoulos


Hello,
I was hoping that someone could answer a few questions for me (the background 
is given below):
1) Can the coxph accept an interaction between a covariate and a frailty term
2) If so, is it possible to
a) test the model in which the covariate and the frailty appear as main terms 
using the penalized likelihood (for gaussian/t frailties)
b)augment model 1) by stratifying on the variable that appers in the frailty 
term ?

Thanks in advance! I apologise for sending this as html earlier today.

Chris Argyropoulos
University of Pittsburgh Medical Center


Background
-
I am trying to fit a cox proportional hazards model tothe data from a two arm 
(treatment indicator is 0/1)
multicenter trial, adjusting for the presence of covariates and testing for the 
presence of a center
(and possibly a treatment X center interaction effect).

I would like to contrast the different approaches discussed in Glidden D.V. and 
Eric Vittinghoff. Modelling clustered survival data from multicentre clinical 
trials. Stat Med 2004, 23:369-388 (DOI: 10.1002/sim. 1599). in this paper the 
authors present a decomposition of the hazard function for the ith individual, 
receiving Z(k,i) treatment (0-1) in the kth center as:

lambda(k,i)=lambda(0,k)*exp(b*Z(k,i)+om(k)*Z(k,i))

where om(k) = center specific effect - mean treatment effect ~ distributed as a 
(log-) gamma or normal frailty.


I coded this model in R as:

r1-coxph(Surv(d,e)~treat*frailty(center)+othercovars+strata(center))

coxph produces a table with the coefficients and standard errors for:
a) the treatment variable
b) the covariates as well as
c) the treatment x frailty interaction effect.

but the main effect of frailty is estimated to be zero (which I expected, since 
it is absorbed into the baseline hazards for the strata).

Am I correct to assume that coxph can in fact fit the model from the Stat Med 
paper?

If coxph cannot fit such models, could I simply fit:
coxph(Surv(d,e)~treat*frailty(center)+othercovars),

and interpret the coefficient for interaction between treatment and frailty { 
treat:frailty(center) }as in the first model?
If so, could one view the coefficient of the main effect of the frailty 
component, as a random intercept and the interaction term
as a random slope in a general mixed effects Cox model?
Can coxme be used to fit these models in a cleaner way?
_
[[elided Hotmail spam]]

__
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] about randomForest

2009-01-07 Thread Liaw, Andy
Apologies for catching this so late.  Have been out for a few weeks and still 
trying to recover from that...

From: Jim Porzak
 
 Hi Wanghong,
 
 Unless you have a huge linux box, you will need to sample 
 down your 300k
 rows to a few thousand.
 
 In marketing aps, I often have data sets of comparable size.
 
 I would suggest you start with a just a few k rows to make 
 sure everything
 else is working as you wish. Also, study carefully Andy's 
 randomForest docs
 - including the R News article a couple years ago.
 
 In particular,
 
 1) the formula interface is a memory hog. Andy suggests just 
 using explicit
 declaration. In you case, something like
   randomForest(Memebers[42], Memebers[-42], ...

Actually that first argument probably should be Members[[42]].  I believe you 
get a data frame with one variable if you do Members[42].

Best,
Andy

 2) proximity matirx is also memory  time intensive. Suggest 
 proximity =
 FALSE until, other things sorted out.
 
 HTH,
 Jim Porzak
 TGN.com
 San Francisco, CA
 http://www.linkedin.com/in/jimporzak
 useR Group SF: http://ia.meetup.com/67/
 
 
 2008/12/26 wanghong wangh...@neusoft.edu.cn
 
  hello,
  I want to use randomForest to classify a matrix which is 
 331030¡Á42,the last
  column is class signal.I use £º
  
 Memebers.rf-randomForest(class~.,data=Memebers,proximity=TRUE
 ,mtry=6,ntree=200)
  which told me the error is matrix(0,n,n) set too elements
  then I use:
  
 Memebers.rf-randomForest(class~.,data=Memebers,importance=TRU
E,proximity=TRUE)
  which told methe error is na.fail.default(list(class = 
 c(17L, 17L, 17L,
  29L, 29L, 29L,  :
   missing values in object
  
 
  what's wrong with it .Thanks a lot
 
 
  wanghong
   wangh...@neusoft.edu.cn
  2008-12-26
  __
  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]]
 
 
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] Extracting degrees of freedom from a gnls object

2009-01-07 Thread Christoph Scherber

Dear all,

How can I extract the total and residual d.f. from a gnls object?

I have tried str(summary(gnls.model)) and str(gnls.model) as well as gnls(), but couldn´t find the 
entry in the resulting lists.


Many thanks!

Best wishes
Christoph



--
Dr. rer.nat. Christoph Scherber
University of Goettingen
DNPW, Agroecology
Waldweg 26
D-37073 Goettingen
Germany

phone +49 (0)551 39 8807
fax   +49 (0)551 39 8806

Homepage http://www.gwdg.de/~cscherb1

__
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] NA and NaN question

2009-01-07 Thread Pascal A. Niklaus
Thanks, now I understand what's happening. Maybe a line explaining this could 
be added to the help text for mean?

Pascal Niklaus

On Wed 07-Jan-2009 13:29:25 Prof Brian Ripley wrote:
 Pascal A. Niklaus wrote:
  Hi all,
 
  I ran into a problem in some of my code that could be traced back to
  'mean'
 
  sometimes returning NA and sometimes NaN, depending on the value of na.rm:
  mean(c())
 
  [1] NA
 
  mean(c(NA),na.rm=T)
 
  [1] NaN
 
  However, I don't understand the reasoning behind this and would
  appreciate and explanation.
 
  I understand that the mean of an empty vector is not definied,

 Not so, it is well-defined as 0/0 = NaN.

  but I don't
  understand why it matters whether the vector was empty from the beginning

 You didn't try that case:  mean(numeric(0)) is also NaN.  The issue is that

   typeof(c())

 [1] NULL

 is not numeric (not evan a vector), and so mean() of it is undefined.

   or only after removing the NAs.

 Speculation (and wrong).

  Pascal Niklaus
 
  __
  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] R Stacked Histogram

2009-01-07 Thread Jason Rupert
That worked!  Thank you very much for the help. 
 
I think I have one last question about qplot in ggplot2, That is exporting the 
plot to JPG while in a loop.   I tried what was recommended in Re: [R] jpeg() 
creating empty files with qplot() in a loop, however, I received some errors 
(see below).  I also tried using a PDF, but that did not work either, i.e. the 
PDF produced was blank.  Oddly enough the results produced using 
dev.print(file=qplot_output.jpg, device=jpeg, width=600)  in a loop are 
blank, i.e. the JPG file is there, but it is blank.  Unfortunately,  
ggsave(file=ggsave_qplot_output.jpg) does not even produce a JPG file 
output.  Any help at this point is greatly appreciated.  Is the problem related 
to the fact that I need to use the plain hist and dev.print prior to using 
ggplot's qplot? 
 
Thanks again for all your help.   

 
 for(jj in 0:4)
+ {
+   rnorm_test_data-rnorm(1000,3,6)
+   hist(rnorm_test_data)
+   dev.print(file=test_data.jpg, device=jpeg, width=600) 
+ 
+   plot.new()  
+   qplot(rnorm_test_data, geom = histogram, binwidth = 1) + 
+ scale_x_continuous(Test Data) + scale_y_continuous(Frequency) + 
+ scale_fill_discrete(qplot histogram)
+   
+   # Print the plot to a JPG or PDF 
+   dev.print(file=qplot_output.jpg, device=jpeg, width=600)   
+   ggsave(file=ggsave_qplot_output.jpg) 
+   ggsave(file = ggsave_qplot_output.pdf)
+ 
+ }  
Saving 6.9 x 6.89 image
Error in get(as.character(FUN), mode = function, envir = envir) : 
  variable jpg of mode function was not found
 

 

 
 
g 6.9 x 6.89 image
Error in get(as.character(FUN), mode = function, envir = envir) : 
  variable jpg of mode function was not found
 
P.S. Here is the 
 sessionInfo()
R version 2.8.0 (2008-10-20) 
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] grid  stats graphics  grDevices utils datasets  methods   
base 
other attached packages:
 [1] ggplot2_0.8.1  reshape_0.8.2  RColorBrewer_1.0-2 
proto_0.3-8    plyr_0.1.4 nortest_1.0    fBasics_280.74 
timeSeries_290.79 
 [9] timeDate_290.81    vcd_1.2-1  MASS_7.2-44    colorspace_1.0-0  


--- On Tue, 1/6/09, ONKELINX, Thierry thierry.onkel...@inbo.be wrote:

From: ONKELINX, Thierry thierry.onkel...@inbo.be
Subject: RE: [R] R Stacked Histogram
To: jasonkrup...@yahoo.com, r-help@r-project.org
Date: Tuesday, January 6, 2009, 9:54 AM

Dear Jason,

Have a look at scale_y_continuous() and scale_fill_discrete(). This might work
(untested as your example is not reproducible with a (dummy) dataset).

qplot(Age, data = recerts_combined_values, binwidth = 5, fill =
combined_values$Test.Type, main=Combined Age Histogram) +
scale_x_continuous(Age, months) +
scale_y_continuous(Counts) + scale_fill_discrete(Type of
Tests)

HTH,

Thierry



ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology
and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium 
tel. + 32 54/436 185
thierry.onkel...@inbo.be 
www.inbo.be 

To call in the statistician after the experiment is done may be no more than
asking him to perform a post-mortem examination: he may be able to say what the
experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not ensure
that a reasonable answer can be extracted from a given body of data.
~ John Tukey

-Oorspronkelijk bericht-
Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens
Jason Rupert
Verzonden: dinsdag 6 januari 2009 16:00
Aan: r-help@r-project.org
Onderwerp: Re: [R] R Stacked Histogram

Great advice.  I did a quick read and came up with the following:
 
qplot(Age, data = recerts_combined_values, binwidth = 5, 
 fill = combined_values$Test.Type, 
 ylab=Counts, xlab=Age, months,  
 main=Combined Age Histogram, 
 legend.name = Type of Tests)

Unfortunatley, here is a description of the results:
(1) the main title font size by default is too large and is clipped
by the image (guess I need to figure out how to fix this), 
(2) ylab appears to fail - it does not replace the default count
label - what should I do to fix this?
(3) like (2), neither using legend.name nor
legend.title appears to replace/change the name of the legend
title/name.  
 
By any chance can you provide some advice for tackeling these items?  These
are probably due to me being a noobie on the ggplot2 package.  
 
Thanks again.
 

--- On Mon, 1/5/09, hadley wickham h.wick...@gmail.com wrote:

From: hadley wickham h.wick...@gmail.com
Subject: Re: [R] R Stacked 

Re: [R] R Stacked Histogram

2009-01-07 Thread hadley wickham
On Wed, Jan 7, 2009 at 7:55 AM, Jason Rupert jasonkrup...@yahoo.com wrote:
 That worked!  Thank you very much for the help.

 I think I have one last question about qplot in ggplot2, That is exporting 
 the plot to JPG while in a loop.   I tried what was recommended in Re: [R] 
 jpeg() creating empty files with qplot() in a loop, however, I received some 
 errors (see below).  I also tried using a PDF, but that did not work either, 
 i.e. the PDF produced was blank.  Oddly enough the results produced using 
 dev.print(file=qplot_output.jpg, device=jpeg, width=600)  in a loop are 
 blank, i.e. the JPG file is there, but it is blank.  Unfortunately,  
 ggsave(file=ggsave_qplot_output.jpg) does not even produce a JPG file 
 output.  Any help at this point is greatly appreciated.  Is the problem 
 related to the fact that I need to use the plain hist and dev.print prior 
 to using ggplot's qplot?

If you're using ggsave, you don't need to use the dev functions.  The
following should be sufficient:

qplot(rnorm_test_data, geom = histogram, binwidth = 1) +
 scale_x_continuous(Test Data) + scale_y_continuous(Frequency) +
 scale_fill_discrete(qplot histogram)
ggsave(file = ggsave_qplot_output.pdf)

# Unfortunately due to a small bug in the current version of ggplot,
you need to use
# jpeg with an e to get jpegs
ggsave(file = ggsave_qplot_output.jpeg)

# But I'd recommend using png instead - much better quality
ggsave(file = ggsave_qplot_output.png)

# One final problem is that you're going to overwrite the plot
# on each run of your loop.  You probably want something like:

ggsave(file = paste(ggsave_qplot_output_, i, .png, sep =))

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] R in the NY Times

2009-01-07 Thread Tony Breyal
Thank you for posting this, I found it a very enjoyable read!

I am curious, is there an archive of 'R in the Media' or 'R in the
Press' articles somewhere? It would be interesting to see how the
perception of R has changed/evolved over time relative to other
packages.

Cheers,
Tony Breyal


On 7 Jan, 13:10, Zaslavsky, Alan M. zasla...@hcp.med.harvard.edu
wrote:
 This article is accompanied by nice pictures of Robert and Ross.

 Data Analysts Captivated by Power of R
  http://www.nytimes.com/2009/01/07/technology/business-computing/07pro...

 January 7, 2009
 Data Analysts Captivated by R’s Power
 By ASHLEE VANCE

 To some people R is just the 18th letter of the alphabet. To others, it’s the 
 rating on racy movies, a measure of an attic’s insulation or what pirates in 
 movies say.

 R is also the name of a popular programming language used by a growing number 
 of data analysts inside corporations and academia. It is becoming their 
 lingua franca partly because data mining has entered a golden age, whether 
 being used to set ad prices, find new drugs more quickly or fine-tune 
 financial models. Companies as diverse as Google, Pfizer, Merck, Bank of 
 America, the InterContinental Hotels Group and Shell use it.

 But R has also quickly found a following because statisticians, engineers and 
 scientists without computer programming skills find it easy to use.

 “R is really important to the point that it’s hard to overvalue it,” said 
 Daryl Pregibon, a research scientist at Google, which uses the software 
 widely. “It allows statisticians to do very intricate and complicated 
 analyses without knowing the blood and guts of computing systems.”

 It is also free. R is an open-source program, and its popularity reflects a 
 shift in the type of software used inside corporations. Open-source software 
 is free for anyone to use and modify. I.B.M., Hewlett-Packard and Dell make 
 billions of dollars a year selling servers that run the open-source Linux 
 operating system, which competes with Windows from Microsoft. Most Web sites 
 are displayed using an open-source application called Apache, and companies 
 increasingly rely on the open-source MySQL database to store their critical 
 information. Many people view the end results of all this technology via the 
 Firefox Web browser, also open-source software.

 R is similar to other programming languages, like C, Java and Perl, in that 
 it helps people perform a wide variety of computing tasks by giving them 
 access to various commands. For statisticians, however, R is particularly 
 useful because it contains a number of built-in mechanisms for organizing 
 data, running calculations on the information and creating graphical 
 representations of data sets.

 Some people familiar with R describe it as a supercharged version of 
 Microsoft’s Excel spreadsheet software that can help illuminate data trends 
 more clearly than is possible by entering information into rows and columns.

 What makes R so useful — and helps explain its quick acceptance — is that 
 statisticians, engineers and scientists can improve the software’s code or 
 write variations for specific tasks. Packages written for R add advanced 
 algorithms, colored and textured graphs and mining techniques to dig deeper 
 into databases.

 Close to 1,600 different packages reside on just one of the many Web sites 
 devoted to R, and the number of packages has grown exponentially. One 
 package, called BiodiversityR, offers a graphical interface aimed at making 
 calculations of environmental trends easier.

 Another package, called Emu, analyzes speech patterns, while GenABEL is used 
 to study the human genome.

 The financial services community has demonstrated a particular affinity for 
 R; dozens of packages exist for derivatives analysis alone.

 “The great beauty of R is that you can modify it to do all sorts of things,” 
 said Hal Varian, chief economist at Google. “And you have a lot of 
 prepackaged stuff that’s already available, so you’re standing on the 
 shoulders of giants.”

 R first appeared in 1996, when the statistics professors Ross Ihaka and 
 Robert Gentleman of the University of Auckland in New Zealand released the 
 code as a free software package.

 According to them, the notion of devising something like R sprang up during a 
 hallway conversation. They both wanted technology better suited for their 
 statistics students, who needed to analyze data and produce graphical models 
 of the information. Most comparable software had been designed by computer 
 scientists and proved hard to use.

 Lacking deep computer science training, the professors considered their 
 coding efforts more of an academic game than anything else. Nonetheless, 
 starting in about 1991, they worked on R full time. “We were pretty much 
 inseparable for five or six years,” Mr. Gentleman said. “One person would do 
 the typing and one person would do the thinking.”

 Some statisticians who took 

[R] Question about the RWEKA package

2009-01-07 Thread Häring, Tim (LWF)
Dear List,

I´m trying to implement the functionalities from WEKA into my modeling project 
in R through the RWeka package.
In this context I have a slightly special question about the filters 
implemented in WEKA.
I want to convert nominal attributes with k values into k binary attributes 
through the NominalToBinary filter 
(weka.filters.supervised.attribute.NominalToBinary). But unfortunately I 
can`t apply the filter to my data.
Here is my code:

nombi - make_Weka_filter(weka/filters/supervised/attribute/NominalToBinary)
x2bin - nombi(data=dat, control =Weka_control(N=TRUE, A=TRUE))

I didn't get an error message, but it still don't work. My nominal attribute is 
of class factor.
Maybe the problem has to do with the argument list.
Argument list:
  (formula, data, subset, na.action, control = NULL)
What is meant with the argument formula?

Any advice? I`d be glad for any hint!
I`m using R 2.7.2 and RWEKA 0.3-14

TIM
--- 
Dipl.-Geogr. Tim Häring
Sachgebiet Standort und Bodenschutz (SG 2.1)
Bayerische Landesanstalt für Wald und Forstwirtschaft
Am Hochanger 11
D-85354 Freising

E-Mail: tim.haer...@lwf.bayern.de
http://www.lwf.bayern.de




[[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] Extracting degrees of freedom from a gnls object

2009-01-07 Thread Marc Schwartz
on 01/07/2009 09:01 AM Christoph Scherber wrote:
 Dear all,
 
 How can I extract the total and residual d.f. from a gnls object?
 
 I have tried str(summary(gnls.model)) and str(gnls.model) as well as
 gnls(), but couldn´t find the entry in the resulting lists.
 
 Many thanks!
 
 Best wishes
 Christoph


Using the example from ?gnls:

library(nlme)

fm1 - gnls(weight ~ SSlogis(Time, Asym, xmid, scal), Soybean,
weights = varPower())

 fm1
Generalized nonlinear least squares fit
  Model: weight ~ SSlogis(Time, Asym, xmid, scal)
  Data: Soybean
  Log-likelihood: -486.8974

Coefficients:
 Asym  xmid  scal
17.356822 51.872316  7.620525

Variance function:
 Structure: Power of variance covariate
 Formula: ~fitted(.)
 Parameter estimates:
power
0.8815436
Degrees of freedom: 412 total; 409 residual
Residual standard error: 0.3662752


When reviewing the structure of the 'fm1' object in comparison to the
output, you can see that the d.f. are stored in:

 fm1$dims
$p
[1] 3

$N
[1] 412

$REML
[1] FALSE


So:

 fm1$dims$N
[1] 412


and:

 fm1$dims$N - fm1$dims$p
[1] 409


If you are unsure about where things are stored, one approach is to look
at the code for the print method for the object class to see how the
output is generated. In this case it is print.gls(), as a gnls object
inherits from a gls object.


Thus, reviewing the apropos snippet from nlme:::print.gls():

cat(Degrees of freedom:, dd[[N]], total;, dd[[N]] -
dd[[p]], residual\n)

where 'dd' is created earlier in the function as:

  dd - x$dims


This is also covered in ?gnlsObject, which shows:

dimsa list with basic dimensions used in the model fit, including
the components N - the number of observations used in the fit
and p - the number of coefficients in the nonlinear model.

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] R in the NY Times

2009-01-07 Thread Rubén Roa-Ureta

Zaslavsky, Alan M. wrote:

This article is accompanied by nice pictures of Robert and Ross.

Data Analysts Captivated by Power of R
  http://www.nytimes.com/2009/01/07/technology/business-computing/07program.html
  

Thanks for the heads up. The R morale is going through the roof!
I've given three courses on R since the second half of 2007 here in 
Chile (geostatistics, Fisheries Libraries for R, and generalized linear 
models) and all my three audiences (professionals working in academia, 
government, and private research institutions) were very much impressed 
by the power of R. I spent as much time on R itself as on the 
statistical topics, since students wanted to learn data management and 
graphics once they started to grasp the basic elements.
R creators, Core Team, package creators and maintainers, and experts on 
the list, thanks so much for such a great work and such an open 
attitude. You lead by example.

Rubén

__
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] R in the NY Times

2009-01-07 Thread Jeffrey J. Hallman
The article quotes John Chambers, but it doesn't mention that R started out as
an implementation of the S language.  I don't suppose Insightful is too happy
about that.

The SAS spokesman quoted in the article is clearly whistling past the graveyard.
-- 
Jeff

__
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] R in the NY Times

2009-01-07 Thread Darin A. England
On Wed, Jan 07, 2009 at 08:00:28AM -0600, Frank E Harrell Jr wrote:
 This is great to see.  It's interesting that SAS Institute feels that 
 non-peer-reviewed software with hidden implementations of analytic 
 methods that cannot be reproduced by others should be trusted when 
 building aircraft engines.
 
 Frank

Unfortunately, that type of FUD issued by the SAS marketing person still
works. I see it at my employer (a large healthcare company.) It's a
battle to change a culture, but ironically the recession helps.
People are now taking notice of the obscene licensing fees for SAS.

Darin

__
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] R in the NY Times

2009-01-07 Thread Duncan Murdoch

On 1/7/2009 9:44 AM, Kevin E. Thorpe wrote:

Zaslavsky, Alan M. wrote:

This article is accompanied by nice pictures of Robert and Ross.

Data Analysts Captivated by Power of R 
http://www.nytimes.com/2009/01/07/technology/business-computing/07program.html



January 7, 2009 Data Analysts Captivated by R’s Power By ASHLEE VANCE


SAS says it has noticed R’s rising popularity at universities,
despite educational discounts on its own software, but it dismisses
the technology as being of interest to a limited set of people
working on very hard tasks.

“I think it addresses a niche market for high-end data analysts that
want free, readily available code, said Anne H. Milley, director of
technology product marketing at SAS. She adds, “We have customers who
build engines for aircraft. I am happy they are not using freeware
when I get on a jet.”



Thanks for posting.  Does anyone else find the statement by SAS to be 
humourous yet arrogant and short-sighted?


To me it just seemed like a blast from the past.

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] rbind for matrices - rep argument

2009-01-07 Thread Niccolò Bassani
Dear R users,I'm facing a trivial problem, but I really can't solve it. I've
tried a dozen of codes, but I can't get the result I want.
The question is: I have a dataframe like this one

[,1] [,2] [,3] [,4] [,5]
[1,]12345
[2,]25549
[3,]16812
[4,]86415

made up of decimal numbers, of course.
I want to append this dataframe to itself a number x of times, i.e. 3. That
is I want a dataframe like this


[,1] [,2] [,3] [,4] [,5]
[1,]12345
[2,]25549
[3,]16812
[4,]86415
[5,]12345
[6,]25549
[7,]16812
[8,]86415
[9,]12345
[10,]25549
[11,]16812
[12,]86415

I'm searching for an authomatic way to do this (I've already used the
rbind re-writing x times the name of the frame...), as it must enter a
function where one argument is exactly the number x of times to repeat this
frame.

Any ideas??
Thanks in advance!

Niccolò

[[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] R in the NY Times

2009-01-07 Thread Peter Dalgaard
Jeffrey J. Hallman wrote:
 The article quotes John Chambers, but it doesn't mention that R started out as
 an implementation of the S language.  I don't suppose Insightful is too happy
 about that.

You mean Tibco...

The statement that S failed to generate broad interest is also a bit
misleading. I believe S-PLUS had more than 10 users in its day,
although it may be true that its success was mainly in the academic
world. Obviously the pool of people who knew S from the preceding decade
was very important for the early development of R.

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - (p.dalga...@biostat.ku.dk)  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.


Re: [R] R in the NY Times

2009-01-07 Thread Max Kuhn
 You can look on the SAS message boards and see there is a proportional 
 downturn in traffic.

I think that I actually made this statement about both the SAS and
Splus traffic...

I wasn't really trying to be critical of SAS. I was trying to get
across that SAS focused their resources on features that had nothing
to do with *statistical analysis* (e.g. data warehousing etc.)

-- 

Max

__
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] rbind for matrices - rep argument

2009-01-07 Thread Dimitris Rizopoulos

you can use indexing, e.g.,

mat - matrix(rnorm(20), 4, 5)

mat
mat[rep(1:nrow(mat), 3), ]


I hope it helps.

Best,
Dimitris


Niccolò Bassani wrote:

Dear R users,I'm facing a trivial problem, but I really can't solve it. I've
tried a dozen of codes, but I can't get the result I want.
The question is: I have a dataframe like this one

[,1] [,2] [,3] [,4] [,5]
[1,]12345
[2,]25549
[3,]16812
[4,]86415

made up of decimal numbers, of course.
I want to append this dataframe to itself a number x of times, i.e. 3. That
is I want a dataframe like this


[,1] [,2] [,3] [,4] [,5]
[1,]12345
[2,]25549
[3,]16812
[4,]86415
[5,]12345
[6,]25549
[7,]16812
[8,]86415
[9,]12345
[10,]25549
[11,]16812
[12,]86415

I'm searching for an authomatic way to do this (I've already used the
rbind re-writing x times the name of the frame...), as it must enter a
function where one argument is exactly the number x of times to repeat this
frame.

Any ideas??
Thanks in advance!

Niccolò

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


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


[R] Replace Function (How to replace numbers in a data frame with a specific number)

2009-01-07 Thread stephen sefick
taxa - (structure(list(Date = structure(c(4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L), .Label = c(2006/04,
2006/05, 2006/07, 2006/10, 2006/12, 2007/02, 2007/04,
2007/06, 2007/08, 2007/10, 2007/12, 2008/01), class = factor),
RiverMile = c(61L, 119L, 148L, 179L, 185L, 187L, 190L, 196L,
198L, 202L, 215L, 61L, 119L, 148L, 179L, 185L, 187L, 190L,
196L, 198L), Site = structure(c(9L, 1L, 2L, 3L, 4L, 10L,
5L, 11L, 6L, 7L, 8L, 9L, 1L, 2L, 3L, 4L, 10L, 5L, 11L, 6L
), .Label = c(119, 148, 179, 185, 190, 198, 202,
215, 61, BC, HC, SC), class = factor), location =
structure(c(2L,
2L, 2L, 2L, 2L, 1L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
1L, 2L, 1L, 2L), .Label = c(creek, river), class = factor),
Amphipoda = c(0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1,
0, 1, 1, 0, 1), Coleoptera = c(1, 1, 4, 1, 0, 1, 1, 2, 1,
2, 0, 0, 0, 1, 1, 0, 0, 0, 2, 1), Decapoda = c(0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1), Diptera = c(6,
6, 14, 3, 16, 10, 12, 0, 3, 9, 6, 5, 3, 10, 0, 9, 3, 11,
2, 8), Ephemeroptera = c(5, 6, 4, 1, 3, 1, 3, 1, 0, 2, 0,
2, 2, 2, 0, 0, 0, 0, 1, 0)), .Names = c(Date, RiverMile,
Site, location, Amphipoda, Coleoptera, Decapoda, Diptera,
Ephemeroptera), row.names = c(61 2006/10, 119 2006/10,
148 2006/10, 179 2006/10, 185 2006/10, BC 2006/10, 190 2006/10,
HC 2006/10, 198 2006/10, 202 2006/10, 215 2006/10, 61 2006/12,
119 2006/12, 148 2006/12, 179 2006/12, 185 2006/12, BC 2006/12,
190 2006/12, HC 2006/12, 198 2006/12), class = c(cast_df,
data.frame)))

replace(taxa, taxa0, 1)

#Is preforms as I would like except that I only want to do this on
columns 5:19 and I can't just use

replace(taxa, taxa[,5:19]0, 1)

#any suggestions

Stephen Sefick

-- 
Stephen Sefick

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] rbind for matrices - rep argument

2009-01-07 Thread Henrique Dallazuanna
Try this:

m[rep(seq_len(nrow(m)), 3),]

On Wed, Jan 7, 2009 at 1:22 PM, Niccolò Bassani biostatist...@gmail.comwrote:

 Dear R users,I'm facing a trivial problem, but I really can't solve it.
 I've
 tried a dozen of codes, but I can't get the result I want.
 The question is: I have a dataframe like this one

 [,1] [,2] [,3] [,4] [,5]
 [1,]12345
 [2,]25549
 [3,]16812
 [4,]86415

 made up of decimal numbers, of course.
 I want to append this dataframe to itself a number x of times, i.e. 3. That
 is I want a dataframe like this


 [,1] [,2] [,3] [,4] [,5]
 [1,]12345
 [2,]25549
 [3,]16812
 [4,]86415
 [5,]12345
 [6,]25549
 [7,]16812
 [8,]86415
 [9,]12345
 [10,]25549
 [11,]16812
 [12,]86415

 I'm searching for an authomatic way to do this (I've already used the
 rbind re-writing x times the name of the frame...), as it must enter a
 function where one argument is exactly the number x of times to repeat this
 frame.

 Any ideas??
 Thanks in advance!

 Niccolò

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




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

[[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] rbind for matrices - rep argument

2009-01-07 Thread Ben Bolker
Dimitris Rizopoulos d.rizopoulos at erasmusmc.nl writes:

 
 you can use indexing, e.g.,
 
 mat - matrix(rnorm(20), 4, 5)
 
 mat
 mat[rep(1:nrow(mat), 3), ]
 
 I hope it helps.
 
 Best,
 Dimitris

  or matrix trickery:

z - as.data.frame(matrix(sample(1:9,20,replace=TRUE),nrow=4))
matrix(rep(as.matrix(z),3),ncol=ncol(z),byrow=TRUE)

  I do sometimes wish there were a more generic Rep() defined as

Rep - function(x,n) {
  result - list()
  for (i in 1:n) {
 result[[i]] - x
  }
  result
}

then one could say do.call(rbind,Rep(x,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.


Re: [R] rbind for matrices - rep argument

2009-01-07 Thread Carlos J. Gil Bellosta

On Wed, 2009-01-07 at 16:22 +0100, Niccolò Bassani wrote:
 Dear R users,I'm facing a trivial problem, but I really can't solve it. I've
 tried a dozen of codes, but I can't get the result I want.
 The question is: I have a dataframe like this one
 
 [,1] [,2] [,3] [,4] [,5]
 [1,]12345
 [2,]25549
 [3,]16812
 [4,]86415
 
 made up of decimal numbers, of course.
 I want to append this dataframe to itself a number x of times, i.e. 3. That
 is I want a dataframe like this
 
 
 [,1] [,2] [,3] [,4] [,5]
 [1,]12345
 [2,]25549
 [3,]16812
 [4,]86415
 [5,]12345
 [6,]25549
 [7,]16812
 [8,]86415
 [9,]12345
 [10,]25549
 [11,]16812
 [12,]86415
 
 I'm searching for an authomatic way to do this (I've already used the
 rbind re-writing x times the name of the frame...), as it must enter a
 function where one argument is exactly the number x of times to repeat this
 frame.
 
 Any ideas??
 Thanks in advance!

Hello,

If your matrix is

kk - matrix( 1:16, 4, 4)

You can do

kkk - lapply( 1:5, function(x) kk )
do.call(rbind, kkk)

You can write your code in a single line, though. I used 5 here as a
matter of example. You can build a function on these lines with an
arbitrary argument if need be.

Carlos J. Gil Bellosta
http://www.datanalytics.com



 Niccol
 
   [[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] Cannot access packages

2009-01-07 Thread JLucke
Although I have installed R many times on many machines without problems, 
I have recently encountered a problem with accessing packages.  R has been 
installed successfully with the --internet2 option. The session info is 
below. 
 sessionInfo()
R version 2.8.1 (2008-12-22) 
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 
loaded via a namespace (and not attached):
[1] tools_2.8.1
 

When I try to load a package (chron in this example) from the CMU 
mirror, I get the following error message:

 utils:::menuInstallPkgs()
--- Please select a CRAN mirror for use in this session ---
trying URL 
'http://lib.stat.cmu.edu/R/CRAN/bin/windows/contrib/2.8/chron_2.3-28.zip'
Error in download.file(url, destfile, method, mode = wb, ...) : 
  cannot open URL 
'http://lib.stat.cmu.edu/R/CRAN/bin/windows/contrib/2.8/chron_2.3-28.zip'
In addition: Warning message:
In download.file(url, destfile, method, mode = wb, ...) :
  cannot open: HTTP status was '403 Forbidden (Blocked by NG)'
Warning in download.packages(p0, destdir = tmpd, available = available,  :
  download of package 'chron' failed


This error applies to ANY package. The option --internet2 must be used. If 
not, then I cannot even access the mirror. Can anyone help me out?  Could 
this be a firewall problem?
Joe
[[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] Replace Function (How to replace numbers in a data frame with a specific number)

2009-01-07 Thread stephen sefick
very good thanks

On Wed, Jan 7, 2009 at 11:18 AM, Henrique Dallazuanna www...@gmail.com wrote:
 Try this:

  taxa[, 5:9][taxa[,5:9]  0] - 1


 On Wed, Jan 7, 2009 at 1:36 PM, stephen sefick ssef...@gmail.com wrote:

 taxa - (structure(list(Date = structure(c(4L, 4L, 4L, 4L, 4L, 4L, 4L,
 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L), .Label = c(2006/04,
 2006/05, 2006/07, 2006/10, 2006/12, 2007/02, 2007/04,
 2007/06, 2007/08, 2007/10, 2007/12, 2008/01), class = factor),
RiverMile = c(61L, 119L, 148L, 179L, 185L, 187L, 190L, 196L,
198L, 202L, 215L, 61L, 119L, 148L, 179L, 185L, 187L, 190L,
196L, 198L), Site = structure(c(9L, 1L, 2L, 3L, 4L, 10L,
5L, 11L, 6L, 7L, 8L, 9L, 1L, 2L, 3L, 4L, 10L, 5L, 11L, 6L
), .Label = c(119, 148, 179, 185, 190, 198, 202,
215, 61, BC, HC, SC), class = factor), location =
 structure(c(2L,
2L, 2L, 2L, 2L, 1L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
1L, 2L, 1L, 2L), .Label = c(creek, river), class = factor),
Amphipoda = c(0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1,
0, 1, 1, 0, 1), Coleoptera = c(1, 1, 4, 1, 0, 1, 1, 2, 1,
2, 0, 0, 0, 1, 1, 0, 0, 0, 2, 1), Decapoda = c(0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1), Diptera = c(6,
6, 14, 3, 16, 10, 12, 0, 3, 9, 6, 5, 3, 10, 0, 9, 3, 11,
2, 8), Ephemeroptera = c(5, 6, 4, 1, 3, 1, 3, 1, 0, 2, 0,
2, 2, 2, 0, 0, 0, 0, 1, 0)), .Names = c(Date, RiverMile,
 Site, location, Amphipoda, Coleoptera, Decapoda, Diptera,
 Ephemeroptera), row.names = c(61 2006/10, 119 2006/10,
 148 2006/10, 179 2006/10, 185 2006/10, BC 2006/10, 190 2006/10,
 HC 2006/10, 198 2006/10, 202 2006/10, 215 2006/10, 61 2006/12,
 119 2006/12, 148 2006/12, 179 2006/12, 185 2006/12, BC 2006/12,
 190 2006/12, HC 2006/12, 198 2006/12), class = c(cast_df,
 data.frame)))

 replace(taxa, taxa0, 1)

 #Is preforms as I would like except that I only want to do this on
 columns 5:19 and I can't just use

 replace(taxa, taxa[,5:19]0, 1)

 #any suggestions

 Stephen Sefick

 --
 Stephen Sefick

 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.



 --
 Henrique Dallazuanna
 Curitiba-Paraná-Brasil
 25° 25' 40 S 49° 16' 22 O




-- 
Stephen Sefick

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] Replace Function (How to replace numbers in a data frame with a specific number)

2009-01-07 Thread Henrique Dallazuanna
Try this:

 taxa[, 5:9][taxa[,5:9]  0] - 1


On Wed, Jan 7, 2009 at 1:36 PM, stephen sefick ssef...@gmail.com wrote:

 taxa - (structure(list(Date = structure(c(4L, 4L, 4L, 4L, 4L, 4L, 4L,
 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L), .Label = c(2006/04,
 2006/05, 2006/07, 2006/10, 2006/12, 2007/02, 2007/04,
 2007/06, 2007/08, 2007/10, 2007/12, 2008/01), class = factor),
RiverMile = c(61L, 119L, 148L, 179L, 185L, 187L, 190L, 196L,
198L, 202L, 215L, 61L, 119L, 148L, 179L, 185L, 187L, 190L,
196L, 198L), Site = structure(c(9L, 1L, 2L, 3L, 4L, 10L,
5L, 11L, 6L, 7L, 8L, 9L, 1L, 2L, 3L, 4L, 10L, 5L, 11L, 6L
), .Label = c(119, 148, 179, 185, 190, 198, 202,
215, 61, BC, HC, SC), class = factor), location =
 structure(c(2L,
2L, 2L, 2L, 2L, 1L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
1L, 2L, 1L, 2L), .Label = c(creek, river), class = factor),
Amphipoda = c(0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1,
0, 1, 1, 0, 1), Coleoptera = c(1, 1, 4, 1, 0, 1, 1, 2, 1,
2, 0, 0, 0, 1, 1, 0, 0, 0, 2, 1), Decapoda = c(0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1), Diptera = c(6,
6, 14, 3, 16, 10, 12, 0, 3, 9, 6, 5, 3, 10, 0, 9, 3, 11,
2, 8), Ephemeroptera = c(5, 6, 4, 1, 3, 1, 3, 1, 0, 2, 0,
2, 2, 2, 0, 0, 0, 0, 1, 0)), .Names = c(Date, RiverMile,
 Site, location, Amphipoda, Coleoptera, Decapoda, Diptera,
 Ephemeroptera), row.names = c(61 2006/10, 119 2006/10,
 148 2006/10, 179 2006/10, 185 2006/10, BC 2006/10, 190 2006/10,
 HC 2006/10, 198 2006/10, 202 2006/10, 215 2006/10, 61 2006/12,
 119 2006/12, 148 2006/12, 179 2006/12, 185 2006/12, BC 2006/12,
 190 2006/12, HC 2006/12, 198 2006/12), class = c(cast_df,
 data.frame)))

 replace(taxa, taxa0, 1)

 #Is preforms as I would like except that I only want to do this on
 columns 5:19 and I can't just use

 replace(taxa, taxa[,5:19]0, 1)

 #any suggestions

 Stephen Sefick

 --
 Stephen Sefick

 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.




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

[[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] R in the NY Times

2009-01-07 Thread David M Smith
On Wed, Jan 7, 2009 at 6:39 AM, Tony Breyal tony.bre...@googlemail.com wrote:
 Thank you for posting this, I found it a very enjoyable read!

 I am curious, is there an archive of 'R in the Media' or 'R in the
 Press' articles somewhere? It would be interesting to see how the
 perception of R has changed/evolved over time relative to other
 packages.

That's a great idea, and I just created an Rmedia category on the
REvolutions R blog to track exactly such articles.  You can find it
here:

http://blog.revolution-computing.com/rmedia/

If anyone knows of any other mainstream articles about R available
online please let me know, and I'll do a round-up post in that section
to make sure they're captured.

By the way, we're writing about R and issues related to R daily at:

http://blog.revolution-computing.com

# David Smith

-- 
David M Smith da...@revolution-computing.com
Director of Community, REvolution Computing www.revolution-computing.com
Tel: +1 (206) 577-4778 x3203 (Seattle, USA)

__
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] R in the NY Times

2009-01-07 Thread Bryan Hanson
I believe the SAS person shot themselves in the foot more in more ways than
one.  In my mind, the reason you would pay, as Frank said, for
 
 non-peer-reviewed software with hidden implementations of analytic
 methods that cannot be reproduced by others

Would be so that you can sue them later when a software problem in the
designing of the engine makes your plane fall out of the sky!

Bryan
*
Bryan Hanson
Professor of Chemistry  Biochemistry
DePauw University, Greencastle IN USA


 ³I think it addresses a niche market for high-end data analysts that
 want free, readily available code, said Anne H. Milley, director of
 technology product marketing at SAS. She adds, ³We have customers who
 build engines for aircraft. I am happy they are not using freeware
 when I get on a jet.²
 
 
 Thanks for posting.  Does anyone else find the statement by SAS to be
 humourous yet arrogant and short-sighted?
 
 Kevin

__
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] Problem with ggplot2 - facet_wrap and boxplot

2009-01-07 Thread David Hajage
Hello R users and Hadley,

Back again with a little problem in ggplot2 =o) (ggplot 0.8.1, R 2.8.0)

Here the problem :

library(ggplot2)

df - data.frame(id = 1:100, x1 = c(rnorm(50), rnorm(50, 1)), x2 =
c(rnorm(50), rnorm(50, 1.5)), x3 = c(rnorm(50, 0.5), rnorm(50, 2.5)), group
= as.factor(rep(c(a, b), each = 50)))
df.melt - melt(df, id = c(id, group))
head(df.melt)

p - ggplot(df.melt, aes(variable, value))
p + geom_boxplot(aes(fill = group))
# This graph is great, but I would like to have two panels, one for group
'a', and one for group 'b'
# With this code, I can't have one boxplot for each variable x1, x2 and x3
p + geom_boxplot(aes(fill = group)) + facet_wrap(~group)
# but it's working with geom_point
p + geom_point(aes(color = group)) + facet_wrap(~group)

Best regards.

david

[[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] heatmap.2 and three colours for specific ran gesþ

2009-01-07 Thread YH Deng
a-matrix(rnorm(36,1,3),6,6)
ifelse(a(-1),1,ifelse(a=1a=-1,2,3))
heatmap.2(a, col=rev(redgreen(3)))

HTH

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Daren Tan
Sent: January 6, 2009 11:53 PM
To: r-help@r-project.org
Subject: [R] heatmap.2 and three colours for specific rangesþ

Hi,

I hope to show a heatmap with thre colours, no gradation. How to specify
heatmap.2 to map green for values less than -1, gray for values between
-1 and 1, and red for values greater than 1 ?

Thanks

[[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] R in the NY Times

2009-01-07 Thread Marc Schwartz
I would also point out that the use of the term freeware as opposed to
FOSS by the SAS rep, comes off as being unprofessional and
deliberately condescending...

The author of the article, to his credit, was pretty consistent in using
open source terminology.

Regards,

Marc

on 01/07/2009 10:26 AM Bryan Hanson wrote:
 I believe the SAS person shot themselves in the foot more in more ways than
 one.  In my mind, the reason you would pay, as Frank said, for
  
 non-peer-reviewed software with hidden implementations of analytic
 methods that cannot be reproduced by others
 
 Would be so that you can sue them later when a software problem in the
 designing of the engine makes your plane fall out of the sky!

__
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] smoothed contour lines

2009-01-07 Thread Greg Snow
Here is one possible approach to get you started (this is not a final answer):

x - seq(-3,3)
y - seq(-3,3)

z - outer(x,y, function(x,y,...) x^2 + y^2 )

tmp - contourLines(x,y,z)

contour(x,y,z, lty=0)
lapply(tmp, function(l) {
x - l$x
y - l$y
if( length(x)  2 ){
if( isTRUE( all.equal( c(x[1],y[1]), 
c(x[length(x)],y[length(y)] {
xspline(x[-1],y[-1], -1, FALSE)
} else {
xspline(x, y, -1, TRUE)
}
} else {
lines(x,y) # or whatever else should go here
}
} )


You can play with the settings to xspline to control the properties of the 
curves, also it will look better if you thin some of the points from 
contourLines (the points that are nearly identical cause the small loops).

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
 project.org] On Behalf Of Andrea Storto
 Sent: Tuesday, January 06, 2009 9:52 AM
 To: r-help@r-project.org
 Subject: [R] smoothed contour lines
 
 Hi all,
 
 I'm trying to draw a contour plot
 with rounded (smoothed) contour lines instead of sharp angles;
 when the grid consists of only a few points
 in x- and y- axis, the resulting contour
 is in facts rather ugly since very sharp angles may appear.
 
 I did not find any way to do it,
 by using either contour or contourplot (from the lattice package),
 I wonder if there exist a way for smoothing the angles,
 apart from artificially increasing the grid resolution,
 
 Thanks in advance
 
 Andrea
 
 __
 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] Question about the RWEKA package

2009-01-07 Thread Achim Zeileis

On Wed, 7 Jan 2009, Häring, Tim (LWF) wrote:


Dear List,

I´m trying to implement the functionalities from WEKA into my modeling project 
in R through the RWeka package.
In this context I have a slightly special question about the filters 
implemented in WEKA.
I want to convert nominal attributes with k values into k binary attributes through the 
NominalToBinary filter (weka.filters.supervised.attribute.NominalToBinary). 
But unfortunately I can`t apply the filter to my data.
Here is my code:

nombi - make_Weka_filter(weka/filters/supervised/attribute/NominalToBinary)
x2bin - nombi(data=dat, control =Weka_control(N=TRUE, A=TRUE))

I didn't get an error message, but it still don't work. My nominal 
attribute is of class factor.


I do get a warning or an error, depending on what dat is exactly...


Maybe the problem has to do with the argument list.
Argument list:
 (formula, data, subset, na.action, control = NULL)
What is meant with the argument formula?


You need to supply formulas for filters, specifying which variables should 
be involved. For unsupervised filters, such as Normalize(), this is not 
very intuitive, but for supervised filters like Discretize() or your 
nombi() it seems quite natural. See

  help(Discretize, package = RWeka)
for an example.

hth,
Z


Any advice? I`d be glad for any hint!
I`m using R 2.7.2 and RWEKA 0.3-14

TIM
---
Dipl.-Geogr. Tim Häring
Sachgebiet Standort und Bodenschutz (SG 2.1)
Bayerische Landesanstalt für Wald und Forstwirtschaft
Am Hochanger 11
D-85354 Freising

E-Mail: tim.haer...@lwf.bayern.de
http://www.lwf.bayern.de




[[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] R Threatens SAS According to The NYT

2009-01-07 Thread Martin Maechler
 MM == Martin Maechler maech...@stat.math.ethz.ch
 on Wed, 7 Jan 2009 14:18:24 +0100 writes:

[..]

MM At the bottom of the page it says

MM  __ A version of this article appeared in print on
MM January 7, 2009, __ on page B6 of the New York edition.

MM Now if any the NYT (print version) subscribers on R-help
MM are willing to fulfill a New Year's wish for me, I'd be
MM very grateful for a (digital scan) copy of that page.

MM Martin Maechler, ETH Zurich

Just to let you know: As often, I'm overwhelmed by the
helpfulness of several R-help readers in this issue, and I'm
already expecting more than one copy.

Thank you very much in advance!
Martin

MM [..]

 Thought you might be interested in reading this article,
 which appears in the 1/6/9 online edition of The New
 York Times:
 
 
http://www.nytimes.com/2009/01/07/technology/business-computing/07program.html
 
 The headline is Data Analysts Captivated by R's Power,
[]

__
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] Problem with ggplot2 - facet_wrap and boxplot

2009-01-07 Thread hadley wickham
Hi David,

 Here the problem :

 library(ggplot2)

 df - data.frame(id = 1:100, x1 = c(rnorm(50), rnorm(50, 1)), x2 =
 c(rnorm(50), rnorm(50, 1.5)), x3 = c(rnorm(50, 0.5), rnorm(50, 2.5)), group
 = as.factor(rep(c(a, b), each = 50)))
 df.melt - melt(df, id = c(id, group))
 head(df.melt)

 p - ggplot(df.melt, aes(variable, value))
 p + geom_boxplot(aes(fill = group))
 # This graph is great, but I would like to have two panels, one for group
 'a', and one for group 'b'
 # With this code, I can't have one boxplot for each variable x1, x2 and x3
 p + geom_boxplot(aes(fill = group)) + facet_wrap(~group)
 # but it's working with geom_point
 p + geom_point(aes(color = group)) + facet_wrap(~group)

This is an annoying bug I haven't figure out how to fix yet.  The
basic problem is that if you facet by a variable that has the same
name as an aesthetic, it overrides that aesthetic (group in this
case).  Unfortunately, currently the only work around is call the
variable something other than group.

Regards,

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.


[R] Multinomial Logit Model

2009-01-07 Thread ryan

   I'm attempting to creat multinomial logistic regression model using the
   following code:



   mlogit- vglm(ME ~ HIST,family=multinomial(),na.action = na.pass)

   ME (dependent variable) has three levels (0,1,2)



   How do I declare a reference outcome (either 0,1,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] R in the NY Times

2009-01-07 Thread Andrew Choens

 Unfortunately, that type of FUD issued by the SAS marketing person still
 works. I see it at my employer (a large healthcare company.) It's a
 battle to change a culture, but ironically the recession helps.
 People are now taking notice of the obscene licensing fees for SAS.
 
 Darin

I agree. I work for a consulting firm (human services) and my boss
prefers us to use SPSS, rather than R. It's painful. I have version 11
installed on my Windows laptop. Next year, the license expires! 

For someone coming from a SPSS background, R is a little mind-blowing,
simply because it is so much more powerful. But, perseverance pays off.
Once I master Sweave and such, I'll be able to churn out reports much
more quickly than I ever could with SPSS.

I do wish the author of the article had included comments from SPSS, in
addition to the humorous FUD from the SAS spokesperson. Newer versions
of SPSS actually have the option of using R for data analysis, in
addition to the SPSS engine. It would have been interesting to compare
the corporate responses of the two companies.

-- 
Insert something humorous here.  :-)

__
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] rbind for matrices - rep argument

2009-01-07 Thread Ted Harding
On 07-Jan-09 15:22:57, Niccolò Bassani wrote:
 Dear R users,I'm facing a trivial problem, but I really can't solve it.
 I've tried a dozen of codes, but I can't get the result I want.
 The question is: I have a dataframe like this one
 
 [,1] [,2] [,3] [,4] [,5]
 [1,]12345
 [2,]25549
 [3,]16812
 [4,]86415
 
 made up of decimal numbers, of course.
 I want to append this dataframe to itself a number x of times, i.e. 3.
 That is I want a dataframe like this
 
 [,1] [,2] [,3] [,4] [,5]
 [1,]12345
 [2,]25549
 [3,]16812
 [4,]86415
 [5,]12345
 [6,]25549
 [7,]16812
 [8,]86415
 [9,]12345
 [10,]25549
 [11,]16812
 [12,]86415
 
 I'm searching for an authomatic way to do this (I've already used the
 rbind re-writing x times the name of the frame...), as it must enter a
 function where one argument is exactly the number x of times to repeat
 this frame.
 
 Any ideas??
 Thanks in advance!
 Niccolò

I don't know whether there is anywhere a ready-made function which
will implement a rep paramater for an rbind, but the following ad-hoc
function will do it for you efficiently (i.e. with the minimum number
of applications of the rbind() function).

To produce a result which consists of k replicates of x, row-bound:


  Krbind - function(x,k){
y - x
if(k==1) return(x)
p - floor(log2(k))
for(i in (1:p)){
  z - rbind(y,y)
  y - z
}
k - (k - 2^p)
if(k==0) return(y) else return(rbind(y,Krbind(x,k)))
  }

## Example:

  Xdf - data.frame(X1=c(1.1,1.2),X2=c(2.1,2.2),
X3=c(3.1,3.2),X4=c(4.1,4.2))

  Krbind(Xdf,6)
# X1  X2  X3  X4
# 1  1.1 2.1 3.1 4.1
# 2  1.2 2.2 3.2 4.2
# 3  1.1 2.1 3.1 4.1
# 4  1.2 2.2 3.2 4.2
# 5  1.1 2.1 3.1 4.1
# 6  1.2 2.2 3.2 4.2
# 7  1.1 2.1 3.1 4.1
# 8  1.2 2.2 3.2 4.2
# 9  1.1 2.1 3.1 4.1
# 10 1.2 2.2 3.2 4.2
# 11 1.1 2.1 3.1 4.1
# 12 1.2 2.2 3.2 4.2

Of course, if you're not worried by efficiency, then the simple loop

  y - x
  for(i in (1:(k-1))){y - rbind(y,x)}

will do it!

Hoping this helps,
Ted.


E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk
Fax-to-email: +44 (0)870 094 0861
Date: 07-Jan-09   Time: 18:08:14
-- XFMail --

__
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] R Stacked Histogram

2009-01-07 Thread Jason Rupert
Sweet!  The missing e.  That was it!  Yeah!  Thanks again.   I guess I will 
get some sleep tonight.  
 
Well, one last questions about stack plot (please forgive the lame example 
below).  I thought the below allow me to resize the the title of the stacked 
histogram, but no luck.  Any suggestions as to the modificaiton necessary to 
get it to work?  Right now the title is obscured by the plot and my boss will 
be none too happy.  Thanks again.  
 
I think this is my last stumper question for the day:).
 
 
library(ggplot2)
 
rnorm_test_data_1-rnorm(100,3,1)
rnorm_test_data_2-rnorm(100,3,1)
nor_1-cbind(Test=norm1, Data=rnorm_test_data_1)
nor_2-cbind(Test=norm2, Data=rnorm_test_data_1)
nor_data-rbind(nor_1, nor_2)
nor_data_frame-data.frame(Test=nor_data[,1],Data=nor_data[,2])
qplot(nor_data_frame$Data, data = nor_data_frame, binwidth = 3.0, 
  fill = nor_data_frame$Test,
  main = list(as.character(Test Histogram, cex=0.7, font=7)))
 
 sessionInfo()
R version 2.8.0 (2008-10-20) 
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] grid  stats graphics  grDevices utils datasets  methods   
base 
other attached packages:
 [1] ggplot2_0.8.1  reshape_0.8.2  RColorBrewer_1.0-2 proto_0.3-8   
 [5] plyr_0.1.4 nortest_1.0    fBasics_280.74 timeSeries_290.79 
 [9] timeDate_290.81    vcd_1.2-1  MASS_7.2-44    colorspace_1.0-0  
 


--- On Wed, 1/7/09, hadley wickham h.wick...@gmail.com wrote:

From: hadley wickham h.wick...@gmail.com
Subject: Re: [R] R Stacked Histogram
To: jasonkrup...@yahoo.com
Cc: r-help@r-project.org
Date: Wednesday, January 7, 2009, 9:20 AM

On Wed, Jan 7, 2009 at 7:55 AM, Jason Rupert jasonkrup...@yahoo.com
wrote:
 That worked!  Thank you very much for the help.

 I think I have one last question about qplot in ggplot2, That is exporting
the plot to JPG while in a loop.   I tried what was recommended in Re: [R]
jpeg() creating empty files with qplot() in a loop, however, I received
some errors (see below).  I also tried using a PDF, but that did not work
either, i.e. the PDF produced was blank.  Oddly enough the results produced
using dev.print(file=qplot_output.jpg, device=jpeg, width=600)
 in a loop are blank, i.e. the JPG file is there, but it is blank. 
Unfortunately,  ggsave(file=ggsave_qplot_output.jpg)
does not even produce a JPG file output.  Any help at this point is greatly
appreciated.  Is the problem related to the fact that I need to use the plain
hist and dev.print prior to using ggplot's qplot?

If you're using ggsave, you don't need to use the dev functions.  The
following should be sufficient:

qplot(rnorm_test_data, geom = histogram, binwidth = 1) +
 scale_x_continuous(Test Data) +
scale_y_continuous(Frequency) +
 scale_fill_discrete(qplot histogram)
ggsave(file = ggsave_qplot_output.pdf)

# Unfortunately due to a small bug in the current version of ggplot,
you need to use
# jpeg with an e to get jpegs
ggsave(file = ggsave_qplot_output.jpeg)

# But I'd recommend using png instead - much better quality
ggsave(file = ggsave_qplot_output.png)

# One final problem is that you're going to overwrite the plot
# on each run of your loop.  You probably want something like:

ggsave(file = paste(ggsave_qplot_output_, i, .png, sep
=))

Hadley

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



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

2009-01-07 Thread Simon Knapp
Dear R Users,

 

I have a couple of proto objects like:

 

wedge - proto(expr={

start.year - 2008

end.year - 2050

})

 

star.rating - wedge$proto(

star = c(4, 5, 8, 10),

gain = c(0, .3, .5, .7),

cost = c(0, 2100, 4000, 7500),



star.rating - function(., year) 6.0,

 

setup = function(.){

.$cost.for.star - approxfun(.$star, .$cost)

.$gain.for.star - approxfun(.$star, .$gain)

},

 

test = function(., year) {

gs - .$with(gain.for.star)(.$star.rating(year))

}

)

 

 

 

And a function to create and modify 'instances':

 

create.star.rating - function(switch.years, star.ratings) {

res - star.rating$proto(switch.years = switch.years, star.ratings =
star.ratings)

res$setup()

res

}

 

 

When I use them as follows:

ee - create.star.rating(ratings, switch.years)

ee$test(2009)

 

 

The second line gives me the error message:

Error in .$with(gain.for.star)(.$star.rating(year)) : 

   object y not found

 

I understand why this happens (when objects are inserted into a proto
their environment is set to that of the proto)... but I can't figure out
how to get around it!

 

I have tried setting the environments of the functions created in setup
as follows:

 

setup = function(.){

t1 - approxfun(.$star, .$cost)

t2 - approxfun(.$star, .$gain)

.$cost.for.star - t1

.$gain.for.star - t2

environment(.$cost.for.star) - environment(t1)

environment(.$gain.for.star) - environment(t2)

}

 

 

But then I get the error:

Error in get(gain.for.star, env = `*tmp*`, inherits = TRUE) : 

  object *tmp* not found

 

 

Which I think occurs because the last two lines in 'setup' only create
references to their respective environments which disappear on exit of
'setup'.

 

 

 

Any ideas?

 

Regards,

Simon Knapp.

 


[[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] New York Times Article: Data Analysts Captivated by R's Power

2009-01-07 Thread Arthur Burke
Readers of this list might be interested in the following article in the
New York Times and might find amusing the notion that Some people
familiar with R describe it as a supercharged version of Microsoft's
Excel spreadsheet software
 
http://www.nytimes.com/2009/01/07/technology/business-computing/07progra
m.html?_r=1ref=technology
 
Art
-- 

Art Burke
Northwest Regional Educational Laboratory
101 SW Main St, Suite 500
Portland, OR 97204-3213

Phone:  503-275-9592 / 800-547-6339

Fax: 503-275-0450

bur...@nwrel.org 




  




[[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] how to estimate overdispersion in glmer models?

2009-01-07 Thread lcayuela
Dear all,

I am using function glmer from package lme4 to fit a generalized linear
mixed effect model. My model is as follows:

model1 - glmer(fruitset ~ Dist*wire + (1|Site), data, binomial)
summary(model1)

Generalized linear mixed model fit by the Laplace approximation
Formula: fruitset ~ Dist * wire + (1 | Site)
   Data: data
   AIC   BIC logLik deviance
 68.23 70.65 -29.1158.23
Random effects:
 Groups NameVariance   Std.Dev.
 Lugar  (Intercept) 3.5155e-14 1.8750e-07
Number of obs: 12, groups: Lugar, 2

Fixed effects:
   Estimate Std. Error z value Pr(|z|)
(Intercept)   -2.332132   0.856518  -2.723 0.006473 **
Dist   0.001137   0.001141   0.997 0.318902
WireControl   4.710750   1.196550   3.937 8.25e-05 ***
Dist:WireControl -0.006180   0.001769  -3.494 0.000475 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
(Intr) Dist   WirCnt
Dist-0.963
WireContrl -0.716  0.689
Dst:WirCntr  0.621 -0.645 -0.957

My question is, how can I check for overdispersion? In glm models you can
check this by comparing the residual deviance with the residual degrees of
freedom, but in glmer you don't get this information.

Does anyone know how to get information about overdispersion in the model?

Thanks in advance for your help,

(Ubuntu Intrepid Ibex / R 2.7.1)

Luis Cayuela
Investigador Post-doctoral
Grupo de Ecología Terrestre
Departamento de Ecología
Centro Andaluz de Medio Ambiente, Universidad de Granada - Junta de Andalucía
Avda. del Mediterráneo S/N. 18006. Granada. España
email: lcayu...@ugr.es
Fax: +34 958137246
Tel: +34 958241000 (ext. 31202)

__
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] Fw: Re: R Stacked Histogram

2009-01-07 Thread hadley wickham
Hi Jason,

 Well, one last questions about stack plot (please forgive the lame example
 below).  I thought the below allow me to resize the the title of the
 stacked histogram, but no luck.  Any suggestions as to the modificaiton
 necessary to get it to work?  Right now the title is obscured by the plot
 and my boss will be none too happy.  Thanks again.

Yes, that's a really stupid bug that I accidentally introduced in the
latest version.  You can fix it with:

qplot(mpg, wt, data = mtcars, main = My title) + opts(plot.title =
theme_text(vjust = 0, size = 16))

or by adding a new line to the end of the title:

qplot(mpg, wt, data = mtcars, main = My title\n)

Regards,

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] rbind for matrices - rep argument

2009-01-07 Thread Patrick Burns

Ben Bolker wrote:

Dimitris Rizopoulos d.rizopoulos at erasmusmc.nl writes:

  

you can use indexing, e.g.,

mat - matrix(rnorm(20), 4, 5)

mat
mat[rep(1:nrow(mat), 3), ]

I hope it helps.

Best,
Dimitris



  or matrix trickery:

z - as.data.frame(matrix(sample(1:9,20,replace=TRUE),nrow=4))
matrix(rep(as.matrix(z),3),ncol=ncol(z),byrow=TRUE)

  I do sometimes wish there were a more generic Rep() defined as

Rep - function(x,n) {
  result - list()
  for (i in 1:n) {
 result[[i]] - x
  }
  result
}

then one could say do.call(rbind,Rep(x,3))
  


You mean like:

do.call('rbind', rep(list(x), 3))

Patrick Burns
patr...@burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and A Guide for the Unwilling S User)

__
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] R in the NY Times

2009-01-07 Thread Ajay ohri
you can use google alerts to track media coverage of R using some keywords

regards,

ajay



On Wed, Jan 7, 2009 at 9:52 PM, David M Smith 
da...@revolution-computing.com wrote:

 On Wed, Jan 7, 2009 at 6:39 AM, Tony Breyal tony.bre...@googlemail.com
 wrote:
  Thank you for posting this, I found it a very enjoyable read!
 
  I am curious, is there an archive of 'R in the Media' or 'R in the
  Press' articles somewhere? It would be interesting to see how the
  perception of R has changed/evolved over time relative to other
  packages.

 That's a great idea, and I just created an Rmedia category on the
 REvolutions R blog to track exactly such articles.  You can find it
 here:

 http://blog.revolution-computing.com/rmedia/

 If anyone knows of any other mainstream articles about R available
 online please let me know, and I'll do a round-up post in that section
 to make sure they're captured.

 By the way, we're writing about R and issues related to R daily at:

 http://blog.revolution-computing.com

 # David Smith

 --
 David M Smith da...@revolution-computing.com
 Director of Community, REvolution Computing www.revolution-computing.com
 Tel: +1 (206) 577-4778 x3203 (Seattle, USA)

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


Re: [R] R in the NY Times

2009-01-07 Thread Ted Harding
On 07-Jan-09 18:03:19, Erik Iverson wrote:
 I pointed a friend of mine toward the article, to which he replied: 
 
 I hope that they run SAS on Solaris too, god only knows how tainted
 the syscalls are in that linux freeware.
 
 Of course, now Solaris is 'freeware', too, so I suppose that according
 to SAS, running SAS on Windows is the best way to be sure you're
 getting the right answers.

I'm not so sure about that. Since the article described R as
a supercharged version of Microsoft's Excel, surely people
should run R on Windows and be *ab*so*lute*ly* sure of getting
the right answers (and supercharged to boot)
Ted.

 
 On Wed, 07 Jan 2009 10:56:53 -0600, Marc Schwartz
 marc_schwa...@comcast.net wrote:
 I would also point out that the use of the term freeware as opposed
 to
 FOSS by the SAS rep, comes off as being unprofessional and
 deliberately condescending...
 
 The author of the article, to his credit, was pretty consistent in
 using
 open source terminology.
 
 Regards,
 
 Marc
 
 on 01/07/2009 10:26 AM Bryan Hanson wrote:
 I believe the SAS person shot themselves in the foot more in more
 ways
 than
 one.  In my mind, the reason you would pay, as Frank said, for

 non-peer-reviewed software with hidden implementations of analytic
 methods that cannot be reproduced by others

 Would be so that you can sue them later when a software problem in
 the
 designing of the engine makes your plane fall out of the sky!
 
 __
 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.


E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk
Fax-to-email: +44 (0)870 094 0861
Date: 07-Jan-09   Time: 18:30:39
-- XFMail --

__
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] R in the NY Times

2009-01-07 Thread Barry Rowlingson
2009/1/7 Darin A. England engl...@cs.umn.edu:

 Unfortunately, that type of FUD issued by the SAS marketing person still
 works. I see it at my employer (a large healthcare company.)

 I see it here, at a university. Quote: We couldn't possibly do our
analysis using some software we've just downloaded from a web site
*facepalm*

 It's a
 battle to change a culture, but ironically the recession helps.
 People are now taking notice of the obscene licensing fees for SAS.

 They'll just keep increasing their educational discount, or as we
say, the first hit is free...

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.


Re: [R] Problem with ggplot2 - facet_wrap and boxplot

2009-01-07 Thread David Hajage
o.

Well, it's working (replace 'group' by 'trt')

Thank you very much Hadley.

david

2009/1/7 hadley wickham h.wick...@gmail.com

 Hi David,

  Here the problem :
 
  library(ggplot2)
 
  df - data.frame(id = 1:100, x1 = c(rnorm(50), rnorm(50, 1)), x2 =
  c(rnorm(50), rnorm(50, 1.5)), x3 = c(rnorm(50, 0.5), rnorm(50, 2.5)),
 group
  = as.factor(rep(c(a, b), each = 50)))
  df.melt - melt(df, id = c(id, group))
  head(df.melt)
 
  p - ggplot(df.melt, aes(variable, value))
  p + geom_boxplot(aes(fill = group))
  # This graph is great, but I would like to have two panels, one for group
  'a', and one for group 'b'
  # With this code, I can't have one boxplot for each variable x1, x2 and
 x3
  p + geom_boxplot(aes(fill = group)) + facet_wrap(~group)
  # but it's working with geom_point
  p + geom_point(aes(color = group)) + facet_wrap(~group)

 This is an annoying bug I haven't figure out how to fix yet.  The
 basic problem is that if you facet by a variable that has the same
 name as an aesthetic, it overrides that aesthetic (group in this
 case).  Unfortunately, currently the only work around is call the
 variable something other than group.

 Regards,

 Hadley

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


[[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] generating data

2009-01-07 Thread berzasca

How do I simulate data with 100 points from a normal distribution with n=200,
mean (5,0), and Σ=matrix(1,0,0,0.1). After how do I plot the dataset and
include cluster centers found?
-- 
View this message in context: 
http://www.nabble.com/generating-data-tp21337173p21337173.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] Cannot access packages

2009-01-07 Thread Uwe Ligges



jlu...@ria.buffalo.edu wrote:
Although I have installed R many times on many machines without problems, 
I have recently encountered a problem with accessing packages.  R has been 
installed successfully with the --internet2 option. The session info is 
below. 

sessionInfo()
R version 2.8.1 (2008-12-22) 
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 
loaded via a namespace (and not attached):

[1] tools_2.8.1

When I try to load a package (chron in this example) from the CMU 
mirror, I get the following error message:



utils:::menuInstallPkgs()

--- Please select a CRAN mirror for use in this session ---
trying URL 
'http://lib.stat.cmu.edu/R/CRAN/bin/windows/contrib/2.8/chron_2.3-28.zip'
Error in download.file(url, destfile, method, mode = wb, ...) : 
  cannot open URL 
'http://lib.stat.cmu.edu/R/CRAN/bin/windows/contrib/2.8/chron_2.3-28.zip'

In addition: Warning message:
In download.file(url, destfile, method, mode = wb, ...) :
  cannot open: HTTP status was '403 Forbidden (Blocked by NG)'
Warning in download.packages(p0, destdir = tmpd, available = available,  :
  download of package 'chron' failed


This error applies to ANY package. The option --internet2 must be used. If 
not, then I cannot even access the mirror. Can anyone help me out?  Could 
this be a firewall problem?


Mirror problem, I guess. Just try another mirror.

Uwe Ligges




Joe
[[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] smoothed contour lines

2009-01-07 Thread William Dunlap
 Greg Snow Greg.Snow at imail.org
 Wed Jan 7 17:58:07 CET 2009
 
 Here is one possible approach to get you started (this is not a final
answer):
 
 x - seq(-3,3)
 y - seq(-3,3)
 
 z - outer(x,y, function(x,y,...) x^2 + y^2 )
 
 tmp - contourLines(x,y,z)

 contour(x,y,z, lty=0)
 lapply(tmp, function(l) {
   x - l$x
   y - l$y
   if( length(x)  2 ){
   if( isTRUE( all.equal( c(x[1],y[1]),
c(x[length(x)],y[length(y)] {
   xspline(x[-1],y[-1], -1, FALSE)
   } else {
   xspline(x, y, -1, TRUE)
   }
   } else {
   lines(x,y) # or whatever else should go here
   }
 } )


You can play with the settings to xspline to control the properties 
of the curves, also it will look better if you thin some of the points
 from contourLines (the points that are nearly identical cause the
small loops).
 
 Hope this helps,

 -- 
 Gregory (Greg) L. Snow Ph.D.
 Statistical Data Center
 Intermountain Healthcare
 greg.snow at imail.org
 801.408.8111

It often works better to fit a smooth surface to the data, evaluate
that surface on a finer grid, and pass the result to contour.  This
ensures that contour lines don't cross one another and tends to avoid
the spurious loops that you might get from smoothing the contour lines
themselves.

Thin plate splines (Tps from library(fields)) and loess (among others)
can fit the surface.  E.g., with your data try
   library(fields)
   xy-as.matrix(expand.grid(x=x,y=y))
 
contour(predict.surface(Tps(as.matrix(expand.grid(x=x,y=y)),as.vector(z)
)))
These surface fitters have arguments to control the smoothness/flatness
of the
surface.   

Bill Dunlap
TIBCO Software Inc - Spotfire Division
wdunlap tibco.com 

 -Original Message-
 From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
 project.org] On Behalf Of Andrea Storto
 Sent: Tuesday, January 06, 2009 9:52 AM
 To: r-help at r-project.org
 Subject: [R] smoothed contour lines
 
 Hi all,
 
 I'm trying to draw a contour plot
 with rounded (smoothed) contour lines instead of sharp angles;
 when the grid consists of only a few points
 in x- and y- axis, the resulting contour
 is in facts rather ugly since very sharp angles may appear.
 
 I did not find any way to do it,
 by using either contour or contourplot (from the lattice package),
 I wonder if there exist a way for smoothing the angles,
 apart from artificially increasing the grid resolution,
 
 Thanks in advance
 
 Andrea

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

2009-01-07 Thread Sarah Goslee
This sounds rather like homework. If so, then talk to your instructor for
help.

Otherwise:

First you go to R Site Search at http://finzi.psych.upenn.edu/search.html
or to google.

Then you search for normal distribution.
Then you search for plot.
Then you search for cluster.

If you have problems with that, then read the introduction to R documents,
and the R-help posting guide, and if you still can't figure it out you can ask
detailed and specific questions here.

Sarah

On Wed, Jan 7, 2009 at 1:16 PM, berzasca mioaratero...@yahoo.com wrote:

 How do I simulate data with 100 points from a normal distribution with n=200,
 mean (5,0), and Σ=matrix(1,0,0,0.1). After how do I plot the dataset and
 include cluster centers found?
 --
-- 
Sarah Goslee
http://www.stringpage.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] troubles performing Moran.I test

2009-01-07 Thread Barbara . Spillmann

dear R users,

I have troubles performing Moran.I test as suggested on  
http://www.ats.ucla.edu/stat/r/faq/morans_i.htm


my spatial data are longitude and lattitide of communities. The  
calculation of the inverse distance matrix according to the homepage  
(using my data)


datAL - read.csv2(C:\\Konvergenz AL.csv, header=T)

ALdist - as.matrix(dist(cbind(datAL$Länge, datAL$Breite)))
ALdist.inv - 1/ALdist
for (i in 1:dim(ALdist)[1]){ALdist.inv[i,i]=0}

seems to work since the first 10 elements of my matrix look like this:

   1  2  3  4  5
1 0. 0.06201737 0.06041221 0.03386427 0.05198752
2 0.06201737 0. 0.19611614 0.03562352 0.02964346
3 0.06041221 0.19611614 0. 0.03028913 0.03118914
4 0.03386427 0.03562352 0.03028913 0. 0.02138823
5 0.05198752 0.02964346 0.03118914 0.02138823 0.


the data which might be spatially autocorrelated is LN(Unem05/Unem98,  
the LN of the development in unemployment rates in the communities  
between 1998 and 2005. The first 5 elements of this vector are as  
follows:


CommLN(Unem05/Unem98)
1   0.21
2   0.08
3   0.22
4   0.05
5  -0.22

I have 426 communities in total and I don's see what might be wrong  
with the data...However, I have some NAs in there...

when I try to perform the test using:

Moran.I(datAL$LN.Rt05.Rt98., ALdist.inv, na.rm=TRUE)

I get the following error message:
Fehler in if (obs = ei) 2 * pv else 2 * (1 - pv) :
  Fehlender Wert, wo TRUE/FALSE nötig ist

in english something like
error in if (obs = ei) 2 * pv else 2 * (1 - pv) :
  missing value, where TRUE/FALSE is needed

can anyone give me a hint what is going wrong??

many thanks in advance!!

Barbara

__
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] proto question

2009-01-07 Thread Gabor Grothendieck
On Wed, Jan 7, 2009 at 10:22 AM, Simon Knapp
s.kn...@mmassociates.com.au wrote:
 Dear R Users,



 I have a couple of proto objects like:



 wedge - proto(expr={

start.year - 2008

end.year - 2050

 })



 star.rating - wedge$proto(

star = c(4, 5, 8, 10),

gain = c(0, .3, .5, .7),

cost = c(0, 2100, 4000, 7500),



star.rating - function(., year) 6.0,



setup = function(.){

.$cost.for.star - approxfun(.$star, .$cost)

.$gain.for.star - approxfun(.$star, .$gain)

},



test = function(., year) {

gs - .$with(gain.for.star)(.$star.rating(year))

}

 )







 And a function to create and modify 'instances':



 create.star.rating - function(switch.years, star.ratings) {

res - star.rating$proto(switch.years = switch.years, star.ratings =
 star.ratings)

res$setup()

res

 }





 When I use them as follows:

 ee - create.star.rating(ratings, switch.years)

Did you define switch.years somewhere?  The order of
arguments in the call to create.star.rating seems
reversed from the definition.  There may be other problems
too but suggest you start by fixing those.


 ee$test(2009)





 The second line gives me the error message:

 Error in .$with(gain.for.star)(.$star.rating(year)) :

   object y not found



 I understand why this happens (when objects are inserted into a proto
 their environment is set to that of the proto)... but I can't figure out
 how to get around it!



 I have tried setting the environments of the functions created in setup
 as follows:



 setup = function(.){

t1 - approxfun(.$star, .$cost)

t2 - approxfun(.$star, .$gain)

.$cost.for.star - t1

.$gain.for.star - t2

environment(.$cost.for.star) - environment(t1)

environment(.$gain.for.star) - environment(t2)

}





 But then I get the error:

 Error in get(gain.for.star, env = `*tmp*`, inherits = TRUE) :

  object *tmp* not found





 Which I think occurs because the last two lines in 'setup' only create
 references to their respective environments which disappear on exit of
 'setup'.







 Any ideas?



 Regards,

 Simon Knapp.

__
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] rbind for matrices - rep argument

2009-01-07 Thread Gabor Grothendieck
For matrices you can use kronecker:

 kronecker(rep(1, 6), data.matrix(Xdf))
  [,1] [,2] [,3] [,4]
 [1,]  1.1  2.1  3.1  4.1
 [2,]  1.2  2.2  3.2  4.2
 [3,]  1.1  2.1  3.1  4.1
 [4,]  1.2  2.2  3.2  4.2
 [5,]  1.1  2.1  3.1  4.1
 [6,]  1.2  2.2  3.2  4.2
 [7,]  1.1  2.1  3.1  4.1
 [8,]  1.2  2.2  3.2  4.2
 [9,]  1.1  2.1  3.1  4.1
[10,]  1.2  2.2  3.2  4.2
[11,]  1.1  2.1  3.1  4.1
[12,]  1.2  2.2  3.2  4.2


On Wed, Jan 7, 2009 at 1:08 PM, Ted Harding
ted.hard...@manchester.ac.uk wrote:
 On 07-Jan-09 15:22:57, Niccolò Bassani wrote:
 Dear R users,I'm facing a trivial problem, but I really can't solve it.
 I've tried a dozen of codes, but I can't get the result I want.
 The question is: I have a dataframe like this one

 [,1] [,2] [,3] [,4] [,5]
 [1,]12345
 [2,]25549
 [3,]16812
 [4,]86415

 made up of decimal numbers, of course.
 I want to append this dataframe to itself a number x of times, i.e. 3.
 That is I want a dataframe like this

 [,1] [,2] [,3] [,4] [,5]
 [1,]12345
 [2,]25549
 [3,]16812
 [4,]86415
 [5,]12345
 [6,]25549
 [7,]16812
 [8,]86415
 [9,]12345
 [10,]25549
 [11,]16812
 [12,]86415

 I'm searching for an authomatic way to do this (I've already used the
 rbind re-writing x times the name of the frame...), as it must enter a
 function where one argument is exactly the number x of times to repeat
 this frame.

 Any ideas??
 Thanks in advance!
 Niccolò

 I don't know whether there is anywhere a ready-made function which
 will implement a rep paramater for an rbind, but the following ad-hoc
 function will do it for you efficiently (i.e. with the minimum number
 of applications of the rbind() function).

 To produce a result which consists of k replicates of x, row-bound:


  Krbind - function(x,k){
y - x
if(k==1) return(x)
p - floor(log2(k))
for(i in (1:p)){
  z - rbind(y,y)
  y - z
}
k - (k - 2^p)
if(k==0) return(y) else return(rbind(y,Krbind(x,k)))
  }

 ## Example:

  Xdf - data.frame(X1=c(1.1,1.2),X2=c(2.1,2.2),
X3=c(3.1,3.2),X4=c(4.1,4.2))

  Krbind(Xdf,6)
 # X1  X2  X3  X4
 # 1  1.1 2.1 3.1 4.1
 # 2  1.2 2.2 3.2 4.2
 # 3  1.1 2.1 3.1 4.1
 # 4  1.2 2.2 3.2 4.2
 # 5  1.1 2.1 3.1 4.1
 # 6  1.2 2.2 3.2 4.2
 # 7  1.1 2.1 3.1 4.1
 # 8  1.2 2.2 3.2 4.2
 # 9  1.1 2.1 3.1 4.1
 # 10 1.2 2.2 3.2 4.2
 # 11 1.1 2.1 3.1 4.1
 # 12 1.2 2.2 3.2 4.2

 Of course, if you're not worried by efficiency, then the simple loop

  y - x
  for(i in (1:(k-1))){y - rbind(y,x)}

 will do it!

 Hoping this helps,
 Ted.

 
 E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk
 Fax-to-email: +44 (0)870 094 0861
 Date: 07-Jan-09   Time: 18:08:14
 -- XFMail --

 __
 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] Understanding dsyrk_ in C code

2009-01-07 Thread Douglas Bates
On Tue, Jan 6, 2009 at 8:54 PM, Nathan S. Watson-Haigh
nathan.watson-ha...@csiro.au wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 I'm trying to understand some C code in an R package I'm using. I'm address 
 this question here as
 it's matrix algebra...and I'm no pro at that!

 the C command reads:

 double alpha = 1.0, beta = 0.0;
 dsyrk_(L, N, nGenes, nGenes,  alpha, mat1, nGenes,
  beta, mat2, nGenes);

 - From google, I've found out that dsyrk is for performing one of the 
 symmetric rank k operations -
 whatever that means!? From here:
 http://linux.die.net/man/l/dsyrk

 I've found that the calculation being performed is:
 alpha*A*A' + beta*C

 However, since alpha is 1 and beta is 0, this reduces to:
 = 1*A*A' + 0*C
 = A*A'

 Which is simply the cross productam I correct?

Not quite.  The crossprod function in R computes A'A.  This particular
operation is what is computed by the tcrossprod function in R.

Another difference is that this call modifies only the diagonal and
lower triangle of mat2.  The tcrossprod function calls the same
underlying code then copies the lower triangle to the upper triangle
so as to produce a symmetric matrix.

When you are calling Lapack or BLAS routines from C it is helpful to
look at the declarations in include/R_ext/BLAS.h and
include/R_ext/Lapack.h

/* DSYRK - perform one of the symmetric rank k operations */
/* C := alpha*A*A' + beta*C or C := alpha*A'*A + beta*C */
BLAS_extern void
F77_NAME(dsyrk)(const char *uplo, const char *trans,
const int *n, const int *k,
const double *alpha, const double *a, const int *lda,
const double *beta, double *c, const int *ldc);

This helps to explain the mysterious L and N as the first two
arguments in the call.

By the way, the use of the literal name dsyrk_ in that code is risky.
It is preferable to use the macro F77_SUB(dsyrk) which is defined in
the include file include/R_ext/RS.h

If you are wondering what the difference between F77_SUB and F77_NAME
might be, there isn't a difference in R.  Long, long ago there was a
difference between the two macros in S and S-PLUS related to a
peculiar Fortran compiler, if I recall correctly.  Most of the time
these macros simply append an underscore to the name but there may
still be cases where something else occurs and it is best to allow for
those cases.

__
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] smoothed contour lines

2009-01-07 Thread Deepayan Sarkar
On Tue, Jan 6, 2009 at 8:52 AM, Andrea Storto andrea.sto...@met.no wrote:
 Hi all,

 I'm trying to draw a contour plot
 with rounded (smoothed) contour lines instead of sharp angles;
 when the grid consists of only a few points
 in x- and y- axis, the resulting contour
 is in facts rather ugly since very sharp angles may appear.

 I did not find any way to do it,
 by using either contour or contourplot (from the lattice package),
 I wonder if there exist a way for smoothing the angles,
 apart from artificially increasing the grid resolution,

?filled.contour is something to try out.

-Deepayan

__
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] Another newbie question

2009-01-07 Thread Peter Alspach
Kia ora Allen

I'm not sure what you have tried or what your level of understanding is.
However, if your dataframe is:
 allen
  sp1 sp2 sp3
1   0   0   1
2   1   0   1
3   1   1   1
4   0   0   0

 str(allen)
'data.frame':   4 obs. of  3 variables:
 $ sp1: int  0 1 1 0
 $ sp2: int  0 0 1 0
 $ sp3: int  1 1 1 0

Then looking at the output from:

paste(names(allen)[as.logical(unlist(allen[2,]))], collapse='; ')

may help you. 

Hei kona ra ...

Peter Alspach

 -Original Message-
 From: r-help-boun...@r-project.org 
 [mailto:r-help-boun...@r-project.org] On Behalf Of AllenL
 Sent: Thursday, 8 January 2009 7:28 a.m.
 To: r-help@r-project.org
 Subject: [R] Another newbie question
 
 
 Problem: 
 I have a data frame with 1s and 0s denoting presence/absence 
 of species
 (columns) for particular plot measurements (rows). What I 
 want to do is make a new column whose entries for each row is 
 a list of the column names in which a species is present (ie. 
 for row one its entry might read:
 sp1,sp2, etc.). I've tried various functions etc. but 
 can't seem to get the syntax right/ the correct combination 
 of functions.
 Thanks in advance!
 -Allen
 
 --
 View this message in context: 
 http://www.nabble.com/Another-newbie-question-tp21337371p21337371.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.
 

The contents of this e-mail are confidential and may be subject to legal 
privilege.
 If you are not the intended recipient you must not use, disseminate, 
distribute or
 reproduce all or any part of this e-mail or attachments.  If you have received 
this
 e-mail in error, please notify the sender and delete all material pertaining 
to this
 e-mail.  Any opinion or views expressed in this e-mail are those of the 
individual
 sender and may not represent those of The New Zealand Institute for Plant and
 Food Research Limited.

__
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] inter-timeseries correlation or corrections

2009-01-07 Thread Tim Michelsen

Hello,
I am currently working in the field of climate and environmental data 
analysis which is a lot founded on the analysis, preparation and 
combination of time series.


About a bit more than one year ago I started to use python and the 
marvellous timeseries module [1]. Which offers a very convenient way to 
handle time series. This decision bases also on some experiences of 
other users [2].
Recently, I got drawn to R because the statistical functions in python 
are still in somewhat development. On my to do list is a result based 
comparison for some use cases. I am still new to R but hope to use it 
more often through the Rpy interface.



For an actual project I would like to use a function to apply the 
distribution characteristics of a short-time series  on a modelled 
long-term time series which encloses the shorter one.


Which functions/libraries can you suggest?
Is there already a use case for this?

Thanks and kind regards,
Timmie

[1] http://pytseries.sourceforge.net/
[2] time series: Python vs. R - 
http://article.gmane.org/gmane.comp.python.scientific.user/14393


__
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] xtable-longtable question

2009-01-07 Thread Felipe Carrillo
Hello:
I am using Sweave to generate a PDF with figures and tables and was wondering 
if is possible to carry on table headers and some kind of caption like 
'Continued' to the next PDF page when creating long tables. 

Felipe D. Carrillo  
Supervisory Fishery Biologist  
Department of the Interior  
US Fish  Wildlife Service  
California, USA

__
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] Another newbie question

2009-01-07 Thread jim holtman
You did not provide any data, so I will take a guess at what it looks like:

 x - matrix(sample(0:1, 100, TRUE), 10)
 colnames(x) - LETTERS[1:10]
 x - as.data.frame(x)
 x
   A B C D E F G H I J
1  0 1 0 0 0 1 1 0 0 0
2  0 0 0 0 1 1 0 0 1 0
3  1 1 0 0 1 0 0 0 1 1
4  0 1 1 1 0 1 1 0 0 0
5  0 1 1 0 0 0 1 0 0 1
6  1 0 1 1 0 0 0 0 0 1
7  1 1 0 1 0 0 0 0 0 0
8  0 1 0 1 0 0 1 0 0 0
9  0 1 0 0 0 0 1 0 0 0
10 1 0 1 0 1 1 0 1 0 1
 x$match - apply(x, 1, function(z) paste(colnames(x)[z == 1], collapse=,))


 x
   A B C D E F G H I J   match
1  0 1 0 0 0 1 1 0 0 0   B,F,G
2  0 0 0 0 1 1 0 0 1 0   E,F,I
3  1 1 0 0 1 0 0 0 1 1   A,B,E,I,J
4  0 1 1 1 0 1 1 0 0 0   B,C,D,F,G
5  0 1 1 0 0 0 1 0 0 1 B,C,G,J
6  1 0 1 1 0 0 0 0 0 1 A,C,D,J
7  1 1 0 1 0 0 0 0 0 0   A,B,D
8  0 1 0 1 0 0 1 0 0 0   B,D,G
9  0 1 0 0 0 0 1 0 0 0 B,G
10 1 0 1 0 1 1 0 1 0 1 A,C,E,F,H,J



On Wed, Jan 7, 2009 at 1:28 PM, AllenL allen.laroc...@gmail.com wrote:

 Problem:
 I have a data frame with 1s and 0s denoting presence/absence of species
 (columns) for particular plot measurements (rows). What I want to do is make
 a new column whose entries for each row is a list of the column names in
 which a species is present (ie. for row one its entry might read:
 sp1,sp2, etc.). I've tried various functions etc. but can't seem to get
 the syntax right/ the correct combination of functions.
 Thanks in advance!
 -Allen

 --
 View this message in context: 
 http://www.nabble.com/Another-newbie-question-tp21337371p21337371.html
 Sent from the R help mailing list archive at Nabble.com.

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




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

What is the problem that you are trying to solve?

__
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 estimate overdispersion in glmer models?

2009-01-07 Thread Ben Bolker
 lcayuela at ugr.es writes:

[snip]
 
 model1 - glmer(fruitset ~ Dist*wire + (1|Site), data, binomial)
 summary(model1)
 
 Generalized linear mixed model fit by the Laplace approximation
 Formula: fruitset ~ Dist * wire + (1 | Site)
Data: data
AIC   BIC logLik deviance
  68.23 70.65 -29.1158.23
 Random effects:
  Groups NameVariance   Std.Dev.
  Lugar  (Intercept) 3.5155e-14 1.8750e-07
 Number of obs: 12, groups: Lugar, 2

 [snip]
 
 My question is, how can I check for overdispersion? In glm models you can
 check this by comparing the residual deviance with the residual degrees of
 freedom, but in glmer you don't get this information.
 
 (Ubuntu Intrepid Ibex / R 2.7.1)

  a few thoughts --

(1) probably better to ask this question on the R-sig-mixed-models
list, which specializes in these problems
(2) try lme4:::sigma
(3) do you really have just 12 observations in 2 groups?  In that case
I would strongly recommend just treating group as a fixed
factor -- you have no power to estimate variance (note your
random effect has a standard deviation of 2 x 10^-7), and you
will avoid lots of heartache if you just fit
glm(fruitset ~ Dist*wire + Site, data, binomial)
[not everyone will agree with me about this ...]
(4) I'm a little puzzled that your formula has Site
as a random effect but your summary lists Lugar as a
random effect.  Did you edit the summary?

__
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] inter-timeseries correlation or corrections

2009-01-07 Thread stephen sefick
look at zoo and ts, and it all depends on what you want to do.

On Wed, Jan 7, 2009 at 2:27 PM, Tim Michelsen
timmichel...@gmx-topmail.de wrote:
 Hello,
 I am currently working in the field of climate and environmental data
 analysis which is a lot founded on the analysis, preparation and combination
 of time series.

 About a bit more than one year ago I started to use python and the
 marvellous timeseries module [1]. Which offers a very convenient way to
 handle time series. This decision bases also on some experiences of other
 users [2].
 Recently, I got drawn to R because the statistical functions in python are
 still in somewhat development. On my to do list is a result based comparison
 for some use cases. I am still new to R but hope to use it more often
 through the Rpy interface.


 For an actual project I would like to use a function to apply the
 distribution characteristics of a short-time series  on a modelled long-term
 time series which encloses the shorter one.

 Which functions/libraries can you suggest?
 Is there already a use case for this?

 Thanks and kind regards,
 Timmie

 [1] http://pytseries.sourceforge.net/
 [2] time series: Python vs. R -
 http://article.gmane.org/gmane.comp.python.scientific.user/14393

 __
 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

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] Another newbie question

2009-01-07 Thread Dimitris Rizopoulos

try the following:

dat - data.frame(
sp1 = rbinom(10, 1, 0.5),
sp2 = rbinom(10, 1, 0.5),
sp3 = rbinom(10, 1, 0.5),
sp4 = rbinom(10, 1, 0.5),
sp5 = rbinom(10, 1, 0.5),
sp6 = rbinom(10, 1, 0.5)
)

ind - sapply(dat, as.logical)
dat$Sp - apply(ind, 1, function (x, nams)
paste(nams[x], collapse = ; ), nams = names(dat))
dat


I hope it helps.

Best,
Dimitris


AllenL wrote:
Problem: 
I have a data frame with 1s and 0s denoting presence/absence of species

(columns) for particular plot measurements (rows). What I want to do is make
a new column whose entries for each row is a list of the column names in
which a species is present (ie. for row one its entry might read:
sp1,sp2, etc.). I've tried various functions etc. but can't seem to get
the syntax right/ the correct combination of functions.
Thanks in advance!
-Allen



--
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] R in the NY Times

2009-01-07 Thread Tony Breyal
Google Alerts are great, but unfortuantly the brevity of R's name is
the main problem i think.

though, thinking about it, i suppose if one could work out the 'best'
key words to use, it might be possible to not get too many miss-
classified results, e.g.,

http://news.google.com/news?hl=enned=usnolr=1q=r+open+source+programming+languagebtnG=Search

or something like that. Will be keeping an eye on David's page from
time to time though, just in case he catches anything :-)

lovely to see R getting the attention it so rightly deserves.




On 7 Jan, 18:29, Ajay ohri ohri2...@gmail.com wrote:
 you can use google alerts to track media coverage of R using some keywords

 regards,

 ajay

 On Wed, Jan 7, 2009 at 9:52 PM, David M Smith 



 da...@revolution-computing.com wrote:
  On Wed, Jan 7, 2009 at 6:39 AM, Tony Breyal tony.bre...@googlemail.com
  wrote:
   Thank you for posting this, I found it a very enjoyable read!

   I am curious, is there an archive of 'R in the Media' or 'R in the
   Press' articles somewhere? It would be interesting to see how the
   perception of R has changed/evolved over time relative to other
   packages.

  That's a great idea, and I just created an Rmedia category on the
  REvolutions R blog to track exactly such articles.  You can find it
  here:

 http://blog.revolution-computing.com/rmedia/

  If anyone knows of any other mainstream articles about R available
  online please let me know, and I'll do a round-up post in that section
  to make sure they're captured.

  By the way, we're writing about R and issues related to R daily at:

 http://blog.revolution-computing.com

  # David Smith

  --
  David M Smith da...@revolution-computing.com
  Director of Community, REvolution Computingwww.revolution-computing.com
  Tel: +1 (206) 577-4778 x3203 (Seattle, USA)

  __
  r-h...@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-h...@r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guidehttp://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] R in the NY Times

2009-01-07 Thread Wacek Kusnierczyk
Kevin E. Thorpe wrote:
 Zaslavsky, Alan M. wrote:
 SAS says it has noticed R’s rising popularity at universities,
 despite educational discounts on its own software, but it dismisses
 the technology as being of interest to a limited set of people
 working on very hard tasks.

 “I think it addresses a niche market for high-end data analysts that
 want free, readily available code, said Anne H. Milley, director of
 technology product marketing at SAS. She adds, “We have customers who
 build engines for aircraft. I am happy they are not using freeware
 when I get on a jet.”


 Thanks for posting. Does anyone else find the statement by SAS to be
 humourous yet arrogant and short-sighted?

there must be something wrong with me, but i can't find anything
'humorous yet arrogant and short-sighted' in the idea that engines for
aircraft be built with software that does not advertise itself with
'ABSOLUTELY NO WARRANTY.'


vQ

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