Re: [R] Export to .txt

2011-11-02 Thread stat.kk
Oh, Im sorry. My file isnt a function but script 'script.R' which looks
something like that:

cat('Instruction no 1', '\n')
browser()   # place for fulfilling it

cat('Instruction no 2', '\n')
browser()   # place for fulfilling it

etc.

I am running it by
sink(file='output.txt')
source('script.R')
sink(NULL)

but it doesnt work as I would like. I cant see the output also via saving
workaspace into .Rhistory file. The goal I would like to achieve is the same
file as via File - Save to file... option - but I work in command line.



--
View this message in context: 
http://r.789695.n4.nabble.com/Export-to-txt-tp3965699p3971924.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] where to get chr_rpts file for dbSNP human 36.3 assembly

2011-11-02 Thread shirley zhang
Dear list,

In terms of dbSNP database in NCBI, I can get the chr_rpts files for
the most recent 37.3 assembly from the following FTP site,

ftp://ftp.ncbi.nih.gov/snp/organisms/human_9606/chr_rpts/

My question is how/where I can get these chr_rpts files based on the
36.3 assembly

Thanks,
Shirley

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Removing or ignoring package version for generic function in locked environment

2011-11-02 Thread Joshua Wiley
Interesting.  I have a few (untested) thoughts.  Before I get into those 
though, this seem to me like a case where contacting either the maintainer of 
epicalc or of the functions not under your control that give warnings.  I think 
either would be appropriate because if the default method works correctly with 
no error, I really do not think aggregate.numeric should give a warning.  The 
onus seems somewhat on the writer of methods for classes as common as numeric 
to write something that works.  That said, without any idea what it is being 
used on there are endless possibilities for why a warning is being generated.  
But supposing neither of those are options, here are some ideas.

1) if you happen to be using this in your own package, try just importing 
aggregate numeric, rather than fully loading the epicalc package.

2) create a method that mimics aggregate but is for numeric, and make sure it 
is in an environment between the out of control functions and epicalc so it is 
called rather than epicalcs version.

3) use epicalc and then unload it rather than just removing that function (may 
not fly)

4) copy the epicalc aggregate numeric and just use that code  and never load 
the package

5) you may be able to unlock() the name space so you can remove the methods (I 
think the function is unlock but there may be caps somewhere in there)

6) if the offending functions have a class that is not numeric but inherits 
from numeric, you could write a method for their particular class that would 
then supersede the inherited numeric method

All of these are highly unsatisfactory in one way another.  I am not in a 
position to test anything out at the moment (iPhone, well that's not true, I 
could ssh to my cluster, start r there and try via the terminal but that is 
truly painful on a phones keyboard)

Good luck,

Josh

On Nov 1, 2011, at 17:31, Oliver Mannion (COMPASS) o.mann...@auckland.ac.nz 
wrote:

 Hi,
 
 I use the epicalc package which provides the function aggregate.numeric.
 
 Unfortunately aggregate.numeric produces warnings when aggregate is used by 
 functions not under my control on a numeric value. If I don't load epicalc, 
 aggregate.default is used instead by these functions and does not produce any 
 warning.
 
 However I need epicalc. So to get around this, what I would do is firstly 
 remove aggregate.numeric:
 
 rm(aggregate.numeric, pos=which(search() == package:epicalc))
 
 This worked fine in R 2.13.1. However in R 2.14.0 I am getting the following:
 
 Error in rm(aggregate.numeric, pos = which(search() == package:epicalc)) : 
  cannot remove bindings from a locked environment
 
 Is there some way I can remove aggregate.numeric, or otherwise prevent it 
 from being used?
 
 Thanks in advance,
 
 Oliver
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] 'tcltk' does not have a name space

2011-11-02 Thread christear
It also have this problem when I install qvalue package ... 

--
View this message in context: 
http://r.789695.n4.nabble.com/tcltk-does-not-have-a-name-space-tp3020504p3971898.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] 'tcltk' does not have a name space

2011-11-02 Thread Uwe Ligges
Please quote the original message you are replying to and read the 
posting guide!


Please update your version of R to R-2.14.0. Looks like the package 
assumes a more recent version of R without declaring the dependency. You 
may want to inform the package maintainer.


Uwe Ligges



On 02.11.2011 06:43, christear wrote:

It also have this problem when I install qvalue package ...

--
View this message in context: 
http://r.789695.n4.nabble.com/tcltk-does-not-have-a-name-space-tp3020504p3971898.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.


Re: [R] I really need help to merge two data frames

2011-11-02 Thread Uwe Ligges



On 02.11.2011 01:32, Tony wrote:

Hello, I need help getting two data sets to merge. The structure of
my
two data sets are:


str(bcusip)

'data.frame':   1391 obs. of  3 variables:
  $ bond_id : Factor w/ 1391 levels AAGH,AAGI,..: 1 2 3 4 5 6
  $ Freq: num  41361 4126 5206 10125 45536 ...
  $ CUSIP_ID: Factor w/ 1391 levels 00184AAC9,00184AAF2,..:


str(bdescr)

'data.frame':   3674 obs. of  7 variables:
  $ bond_id: Factor w/ 3674 levels AAGH ,AAGI ,..:
  $ Issuer.Name: Factor w/ 635 levels 3M CO ,ABBOTT LABORAT
  $ Coupon : num  6 6.75 6.5 5.95 5.55 5.9 5.72 5.87 6 6.75 ...
  $ Maturity   : Factor w/ 1076 levels 1/1/2015,1/1/2016,..:
  $ Callable   : Factor w/ 2 levels No ,Yes : 2 2 2 2 2
  $ Moody.s: Factor w/ 20 levels A1 ,A2 ,A3 ,..: 16 16 16
  $ S.P: Factor w/ 22 levels - ,A- ,A ,..: 15 15 15 15 1



Look at the levels above, in bcusip ist is AAGH, on bdescr it is 
AAGH  (note the blanks! etc.


Uwe Ligges


I am trying to attach the descriptive variables in the first data set
to the
sample variables in the second data set.
My code worked in an example that I re-created from a tutorial, but
it
will not work on my data
Here is my data code:

### bond description
bdescr-read.table(file=index3705.R.csv,header=TRUE,sep=,)
bdescr- bdescr[!duplicated(bdescr$bond_id),]

### bond cusip number
bcusip = read.table(file=selected1526.R.csv,header=TRUE,sep=,)
bcusip- bcusip[!duplicated(bcusip$bond_id),]
bcusip$Freq = as.numeric(bcusip$Freq)

And here is my attempt to merge: (I tried a few)

merge (bdescr,bcusip,by=bond_id,all=TRUE)
merge (bdescr,bcusip,by=bond_id)
merge (bdescr,bcusip)
superfile- merge(bdescr,bcusip,by=bond_id,all=TRUE)

Thank you for any help. I am new and going crazy at the moment.
Sincerely,
Tony

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] RC33 8th Int Conf on Social Science Methodology -- The R System ...

2011-11-02 Thread John Maindonald
I wish to draw attention to an R-related session that is planned for the 
RC33 Eighth International Conference on Social Science Methodology, 
to be held over July 9 - July 13 2012, at the University of Sydney.


The focus of the conference is on innovations and current best practice in all 
aspects of social science research methodology. It provides an opportunity to 
reflect on contemporary methods, as applied in a range of settings and 
disciplinary contexts, to hear about emerging methods, tools, techniques and 
technologies, and to discover what resources are available to social science 
researchers and users of research.


The title for the planned session is:
The R System as a Platform for Analysis and Development of Analysis 
Methodology

http://conference.acspri.org.au/index.php/rc33/2012/schedConf/trackPolicies

John Maindonald email: john.maindon...@anu.edu.au
phone : +61 2 (6125)3473fax  : +61 2(6125)5549
Centre for Mathematics  Its Applications, Room 1194,
John Dedman Mathematical Sciences Building (Building 27)
Australian National University, Canberra ACT 0200.
http://www.maths.anu.edu.au/~johnm

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Size of windows graphics device

2011-11-02 Thread Erich Neuwirth
R for Windows 2.14.0

Is there a function reporting the size of the current windows device
after it has been resized manually?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 interpret Spearman Correlation

2011-11-02 Thread Raphael Saldanha
Hi David,

This is not private tutoring, just someone trying to help, and I'm sorry
for my distraction.

On Tue, Nov 1, 2011 at 10:34 PM, David Winsemius dwinsem...@comcast.netwrote:

 Shahab;

 You would be well advised not to seek private tutoring from someone on the
 Internet who tells you that a p-value of 0.008736 is not significant.



 On Nov 1, 2011, at 8:09 PM, Raphael Saldanha saldanha.plan...@gmail.com
 wrote:

  Hi Shahab,
 
  This test shows that there is some positive statistical correlation, BUT
  the p-value of the test - this is, the level of significance - shows that
  the correlation is not statistically significant at 95% confidence level.
  So, the correlation may be equal to zero.
 
  To understand this concepts in a good way, you need to be secure about
  variance and hypothesis test.
 
  I can help you more if you need. Send me a direct mail (this list is for
  doubts about R, not conceptual statistics). I will be happy to help you
  with Statistics.
 
  My e-mail: saldanha.plan...@gmail.com
 
  On Tue, Nov 1, 2011 at 8:58 PM, shahab shahab.mok...@gmail.com wrote:
 
  Hi,
 
  I am not really familiar with Correlation foundations, although I read
  a lot. So maybe if someone kindly help me to interpret the following
  results.
  I had the following R commands:
 
  correlation -cor( vector_CitationProximity , vector_Impact, method =
  spearman, use=na.or.complete)
  cor_test-cor.test(vector_CitationProximity, vector_Impact,
  method=spearman)
 
  and the results are:
  correlation
  Correlation =  0.04715686
 
  cor_test
  Spearman's rank correlation rho
 
  data:  vector_CitationProximity and vector_Impact
  S = 5581032104, p-value = 0.008736
  alternative hypothesis: true rho is not equal to 0
  sample estimates:
   rho
  0.04582115
 
 
  So apparently, there is positive correlation between two given
  variables since Correlation =  0.04715686   0
  However I couldn't interpret the significance ?' what does rho say?
  Is there any simple sample that I can read and try to understand? I am
  do confused in understanding how significance can be interpreted.
 
  Thanks,
 
  /Shahab
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 
 
 
  --
  Atenciosamente,
 
  Raphael Saldanha
  saldanha.plan...@gmail.com
 
 [[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.




-- 
Atenciosamente,

Raphael Saldanha
saldanha.plan...@gmail.com

[[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] triangles point left, filled?

2011-11-02 Thread Jim Lemon

On 11/01/2011 08:05 PM, Martin Ivanov wrote:

  Dear R users,

I want to plot not only triangles point up and triangles point down,
which is easy using the pch argument to points. I want to plot left and 
right pointing triangles as well. They must be fillable with colour.

I browsed a little in the documentation, tried rotating the up and down 
pointing triangles, but of no avail. Any suggestions will be appreciated.


Hi Martin,
Have a look at the my.symbols function in the TeachingDemos package.

Jim

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


Re: [R] why the a[-indx] does not work?

2011-11-02 Thread S Ellison
 

 -Original Message-
 From:Alaios
 Sent: 30 October 2011 21:09
 To: William Dunlap; andrija djurovic
 Cc: R-help@r-project.org
 Subject: Re: [R] why the a[-indx] does not work?

 What is the difference between though
 
 !numericVector==0 and
 
 -numericVector==0
 
Er... you need to be (a lot) more careful with operator precendence. See 
?Syntax for operator precedence.

-numericVector==0
will usually* give the same answer as 
numericVector==0

because unary minus has higher precedence than ==, so this is read implicitly 
as (-numericvector)==0. -1 and 1 are still both nozero, while -0 and 0 are both 
still zero. ( *'usually' because you may be comparing a double precision 
nearly-zero with another double precision nearly-zero, and that is _always_ 
asking for trouble.)

!numericVector==0 
behaves quite differently because unary negation (!, or NOT) has _lower_ 
precedence than ==, so this one is read as
!(numericVector==0)


Operatopr preference rules for programmers:
Rule 1: If in doubt about operator precedence, use parentheses
Rule 2: Always have doubts about operator precedence unless you have looked it 
up for _that_ version of _that_  language _that day_.
Rule 3: Check the operator precedence of parentheses.

S Ellison

***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Size of windows graphics device

2011-11-02 Thread Dejian Zhao
par(fin) : The figure region dimensions, |(width,height)|, in inches.
par(din) : the device dimensions, |(width,height)|, in inches.

On 2011-11-2 18:50, Erich Neuwirth wrote:
 R for Windows 2.14.0

 Is there a function reporting the size of the current windows device
 after it has been resized manually?

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] Size of windows graphics device

2011-11-02 Thread S Ellison
 

 -Original Message-
 From: r-help-boun...@r-project.org 
 [mailto:r-help-boun...@r-project.org] On Behalf Of Dejian Zhao
 Sent: 02 November 2011 12:01
 To: r-help@r-project.org
 Subject: Re: [R] Size of windows graphics device
 
 par(fin) : The figure region dimensions, |(width,height)|, 
 in inches.
 par(din) : the device dimensions, |(width,height)|, in inches.
 
... except between windows() and plot.new(). But reports accurately after 
plot.new(), plot() and the like.

S Ellison
***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 interpret Spearman Correlation

2011-11-02 Thread Frank Harrell
What David was getting at is that you interpreted the P-value as one minus
the P-value, not a safe practice.  There is also some question about whether
it would have been better to recommend a good book or course.
Frank

Raphael Saldanha wrote:
 
 Hi David,
 
 This is not private tutoring, just someone trying to help, and I'm sorry
 for my distraction.
 
 On Tue, Nov 1, 2011 at 10:34 PM, David Winsemius lt;dwinsemius@gt;wrote:
 
 Shahab;

 You would be well advised not to seek private tutoring from someone on
 the
 Internet who tells you that a p-value of 0.008736 is not significant.



 On Nov 1, 2011, at 8:09 PM, Raphael Saldanha lt;saldanha.plangeo@gt;
 wrote:

  Hi Shahab,
 
  This test shows that there is some positive statistical correlation,
 BUT
  the p-value of the test - this is, the level of significance - shows
 that
  the correlation is not statistically significant at 95% confidence
 level.
  So, the correlation may be equal to zero.
 
  To understand this concepts in a good way, you need to be secure about
  variance and hypothesis test.
 
  I can help you more if you need. Send me a direct mail (this list is
 for
  doubts about R, not conceptual statistics). I will be happy to help you
  with Statistics.
 
  My e-mail: saldanha.plangeo@
 
  On Tue, Nov 1, 2011 at 8:58 PM, shahab lt;shahab.mokari@gt; wrote:
 
  Hi,
 
  I am not really familiar with Correlation foundations, although I read
  a lot. So maybe if someone kindly help me to interpret the following
  results.
  I had the following R commands:
 
  correlation -cor( vector_CitationProximity , vector_Impact, method =
  spearman, use=na.or.complete)
  cor_test-cor.test(vector_CitationProximity, vector_Impact,
  method=spearman)
 
  and the results are:
  correlation
  Correlation =  0.04715686
 
  cor_test
  Spearman's rank correlation rho
 
  data:  vector_CitationProximity and vector_Impact
  S = 5581032104, p-value = 0.008736
  alternative hypothesis: true rho is not equal to 0
  sample estimates:
   rho
  0.04582115
 
 
  So apparently, there is positive correlation between two given
  variables since Correlation =  0.04715686   0
  However I couldn't interpret the significance ?' what does rho say?
  Is there any simple sample that I can read and try to understand? I am
  do confused in understanding how significance can be interpreted.
 
  Thanks,
 
  /Shahab
 
  __
  R-help@ mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 
 
 
  --
  Atenciosamente,
 
  Raphael Saldanha
  saldanha.plangeo@
 
 [[alternative HTML version deleted]]
 
  __
  R-help@ mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.

 
 
 
 -- 
 Atenciosamente,
 
 Raphael Saldanha
 saldanha.plangeo@
 
   [[alternative HTML version deleted]]
 
 __
 R-help@ mailing list
 https://stat.ethz.ch/mailman/listinfo/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 Harrell
Department of Biostatistics, Vanderbilt University
--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-interpret-Spearman-Correlation-tp3965809p3972797.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] Generate a sequence of vectors of different length

2011-11-02 Thread Christian Langkamp
Hi everyone
After the following setup

sector=2 # Define Number of Sectors

sectors=LETTERS[seq( from = 1, to = sector )] # Name sectors

No_ent=round(3/runif(sector)) # Number of entities per sector

#Tot_No_ent=sum(No_ent)

 

Goal is to get a List like

(A1, A2, A3, B1, B2, B3, B4) where A is denoting an industrial sector and
then a numbered sequence of companies within the sector.

 

The step I am missing is how to generate a sequence of vectors (one for each
sector) with individual length being determined by No_ent.

The goal is to generate a set of entities from different sectors. One simple
way out of it would be to set the number of entities equal per sector and
have a matrix, but I am quite sure it should also be possible for having a
different number of entities in each sector. 

 

Once this is done, I can bind them together as vector with
as.vector(rbind(?)) (both as an (A,A,A,B,B,B,B) and (1,2,3,1,2,3,4) and
then concatenate)

 

Thanks, Christian

 

 

Trials included the following bits

A=for (i in 1:sector){

rep(i,No_ent[i])

}

paste(LETTERS[i], seq(from =1, to =No_ent[i]), sep = )

but I don't get the correct object definition right.


[[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] Generate a sequence of vectors of different length

2011-11-02 Thread Dimitris Rizopoulos

One approach is:

sectors - 2
namSec - LETTERS[seq_len(sectors)]
nSec - round(3 / runif(sectors))

mapply(paste, namSec, sapply(nSec, seq_len),
MoreArgs = list(sep = ))


I hope it helps.

Best,
Dimitris


On 11/2/2011 2:56 PM, Christian Langkamp wrote:

Hi everyone
After the following setup

sector=2 # Define Number of Sectors

sectors=LETTERS[seq( from = 1, to = sector )] # Name sectors

No_ent=round(3/runif(sector)) # Number of entities per sector

#Tot_No_ent=sum(No_ent)



Goal is to get a List like

(A1, A2, A3, B1, B2, B3, B4) where A is denoting an industrial sector and
then a numbered sequence of companies within the sector.



The step I am missing is how to generate a sequence of vectors (one for each
sector) with individual length being determined by No_ent.

The goal is to generate a set of entities from different sectors. One simple
way out of it would be to set the number of entities equal per sector and
have a matrix, but I am quite sure it should also be possible for having a
different number of entities in each sector.



Once this is done, I can bind them together as vector with
as.vector(rbind(?)) (both as an (A,A,A,B,B,B,B) and (1,2,3,1,2,3,4) and
then concatenate)



Thanks, Christian





Trials included the following bits

A=for (i in 1:sector){

rep(i,No_ent[i])

}

paste(LETTERS[i], seq(from =1, to =No_ent[i]), sep = )

but I don't get the correct object definition right.


[[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 University Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014
Web: http://www.erasmusmc.nl/biostatistiek/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Imputing Missing Data: A Good Starting Point?

2011-11-02 Thread David L Carlson
You might look at Allison's short book for a quick introduction to the
issues:

Paul D. Allison. 2002. Missing Data. Sage Quantitative Applications in the
Social Sciences No. 136.

Online there is http://www.multiple-imputation.com/ which provides a
bibliography (with links to articles that are available online). 

Chapter 25 on Missing Data Imputation (Andrew Gelman and Jennifer Hill.
2006. Data Analysis Using Regression and Multilevel/Hierarchical Models.
Cambridge University Press) which is available at
http://lane.compbio.cmu.edu/courses/gelmanmissing.pdf provides examples of
several approaches and provides R code for them.

--
David L Carlson
Associate Professor of Anthropology
Texas AM University
College Station, TX 77843-4352


-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Ken
Sent: Tuesday, November 01, 2011 4:48 PM
To: Sascha Vieweg
Cc: r-help@r-project.org
Subject: Re: [R] Imputing Missing Data: A Good Starting Point?

Hope this helps:
http://rss.acs.unt.edu/Rdoc/library/randomForest/html/rfImpute.html
Ken Hutchison

On Nov 1, 2554 BE, at 5:29 PM, Sascha Vieweg saschav...@gmail.com wrote:

 Hello
 
 I am working on my first attempt to impute missing data of a data set with
systematically incomplete answers (school performance tests). I was googling
around for some information and found Amelia (Honaker et al., 2010) and the
mi package (Yu-Sung et al., n.d.). However, since I am new to this field, I
was wondering whether some experts could give a good recommendation of a
starting point for me, that is a point that combines theory as well as
practical examples. Of course, My primary interest is to complete the task
in time (1 week), however, I want to acquire skills for a program that
provides some future, and of course I want some background on what I am
doing (and what not). Could you help with some hints, experiences, and
recommendations?
 
 Thank you.
 
 Regards
 *S*
 
 -- 
 Sascha Vieweg, saschav...@gmail.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-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Export to .txt

2011-11-02 Thread R. Michael Weylandt
So playing around with it quickly, it seems that print() works with
sink but cat() doesn't unless you put the sink call in the script at
which point it does as you would expect.

Does that help?

Michael

On Wed, Nov 2, 2011 at 2:14 AM, stat.kk stat...@gmail.com wrote:
 Oh, Im sorry. My file isnt a function but script 'script.R' which looks
 something like that:

 cat('Instruction no 1', '\n')
 browser()   # place for fulfilling it

 cat('Instruction no 2', '\n')
 browser()   # place for fulfilling it

 etc.

 I am running it by
 sink(file='output.txt')
 source('script.R')
 sink(NULL)

 but it doesnt work as I would like. I cant see the output also via saving
 workaspace into .Rhistory file. The goal I would like to achieve is the same
 file as via File - Save to file... option - but I work in command line.



 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Export-to-txt-tp3965699p3971924.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] Proper Syntax for Logical Subset in Subset()

2011-11-02 Thread Rich Shepard

  I have measured values for 47 chemicals in a stream. After processing
the original data frame through reshape2, the recast data frame has this
structure:

'data.frame':   256 obs. of  47 variables:
 $ site : Factor w/ 143 levels BC-0.5,BC-1,..: 1 1 1 2 2 2 2 2 2 2
...
 $ sampdate : Date, format: 1996-04-19 1996-05-21 ...
 $ Acid : num  NA NA NA NA NA NA NA NA NA NA ...
 $ Ag   : num  NA NA NA NA NA NA NA NA NA NA ...
 $ Al   : num  0.07 NA NA NA NA NA NA NA NA NA ...
 $ Alk-HO   : num  NA NA NA NA NA NA NA NA NA NA ...
 $ Alk-Tot  : num  162 152 212 NA NA NA NA NA NA NA ...
 $ As   : num  0.01 NA NA 0 0 0 0 0.01 0 0.01 ...
 $ Ba   : num  0.18 NA NA NA NA NA NA NA NA NA ...
 $ Be   : num  NA NA NA NA NA NA NA NA NA NA ...
 $ Bo   : num  NA NA NA NA NA NA NA NA NA NA ...
 $ CO3  : num  NA NA NA NA NA NA NA NA NA NA ...
 $ Ca   : num  76.6 NA NA NA NA ...
 $ Cd   : num  NA NA NA NA NA NA NA NA NA NA ...
 $ Cl   : num  12 NA NA NA NA NA NA NA NA NA ...
 $ Cn   : num  NA NA NA NA NA NA NA NA NA NA ...
 $ Co   : num  NA NA NA NA NA NA NA NA NA NA ...
 $ Cond : num  712 403 731 NA NA NA NA NA NA NA ...
 $ Cr   : num  NA NA NA NA NA NA NA NA NA NA ...
 $ DO   : num  NA NA NA NA NA NA NA NA NA NA ...
 $ F: num  NA NA NA NA NA NA NA NA NA NA ...
 $ Fe   : num  0.06 NA NA NA NA NA NA NA NA NA ...
 $ Flow : num  NA NA NA NA NA NA NA NA NA NA ...
 $ HCO3 : num  162 152 212 NA NA NA NA NA NA NA ...
 $ Hg   : num  0 NA NA NA NA NA NA NA NA NA ...
 $ K: num  1.7 NA NA NA NA NA NA NA NA NA ...
 $ Mg   : num  43.2 NA NA NA NA ...
 $ Mn   : num  NA NA NA NA NA NA NA NA NA NA ...
 $ NO2-N: num  NA NA NA NA NA NA NA NA NA NA ...
 $ NO3-N: num  NA 0.47 0.09 NA NA NA NA NA NA NA ...
 $ NO3-NO2-N: num  1.97 NA NA NA NA NA NA NA NA NA ...
 $ Na   : num  NA NA NA NA NA NA NA NA NA NA ...
 $ Ni   : num  NA NA NA NA NA NA NA NA NA NA ...
 $ OH   : num  NA NA NA NA NA NA NA NA NA NA ...
 $ P: num  0.03 NA NA NA NA NA NA NA NA NA ...
 $ Pb   : num  NA NA NA NA NA NA NA NA NA NA ...
 $ SO4  : num  175 57 194 NA NA NA NA NA NA NA ...
 $ Sb   : num  0 NA NA NA NA NA NA NA NA NA ...
 $ Se   : num  0.01 NA NA NA NA NA NA NA NA NA ...
 $ Si   : num  NA NA NA NA NA NA NA NA NA NA ...
 $ TDS  : num  460 212 530 NA NA NA NA NA NA NA ...
 $ TSS  : num  NA 26 NA NA NA NA NA NA NA NA ...
 $ Temp : num  NA NA NA NA NA NA NA NA NA NA ...
 $ Tl   : num  NA NA NA NA NA NA NA NA NA NA ...
 $ Turb : num  2.2 NA NA NA NA NA NA NA NA NA ...
 $ Zn   : num  0.02 NA NA NA NA NA NA NA NA NA ...
 $ pH   : num  8.12 8.19 8.46 NA NA NA NA NA NA NA ...

  I want a subset of this with only 7 chemicals: Ca, Cl, Cond, Mg, Na, SO4,
and TDS. The subset help page tells me that I can use a logical subset to
extract these 7 rows while keeping all columns, but I do not know how to
write that logical subset. I tried emulating the example on the help page of
avoiding the subset but R didn't like the '%in%' as I wrote it; putting the
desired row names in a subset vector fails:

burns.tds - subset(burns.cast, subset(c('Ca', 'Cl', 'Cond', 'Mg', 'Na',
'SO4', 'TDS')))
Error in subset.default(c(Ca, Cl, Cond, Mg, Na, SO4, TDS)) :
  argument subset is missing, with no default

  What is the proper syntax to extract only these rows into a new data
frame? And, is the recast data frame the appropriate format as the source?

Rich

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


Re: [R] Proper Syntax for Logical Subset in Subset()

2011-11-02 Thread Rich Shepard

On Wed, 2 Nov 2011, Rich Shepard wrote:


 I want a subset of this with only 7 chemicals: Ca, Cl, Cond, Mg, Na, SO4,
and TDS.


  I should have also written that what I ultimately want is to create a
box-and-whisker plot for these 7 chemicals in a single panel. If that can be
done directly from the source data frame without creating another subset, I
want to learn the syntax for that.

Rich

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


Re: [R] Proper Syntax for Logical Subset in Subset()

2011-11-02 Thread Seeliger . Curt
I have measured values for 47 chemicals in a stream. After processing
 the original data frame through reshape2, the recast data frame has this
 structure:
 
 'data.frame':   256 obs. of  47 variables:
   $ site : Factor w/ 143 levels BC-0.5,BC-1,..: 1 1 1 2 2 2 2 2 
2 2...
   $ sampdate : Date, format: 1996-04-19 1996-05-21 ...
   $ Acid : num  NA NA NA NA NA NA NA NA NA NA ...
...
 
I want a subset of this with only 7 chemicals: Ca, Cl, Cond, Mg, Na, 
SO4,
 and TDS. The subset help page tells me that I can use a logical subset 
to
 extract these 7 rows while keeping all columns, but I do not know how to
 write that logical subset. 

Wow, I don't see how you wound up with the code you tried based on the 
instructions.  I guess for some of us the best instruction is a bloody 
nose, myself often included.

It sounds like you want to get rid of some columns in the reshaped 
dataframe, not rows.

   new - old[c('site', 'Ca', 'Cl', 'Cond', 'Mg', 'Na', 'SO4', 'TDS')] 

will work, as will the following if you insist on using the subset 
function.

   new - subset(old, c(site, Ca, Cl, Cond, Mg, Na, SO4, TDS))

If you actually want to get rid of rows that aren't the minerals of 
interest, then work with your unreshaped dataframe:

   new - subset(reallyOld, parameter in c('Ca', 'Cl', 'Cond', 'Mg', 'Na', 
'SO4', 'TDS'))


-- 
Curt Seeliger, Data Ranger
Raytheon Information Services - Contractor to ORD
seeliger.c...@epa.gov
541/754-4638


[[alternative HTML version deleted]]

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


Re: [R] Proper Syntax for Logical Subset in Subset()

2011-11-02 Thread Bert Gunter
To make such a plot, I would have thought your want your data structure to
be:

yourdat:

Column A: Date
Column B; Chemical
Column C: Result


After subsetting this to the chemicals you want or doing the subsetting in
your plot command, something like (base R)

boxplot(Result ~ Chemical, subset=yourdat$Chemical %in% c(Ca,Cl,
Cond,Mg,Na,SO2,TDS))

You probably can get what you want one way or the other with your current
data structure -- though you may have to use ggplot or trellis -- but it
does appear to be inconvenient.

Whether I'm correct or not in my understanding of your situation, an
important message is: you should choose your data structure to facilitate
the analysis that you have in mind. IMHO, this is one of R's great
strengths: it provides rich facilities for manipulating data tightly
integrated with plotting and analytical capabilities.

Cheers,
Bert

On Wed, Nov 2, 2011 at 9:46 AM, Rich Shepard rshep...@appl-ecosys.comwrote:

 On Wed, 2 Nov 2011, Rich Shepard wrote:

   I want a subset of this with only 7 chemicals: Ca, Cl, Cond, Mg, Na, SO4,
 and TDS.


  I should have also written that what I ultimately want is to create a
 box-and-whisker plot for these 7 chemicals in a single panel. If that can
 be
 done directly from the source data frame without creating another subset, I
 want to learn the syntax for that.

 Rich

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




-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

[[alternative HTML version deleted]]

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


Re: [R] Proper Syntax for Logical Subset in Subset()

2011-11-02 Thread Bert Gunter
Of course I left out the data argument:

boxplot(Result ~ Chemical, data= yourdat,subset=yourdat$Chemical %in%
c(Ca,Cl, Cond,Mg,Na,SO2,TDS))

-- Bert

On Wed, Nov 2, 2011 at 10:08 AM, Bert Gunter bgun...@gene.com wrote:

 To make such a plot, I would have thought your want your data structure to
 be:

 yourdat:

 Column A: Date
 Column B; Chemical
 Column C: Result
 

 After subsetting this to the chemicals you want or doing the subsetting in
 your plot command, something like (base R)

 boxplot(Result ~ Chemical, subset=yourdat$Chemical %in% c(Ca,Cl,
 Cond,Mg,Na,SO2,TDS))

 You probably can get what you want one way or the other with your current
 data structure -- though you may have to use ggplot or trellis -- but it
 does appear to be inconvenient.

 Whether I'm correct or not in my understanding of your situation, an
 important message is: you should choose your data structure to facilitate
 the analysis that you have in mind. IMHO, this is one of R's great
 strengths: it provides rich facilities for manipulating data tightly
 integrated with plotting and analytical capabilities.

 Cheers,
 Bert

 On Wed, Nov 2, 2011 at 9:46 AM, Rich Shepard rshep...@appl-ecosys.comwrote:

 On Wed, 2 Nov 2011, Rich Shepard wrote:

   I want a subset of this with only 7 chemicals: Ca, Cl, Cond, Mg, Na,
 SO4,
 and TDS.


  I should have also written that what I ultimately want is to create a
 box-and-whisker plot for these 7 chemicals in a single panel. If that can
 be
 done directly from the source data frame without creating another subset,
 I
 want to learn the syntax for that.

 Rich

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




 --

 Bert Gunter
 Genentech Nonclinical Biostatistics

 Internal Contact Info:
 Phone: 467-7374
 Website:

 http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm





-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

[[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 count number of occurrences

2011-11-02 Thread Sl K
Dear R users,

I have this data frame,
   y samp
8  0.03060419X
18 0.06120838Y
10 0.23588374X
3  0.32809965X
1  0.36007100X
7  0.36730571X
20 0.47176748Y
13 0.65619929Y
11 0.72014201Y
17 0.73461142Y
6  0.76221313X
2  0.77005691X
4  0.92477243X
9  0.93837591X
5  0.98883581X
16 1.52442626Y
12 1.54011381Y
14 1.84954487Y
19 1.87675183Y
15 1.97767162Y

and I am trying to find the number of X's that occur before ith Y occurs.
For example, there is 1 X before the first Y, so I get 1. There are 4 X's
before the second Y, so I get 4, there is no X between second and third Y,
so I get 0 and so on. Any hint to at least help me to start this will be
appreciated. Thanks a lot!

[[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] 2nd parameter Power Curves/ANCOVAs

2011-11-02 Thread Stephen Benigno
Hi,

 

I am trying to compare the slopes and y-intercepts of the power curves
between two plant species to see if they follow similar trends
(photosynthesis y-axis, stomatal conductance x-axis). I can fit linear
regression lines to the data and run the stats using an ANCOVA, but the
specific parameters require I fit a 2 Parameter Power Curve to the data.
Is running an ANCOVA with the abline function the best bet here, or does
R have a specific function to fit and compare power curves?

 

Here is my code thus far, and I was able to compare the linear
regressions lines with this code, but the data requires a power curve
fit. Any thoughts? Any help is much appreciated, Steve

 

###compares slope

mod1-aov(photosynthesis~conductance*species,data=data)

summary(mod1)

 

###compares y-intercept

mod2-aov(photosynthesis ~ conductance +species,data=data)

summary(mod2)

 

anova(mod1,mod2)

 

BA-subset(data,species==B.attenuata)

BM-subset(data,species==B.menziesii)

 

reg1-lm(photosynthesis ~ conductance,data=BA)

summary(reg1)

 

reg2-lm(photosynthesis ~ conductance,data=BM)

summary(reg2)

 

plot(photosynthesis ~ conductance, data=data, type='n')

points(BA$conductance,BA$photosynthesis, pch=20)

points(BM$conductance,BM$photosynthesis, pch=10)

abline(reg1, lty=1)

abline(reg2, lty=2)

 

reg.todo-lm(photosynthesis~species/conductance-1, data=data)

summary(reg.todo)

 

 

 


[[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] does there any function like sumif in excel?

2011-11-02 Thread Celine
I have a similar problem 
I have a dataframe : 

CELLCD AreaProtected 
   8928  52.39389 
   8928  41.91511 
   8929  21.21975 
   8929  63.65925 
   8930  26.08547 
   8930  14.04602 

I wouldlike to sum the AreaProtected if it is the same CELLCD in another
column : 

CELLCD AreaProtectedSumAreaProtected 
   8928  52.39389  94.309 
   8928  41.91511 
   8929  21.21975  84,879 
   8929  63.65925 
   8930  26.08547 
   8930  14.04602 

I am just started with R and I don't know how I can do that. 
Do you have any ideas ? 


--
View this message in context: 
http://r.789695.n4.nabble.com/does-there-any-function-like-sumif-in-excel-tp858444p3972963.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] mapping bathymetries and species abundances

2011-11-02 Thread Elena Guijarro

Dear all,

I am  new to R and even newer to mapping with R. I have installed 
PBSMapping, maptools and maps, and I am struggling to produce a map of 
fish abundance in the Grand Banks. I have tried several approaches to 
plot the bathymetry in my study area:

1) download the data from http://topex.ucsd.edu/cgi-bin/get_data.cgi  
(42N46N313W307W)
 To start with, the map I get is blank between lon -52W -53W. 
Besides, it seems that the shallower isobath is 500 m. Or maybe I am 
wrong here?

2) import a shapefile with the bathymetry, but I get the following error:

 test - read.shapefile(C:/data)
   Error in seq.default(1, (num.points * 2), by = 2) :   
wrong sign in 'by' argument


3) use a Rdata version of the above mentioned shapefile. This is the map 
I like the most, but when I try to plot the study area (which is 200 nm 
from the nearest shore), I get the error

   map('worldHires',xlim=c(-53,-47),ylim=c(42,46))
   Error in map.poly(database, regions, exact, xlim, ylim, 
boundary, interior,  :   nothing to draw: all regions out of bounds

The next problem will be plotting fish abundance. I was thinking of 
contours or scaled bubbles, but I am not sure I can do any of those with 
PBSMapping. Am I right? Any advice?

Thanks for your help,

Elena



[[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] Creating deciles on data using one variable

2011-11-02 Thread aajit75
I need to deciles data containing more than one variables using any one
variable. I am using script below :

id -c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
tot -c(1230, 1230, 2345, 3456, 456, 4356, 123, 124, 987, 785, 5646, 345,
2345, 3456, 456, 4356, 123, 124, 987, 785)  
data - data.frame ( cbind(id , tot))
data$decile-cut(data$tot,quantile(data$tot,(0:10)/10),include.lowest=TRUE,lable=TRUE)
data$decile

New variable decile taking values as below where as I need it should take
values from 1,2..10, Where I am going wrong? 

data$decile
 [1] (987,1.23e+03]  (987,1.23e+03]  (1.23e+03,2.34e+03]
 [4] (2.34e+03,3.46e+03] (301,456]   (3.46e+03,4.36e+03]
 [7] [123,124]   (124,301]   (785,987]  
[10] (456,785]   (4.36e+03,5.65e+03] (301,456]  
[13] (1.23e+03,2.34e+03] (2.34e+03,3.46e+03] (301,456]  
[16] (3.46e+03,4.36e+03] [123,124]   (124,301]  
[19] (785,987]   (456,785]  

-Ajit

--
View this message in context: 
http://r.789695.n4.nabble.com/Creating-deciles-on-data-using-one-variable-tp3973086p3973086.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] nproc parameter in efpFunctional

2011-11-02 Thread bonda
Hello all,
could anyone explain the exact meaning of parameter nproc? Why different
values of nproc give so different critical values, i.e.

meanL2BB$computeCritval(0.05,nproc=3)
[1] 0.9984853
meanL2BB$computeCritval(0.05,nproc=1)
[1] 0.4594827

The strucchange-package description gives integer specifying for which
number of processes Brownian motions should be simulated - do I need
nproc-dimensional Brownian bridge?

Thank you in advance!
Julia

--
View this message in context: 
http://r.789695.n4.nabble.com/nproc-parameter-in-efpFunctional-tp3972419p3972419.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] Sum with condition

2011-11-02 Thread Celine
I guess my problem is simple for most of you but I am new with R and I need
some help,
I have a dataframe : 

CELLCD AreaProtected
   8928  52.39389
   8928  41.91511
   8929  21.21975
   8929  63.65925
   8930  26.08547
   8930  14.04602

I wouldlike to sum the AreaProtected if it is the same CELLCD in another
column :

CELLCD AreaProtectedSumAreaProtected
   8928  52.39389  94.309
   8928  41.91511
   8929  21.21975  84,879
   8929  63.65925
   8930  26.08547
   8930  14.04602

I am just started with R and I don't know how I can do that.
Do you have any ideas ?


Thanks a lot for your help,

--
View this message in context: 
http://r.789695.n4.nabble.com/Sum-with-condition-tp3972839p3972839.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] overloading + operator for chars

2011-11-02 Thread Albert-Jan Roskam
Hello,
 
I would like to overload the + operator so that it can be used to concatenate 
two strings, e.g John + Doe = JohnDoe.
How can I 'unseal' the + method?
 setMethod(+, signature(e1=character, e2=character), function(e1, e2) 
 paste(e1, e2, sep=) )
Error in setMethod(+, signature(e1 = character, e2 = character),  : 
  the method for function + and signature e1=character, e2=character is 
sealed and cannot be re-defined
 

Cheers!!
Albert-Jan


~~
All right, but apart from the sanitation, the medicine, education, wine, public 
order, irrigation, roads, a fresh water system, and public health, what have 
the Romans ever done for us?
~~
[[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] Creating deciles on data using one variable

2011-11-02 Thread David Winsemius
I need to deciles data containing more than one variables using any one
variable. I am using script below : 

id -c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20) 
tot -c(1230, 1230, 2345, 3456, 456, 4356, 123, 124, 987, 785, 5646, 345,
2345, 3456, 456, 4356, 123, 124, 987, 785)  
data - data.frame ( cbind(id , tot)) 
data$decile-cut(data$tot,quantile(data$tot,(0:10)/10),include.lowest=TRUE,lable=TRUE)
 
data$decile 

New variable decile taking values as below where as I need it should take
values from 1,2..10, Where I am going wrong? 
-

You have a factor with labels, but if you use as.numeric(data$decile) you
will get what you were aiming for.

-- 
david

--
View this message in context: 
http://r.789695.n4.nabble.com/Creating-deciles-on-data-using-one-variable-tp3973086p3973412.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] Multiple comparison test about whole population, not about mean

2011-11-02 Thread Serge-Étienne Parent
Multiple comparison tests are usually used to compare groups based on the
confidence region about the mean. Some great packages, like agricolae,
proposes grouping information based on statistical tests. I am looking for
a way to perform such a test, but based on the confidence region about the
whole population. I tried to hack LSD.test and HSD.test functions
(agricolae), without much success.

(1) Is this valid to use multiple comparisons across population?
(2) If it is, anyone knows how I could do that?

Kind Regards,

[[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] difference between foo$a[2] - 1 and foo[2,a] - 1

2011-11-02 Thread Rebecca Hiller
Hallo 

Can anyone tell me the difference between

foo$a[2] - 1 and foo[2,a] - 1 ?

I thought that both expressions are equivalent, but when I run the following 
example, there is obviously a difference.


 foo - data.frame(a=NA,b=NA)
 foo
   a  b
1 NA NA
 foo$a[1] - 1
 foo$b[1] - 2
 foo$a[2] - 1
Error in `$-.data.frame`(`*tmp*`, a, value = c(1, 1)) : 
  replacement has 2 rows, data has 1
 foo[2,a] - 1
 foo
  a  b
1 1  2
2 1 NA

Thanks,
Rebecca Hiller


--
ETH Zürich
Rebecca Hiller
Institute of Agricultural Sciences
LFW A2
Universitätsstrasse 2
8092 Zürich
SWITZERLAND

rebecca.hil...@ipw.agrl.ethz.ch
http://www.gl.ethz.ch/

+41 44 632 31 90 Telefon
+41 44 632 11 53 Fax

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Sum with condition

2011-11-02 Thread Sarah Goslee
Hi,

On Wed, Nov 2, 2011 at 8:44 AM, Celine bellard.cel...@gmail.com wrote:
 CELLCD AreaProtected
   8928      52.39389
   8928      41.91511
   8929      21.21975
   8929      63.65925
   8930      26.08547
   8930      14.04602

You'll need to figure out how you want it to be combined with the
original data frame, since there can't be empty cells, but:

 dput(testdata)
structure(list(CELLCD = c(8928L, 8928L, 8929L, 8929L, 8930L,
8930L), AreaProtected = c(52.39389, 41.91511, 21.21975, 63.65925,
26.08547, 14.04602)), .Names = c(CELLCD, AreaProtected), class =
data.frame, row.names = c(NA,
-6L))

 aggregate(testdata$AreaProtected, by=list(CELLCD=testdata$CELLCD), FUN=sum)
  CELLCDx
1   8928 94.30900
2   8929 84.87900
3   8930 40.13149


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

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


[R] array manipulation

2011-11-02 Thread Simone Salvadei
Hello,
I'm at the very beginning of the learning process of this language.
Sorry in advance for the (possible but plausible) stupidity of my question.

I would like to find a way to permute the DIMENSIONS of an array.
Something that sounds like the function permute() in matlab.

Given an array C of dimensions c x d x T , for instance, the command

permute(C, [2 1 3])

would provide (in Matlab) an array very similar to C, but this time each
one of the T matrices c x d has changed into its transposed.
Any alternatives to the following (and primitive) 'for' cycle?

*# (previously defined) phi=array with dimensions c(c,d,T)*
*
*
*temp=array(0,dim=c(c,d,T))*
* for(i in 1:T)*
* {*
* temp[,,i]=t(phi[,,i])*
* }*
* phi=temp*
*
*

Thank you very much!
S

-- 
---

Simone Salvadei

Faculty of Economics
Department of Financial and Economic Studies and Quantitative Methods
University of Rome Tor Vergata
e-mail: simone.salva...@uniroma2.it federico.belo...@uniroma2.it
url: http://www.economia.uniroma2.it/phd/econometricsempiricaleconomics/
http://www.econometrics.it/
---

[[alternative HTML version deleted]]

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


Re: [R] how to count number of occurrences

2011-11-02 Thread William Dunlap
Is the following what you want?  It should give
the number of Xs immediately preceding each Y.

 samp - c(X, Y, X, X, X, X, Y, Y, Y, Y, X, X, 
  X, X, X, Y, Y, Y, Y, Y)
 diff((seq_along(samp) - cumsum(samp==Y))[samp==Y])
[1] 4 0 0 0 5 0 0 0 0

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
 Behalf Of Sl K
 Sent: Wednesday, November 02, 2011 9:55 AM
 To: r-help@r-project.org
 Subject: [R] how to count number of occurrences
 
 Dear R users,
 
 I have this data frame,
y samp
 8  0.03060419X
 18 0.06120838Y
 10 0.23588374X
 3  0.32809965X
 1  0.36007100X
 7  0.36730571X
 20 0.47176748Y
 13 0.65619929Y
 11 0.72014201Y
 17 0.73461142Y
 6  0.76221313X
 2  0.77005691X
 4  0.92477243X
 9  0.93837591X
 5  0.98883581X
 16 1.52442626Y
 12 1.54011381Y
 14 1.84954487Y
 19 1.87675183Y
 15 1.97767162Y
 
 and I am trying to find the number of X's that occur before ith Y occurs.
 For example, there is 1 X before the first Y, so I get 1. There are 4 X's
 before the second Y, so I get 4, there is no X between second and third Y,
 so I get 0 and so on. Any hint to at least help me to start this will be
 appreciated. Thanks a lot!
 
   [[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] Time Series w/ daily or stochastic observation prediction

2011-11-02 Thread Community
Hi,

I've got two different types of behaviors for which I have to predict the 
future development.

One is a set of historical data with daily observations and which are following 
some kind of a seasonal pattern, the second one a set of historical data 
(measure points), with two observation occurring each week, consisting of ten 
unique (within one single observation) values in parallel, and which doesn't 
appear to follow any seasonal pattern.

The former one I've aggregated on a monthly level and calculated a prediction 
model based on Holt Winters, which appears to be pretty nicely fitting when 
comparing the predicted history with the actual one, and now I have to 
accomplish the very same on a daily basis (including February 29th in case of a 
leap year).

The latter one I have not clue at all as how to prepare the data and run it 
with any potetially qualifying model.

Cheers,
Martin
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 count number of occurrences

2011-11-02 Thread David Winsemius


On Nov 2, 2011, at 12:54 PM, Sl K wrote:


Dear R users,

I have this data frame,
  y samp
8  0.03060419X
18 0.06120838Y
10 0.23588374X
3  0.32809965X
1  0.36007100X
7  0.36730571X
20 0.47176748Y
13 0.65619929Y
11 0.72014201Y
17 0.73461142Y
6  0.76221313X
2  0.77005691X
4  0.92477243X
9  0.93837591X
5  0.98883581X
16 1.52442626Y
12 1.54011381Y
14 1.84954487Y
19 1.87675183Y
15 1.97767162Y


 dat$nXs - cumsum(dat$samp==X)
 dat$nYs - cumsum(dat$samp==Y)
 dat
#
y samp nXs nYs
8  0.03060419X   1   0
18 0.06120838Y   1   1
10 0.23588374X   2   1
3  0.32809965X   3   1
1  0.36007100X   4   1
7  0.36730571X   5   1
20 0.47176748Y   5   2
13 0.65619929Y   5   3
11 0.72014201Y   5   4
17 0.73461142Y   5   5
6  0.76221313X   6   5
2  0.77005691X   7   5
4  0.92477243X   8   5
9  0.93837591X   9   5
5  0.98883581X  10   5
16 1.52442626Y  10   6
12 1.54011381Y  10   7
14 1.84954487Y  10   8
19 1.87675183Y  10   9
15 1.97767162Y  10  10

I find that there are 5 X's before the second Y.

 nXbefore_mthY - function(m) dat[which(dat$nYs==m), nXs]
 nXbefore_mthY(2)
[1] 5



and I am trying to find the number of X's that occur before ith Y  
occurs.
For example, there is 1 X before the first Y, so I get 1. There are  
4 X's
before the second Y, so I get 4, there is no X between second and  
third Y,
so I get 0 and so on. Any hint to at least help me to start this  
will be

appreciated. Thanks a lot!

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


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 count number of occurrences

2011-11-02 Thread Sarah Goslee
Hi,


On Wed, Nov 2, 2011 at 12:54 PM, Sl K s.ka...@gmail.com wrote:
 Dear R users,

 I have this data frame,
           y samp
 8 0.03060419    X
 18 0.06120838    Y
 10 0.23588374    X
 3 0.32809965    X
 1  0.36007100    X
 7 0.36730571    X
 20 0.47176748    Y
 13 0.65619929    Y
 11 0.72014201    Y
 17 0.73461142    Y
 6 0.76221313    X
 2 0.77005691    X
 4 0.92477243    X
 9 0.93837591    X
 5 0.98883581    X
 16 1.52442626    Y
 12 1.54011381    Y
 14 1.84954487    Y
 19 1.87675183    Y
 15 1.97767162    Y

 and I am trying to find the number of X's that occur before ith Y occurs.
 For example, there is 1 X before the first Y, so I get 1. There are 4 X's
 before the second Y, so I get 4, there is no X between second and third Y,
 so I get 0 and so on. Any hint to at least help me to start this will be
 appreciated. Thanks a lot!

Using dput() to provide reproducible data would be nice, but failing that
here's a simple example with sample data:

 testdata - c(x, y, x, x, x, y, x, x, x, x, x, y, y)
 rle(testdata)
Run Length Encoding
  lengths: int [1:6] 1 1 3 1 5 2
  values : chr [1:6] x y x y x y

You can use the values component of the list returned by rle to subset the
lengths component of the list to get only the x values if that's what you
need to end up with.
 rle(testdata)$lengths[rle(testdata)$values == x]
[1] 1 3 5


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

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


Re: [R] Proper Syntax for Logical Subset in Subset()

2011-11-02 Thread Rich Shepard

On Wed, 2 Nov 2011, Bert Gunter wrote:


To make such a plot, I would have thought your want your data structure to
be:



Column A: Date
Column B; Chemical
Column C: Result


  Thanks, Bert. I have a data frame in that format.


After subsetting this to the chemicals you want or doing the subsetting in
your plot command, something like (base R)

boxplot(Result ~ Chemical, subset=yourdat$Chemical %in% c(Ca,Cl,
Cond,Mg,Na,SO2,TDS))


  Great! I'll work with this. I tend to use lattice so I can learn its
capabilities better.


Whether I'm correct or not in my understanding of your situation, an
important message is: you should choose your data structure to facilitate
the analysis that you have in mind. IMHO, this is one of R's great
strengths: it provides rich facilities for manipulating data tightly
integrated with plotting and analytical capabilities.


  I recognize this and continue to learn how best to represent the same data
for different analyses and plots.

Much appreciated,

Rich

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] nproc parameter in efpFunctional

2011-11-02 Thread Achim Zeileis

On Wed, 2 Nov 2011, bonda wrote:


Hello all,
could anyone explain the exact meaning of parameter nproc? Why different
values of nproc give so different critical values, i.e.

meanL2BB$computeCritval(0.05,nproc=3)
[1] 0.9984853
meanL2BB$computeCritval(0.05,nproc=1)
[1] 0.4594827

The strucchange-package description gives integer specifying for which
number of processes Brownian motions should be simulated - do I need
nproc-dimensional Brownian bridge?


Yes, see the 2006 CSDA paper, especially pages 2998/9.


Thank you in advance!
Julia

--
View this message in context: 
http://r.789695.n4.nabble.com/nproc-parameter-in-efpFunctional-tp3972419p3972419.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.


Re: [R] Multiple comparison test about whole population, not about mean

2011-11-02 Thread Bert Gunter
1. I found the post incoherent.
2. This appears to have nothing to do with R -- post elsewhere, e.g.
http://stats.stackexchange.com/

-- Bert

On Wed, Nov 2, 2011 at 10:47 AM, Serge-Étienne Parent separ...@yahoo.comwrote:

 Multiple comparison tests are usually used to compare groups based on the
 confidence region about the mean. Some great packages, like agricolae,
 proposes grouping information based on statistical tests. I am looking for
 a way to perform such a test, but based on the confidence region about the
 whole population. I tried to hack LSD.test and HSD.test functions
 (agricolae), without much success.

 (1) Is this valid to use multiple comparisons across population?
 (2) If it is, anyone knows how I could do that?

 Kind Regards,

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




-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

[[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] does there any function like sumif in excel?

2011-11-02 Thread David Winsemius


On Nov 2, 2011, at 9:06 AM, Celine wrote:


I have a similar problem
I have a dataframe :

CELLCD AreaProtected
  8928  52.39389
  8928  41.91511
  8929  21.21975
  8929  63.65925
  8930  26.08547
  8930  14.04602

I wouldlike to sum the AreaProtected if it is the same CELLCD in  
another

column :

CELLCD AreaProtectedSumAreaProtected
  8928  52.39389  94.309
  8928  41.91511
  8929  21.21975  84,879
  8929  63.65925
  8930  26.08547
  8930  14.04602

I am just started with R and I don't know how I can do that.
Do you have any ideas ?


You could get sums within groups using the ave() function. It would  
put values on all rows. Was there a reason you only wanted values on  
the first? Then if you wanted to make the non-first elements NA that  
could also be done.



--
View this message in context: 
http://r.789695.n4.nabble.com/does-there-any-function-like-sumif-in-excel-tp858444p3972963.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.


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Sum with condition

2011-11-02 Thread David Winsemius


On Nov 2, 2011, at 2:11 PM, Sarah Goslee wrote:


Hi,

On Wed, Nov 2, 2011 at 8:44 AM, Celine bellard.cel...@gmail.com  
wrote:


Celine. Please stop posting duplicates.



CELLCD AreaProtected
 8928  52.39389
 8928  41.91511
 8929  21.21975
 8929  63.65925
 8930  26.08547
 8930  14.04602


You'll need to figure out how you want it to be combined with the
original data frame, since there can't be empty cells, but:


dput(testdata)

structure(list(CELLCD = c(8928L, 8928L, 8929L, 8929L, 8930L,
8930L), AreaProtected = c(52.39389, 41.91511, 21.21975, 63.65925,
26.08547, 14.04602)), .Names = c(CELLCD, AreaProtected), class =
data.frame, row.names = c(NA,
-6L))


aggregate(testdata$AreaProtected, by=list(CELLCD=testdata$CELLCD),  
FUN=sum)

CELLCDx
1   8928 94.30900
2   8929 84.87900
3   8930 40.13149


Or:
 testdata$SumArea - with(testdata, ave(AreaProtected, CELLCD,  
FUN=sum))

 testdata
 CELLCD AreaProtected  SumArea
1   8928  52.39389 94.30900
2   8928  41.91511 94.30900
3   8929  21.21975 84.87900
4   8929  63.65925 84.87900
5   8930  26.08547 40.13149
6   8930  14.04602 40.13149

--
David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] array manipulation

2011-11-02 Thread David Winsemius


On Nov 2, 2011, at 12:16 PM, Simone Salvadei wrote:


Hello,
I'm at the very beginning of the learning process of this language.
Sorry in advance for the (possible but plausible) stupidity of my  
question.


I would like to find a way to permute the DIMENSIONS of an array.
Something that sounds like the function permute() in matlab.

Given an array C of dimensions c x d x T , for instance, the command

permute(C, [2 1 3])



?aperm


would provide (in Matlab) an array very similar to C, but this time  
each

one of the T matrices c x d has changed into its transposed.
Any alternatives to the following (and primitive) 'for' cycle?

*# (previously defined) phi=array with dimensions c(c,d,T)*
*
*
*temp=array(0,dim=c(c,d,T))*
* for(i in 1:T)*
* {*
* temp[,,i]=t(phi[,,i])*
* }*
* phi=temp*
*
*




David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Sum with condition

2011-11-02 Thread S Ellison
If you used aggregate() on  the data frame you would have a new data frame 
containing the sum of all AreaProtected for each CELLCD. For your mini-example, 
using d as your data frame, 
d2-aggregate(d[,2], by=list(CELLCD=d$CELLCD),sum)

d2
#   CELLCDx
# 1   8928 94.30900
# 2   8929 84.87900
# 3   8930 40.13149

If you then use merge() you get
merge(d,d2)

#  CELLCD AreaProtectedx
#1   8928  52.39389 94.30900
#2   8928  41.91511 94.30900
#3   8929  21.21975 84.87900
#4   8929  63.65925 84.87900
#5   8930  26.08547 40.13149
#6   8930  14.04602 40.13149

Maybe one of those is what you want?


 -Original Message-
 From: r-help-boun...@r-project.org 
 [mailto:r-help-boun...@r-project.org] On Behalf Of Celine
 Sent: 02 November 2011 12:44
 To: r-help@r-project.org
 Subject: [R] Sum with condition
 
 I guess my problem is simple for most of you but I am new 
 with R and I need some help, I have a dataframe : 
 
 CELLCD AreaProtected
8928  52.39389
8928  41.91511
8929  21.21975
8929  63.65925
8930  26.08547
8930  14.04602
 
 I wouldlike to sum the AreaProtected if it is the same CELLCD 
 in another column :
 
 CELLCD AreaProtectedSumAreaProtected
8928  52.39389  94.309
8928  41.91511
8929  21.21975  84,879
8929  63.65925
8930  26.08547
8930  14.04602
 
 I am just started with R and I don't know how I can do that.
 Do you have any ideas ?
 
 
 Thanks a lot for your help,
 
 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Sum-with-condition-tp3972839p397
 2839.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.
 ***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] heteroscedastic bivariate distribution with linear regression - prediction interval

2011-11-02 Thread Vern
Dear forum,

which is the most suitable method to get the prediction interval of a
bivariate normal distribution which is consistent with a linear model y = ax
+ b?

I assume it is gls + predict. Am I correct? I'm rather new to R. 
Is there some reliable sample code for that problem?

Thank you
best regards

--
View this message in context: 
http://r.789695.n4.nabble.com/heteroscedastic-bivariate-distribution-with-linear-regression-prediction-interval-tp3981793p3981793.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] HOW TO REMOVE MTEXT FROM PLOT, plotting changing populations with titles in loop

2011-11-02 Thread prinzOfNorway
is there a way to hide/undraw mtext (or lines etc.) in a loop like

plot(runif(10))
iterCol - rainbowPalette(10)

for(i in 1:10){

mtext(paste(this is iteration , i, sep=))
points(runif(10),col=iterCol[i])
Sys.sleep(1)

## UNDRAW/HIDE the text so that it does not mess up the plot in the next
iteration

}



--
View this message in context: 
http://r.789695.n4.nabble.com/HOW-TO-REMOVE-MTEXT-FROM-PLOT-plotting-changing-populations-with-titles-in-loop-tp3981757p3981757.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] HOW TO REMOVE MTEXT FROM PLOT, plotting changing populations with titles in loop

2011-11-02 Thread Sarah Goslee
It's not perfect, but you could use:

mtext(paste(this is iteration , i, sep=), col=white)

to overwrite it, or polygon() to draw a white rectangle over the text each time.

Sarah

On Wed, Nov 2, 2011 at 3:15 PM, prinzOfNorway torgrim...@gmail.com wrote:
 is there a way to hide/undraw mtext (or lines etc.) in a loop like

 plot(runif(10))
 iterCol - rainbowPalette(10)

 for(i in 1:10){

 mtext(paste(this is iteration , i, sep=))
 points(runif(10),col=iterCol[i])
 Sys.sleep(1)

 ## UNDRAW/HIDE the text so that it does not mess up the plot in the next
 iteration

 }


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

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


Re: [R] overloading + operator for chars

2011-11-02 Thread Martin Morgan

On 11/02/2011 06:52 AM, Albert-Jan Roskam wrote:

Hello,

I would like to overload the + operator so that it can be used to concatenate two strings, e.g 
John + Doe = JohnDoe.
How can I 'unseal' the + method?

setMethod(+, signature(e1=character, e2=character), function(e1, e2) paste(e1, e2, 
sep=) )

Error in setMethod(+, signature(e1 = character, e2 = character),  :
   the method for function + and signature e1=character, e2=character is 
sealed and cannot be re-defined






Hi -- I think the two issues are that + is part of the Arith group 
generic (?Methods, ?Arith) and that `+` (actually, members of the Ops 
group) for primitive types dispatches directly without doing method 
look-up. Personally I might


setClass(Character, contains=character)

Character - function(...) new(Character, ...)

setMethod(Arith, c(Character, Character), function(e1, e2) {
switch(.Generic,
   +=Character(paste(e1, e2, sep=)),
   stop(unhandled 'Arith' operator ', .Generic, '))
})

and then

 Character(c(foo, bar)) + Character(baz)
[1] foobaz barbaz

Some might point to

 `%+%` - function(e1, e2) paste(e1, e2, sep=)
 foo %+% bar
[1] foobar

Martin


Cheers!!
Albert-Jan


~~
All right, but apart from the sanitation, the medicine, education, wine, public 
order, irrigation, roads, a fresh water system, and public health, what have 
the Romans ever done for us?
~~
[[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.



--
Computational Biology
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109

Location: M1-B861
Telephone: 206 667-2793

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 curr directory in R

2011-11-02 Thread Khanvilkar, Shashank
Hello All
Thanks for all responses in advance,

I am invoking R from command line from C:\TEMP as

C:\Program Files\R\R-2.9.1\bin\R.exe --vanilla -f C:\temp\test.R

On two different machines
The test.R looks like:
--SNIP-
print(c(CurrDir=, getwd()))

proc.time()
warnings()
--SNIP-


On one machine I get the currDir Correctly printed as C:/TEMP
But on another it gets printed as C:/


Does anyone know why this can be.. Is there some env variable that R is giving 
priority over current dir?

Thanks
Shank




[[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] palettes for the color-blind

2011-11-02 Thread Max Kuhn
Everyone,

I'm working with scatter plots with different colored symbols (via
lattice). I'm currently using these colors for points and lines:

col1 - c(rgb(1, 0, 0), rgb(0, 0, 1),
 rgb(0, 1, 0),
 rgb(0.55482458, 0.40350876, 0.0416),
 rgb(0, 0, 0))
plot(seq(along = col1), pch = 16, col = col1, cex = 1.5)

I'm also using these with transparency (alpha between .5-.8 depending
on the number of points).

I'd like to make sure that these colors are interpretable by the color
bind. Doing a little looking around, this might be a good palette:

col2 - c(rgb(0, 0.4470588, 0.6980392),
  rgb(0.8352941, 0.3686275, 0,   ),
  rgb(0.800, 0.4745098, 0.6549020),
  rgb(0.1686275, 0.6235294, 0.4705882),
  rgb(0.9019608, 0.6235294, 0.000))

plot(seq(along = col2), pch = 16, col = col2, cex = 1.5)

but to be honest, I'd like to use something a little more vibrant.

First, can anyone verify that these the colors in col2 are
differentiable to someone who is color blind?

Second, are there any other specific palettes that can be recommended?
How do the RColorBrewer palettes rate in this respect?

Thanks,

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] palettes for the color-blind

2011-11-02 Thread baptiste auguie
Hi,

Try the dichromat package (also dichromat_pal in the scales package).

HTH,

baptiste

On 3 November 2011 10:26, Max Kuhn mxk...@gmail.com wrote:
 Everyone,

 I'm working with scatter plots with different colored symbols (via
 lattice). I'm currently using these colors for points and lines:

 col1 - c(rgb(1, 0, 0), rgb(0, 0, 1),
         rgb(0, 1, 0),
         rgb(0.55482458, 0.40350876, 0.0416),
         rgb(0, 0, 0))
 plot(seq(along = col1), pch = 16, col = col1, cex = 1.5)

 I'm also using these with transparency (alpha between .5-.8 depending
 on the number of points).

 I'd like to make sure that these colors are interpretable by the color
 bind. Doing a little looking around, this might be a good palette:

 col2 - c(rgb(0,         0.4470588, 0.6980392),
          rgb(0.8352941, 0.3686275, 0,       ),
          rgb(0.800, 0.4745098, 0.6549020),
          rgb(0.1686275, 0.6235294, 0.4705882),
          rgb(0.9019608, 0.6235294, 0.000))

 plot(seq(along = col2), pch = 16, col = col2, cex = 1.5)

 but to be honest, I'd like to use something a little more vibrant.

 First, can anyone verify that these the colors in col2 are
 differentiable to someone who is color blind?

 Second, are there any other specific palettes that can be recommended?
 How do the RColorBrewer palettes rate in this respect?

 Thanks,

 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-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] palettes for the color-blind

2011-11-02 Thread Thomas Lumley
On Thu, Nov 3, 2011 at 10:26 AM, Max Kuhn mxk...@gmail.com wrote:

 First, can anyone verify that these the colors in col2 are
 differentiable to someone who is color blind?

 Second, are there any other specific palettes that can be recommended?
 How do the RColorBrewer palettes rate in this respect?

If you go to www.colorbrewer.org, the ColorBrewer site, it has ratings
of the palettes for visibility under a variety of conditions,
including red-green color blindness. Some of them are good, but not
all of them.

The dichromat package attempts to show the impact of both sorts of
red:green anomalous vision on color visibility.  It isn't quite right
because of gamma correction, but people have told me that it is a
fairly good representation, and it does have the right impact on
clustering of pixels in some of the Ishihara color vision tests.   It
suggests that your colors 1 and 3 will be too similar and 2 and 4 will
also be too similar for someone with protanopia.

You aren't going to be able to get five colors that are equal
luminance, equal chroma, and distinguishable to dichromats: you're
putting three constraints on a three-dimensional space and you will
end up with just two points.

For three colors I would suggest orange, blue, gray. More than three
will be hard.

  -thomas

-- 
Thomas Lumley
Professor of Biostatistics
University of Auckland

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] difference between foo$a[2] - 1 and foo[2,a] - 1

2011-11-02 Thread Jeff Newmiller
Columns in data frames must all have the same number of elements. Your first 
example attempts to violate that, because it works with a single column. The 
second example works on the entire data frame, so it is able to lengthen the 
other column to match.
---
Jeff Newmiller The . . Go Live...
DCN:jdnew...@dcn.davis.ca.us Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

Rebecca Hiller hille...@gmail.com wrote:

Hallo 

Can anyone tell me the difference between

foo$a[2] - 1 and foo[2,a] - 1 ?

I thought that both expressions are equivalent, but when I run the following 
example, there is obviously a difference.


 foo - data.frame(a=NA,b=NA)
 foo
a b
1 NA NA
 foo$a[1] - 1
 foo$b[1] - 2
 foo$a[2] - 1
Error in `$-.data.frame`(`*tmp*`, a, value = c(1, 1)) : 
replacement has 2 rows, data has 1
 foo[2,a] - 1
 foo
a b
1 1 2
2 1 NA

Thanks,
Rebecca Hiller


--
ETH Zürich
Rebecca Hiller
Institute of Agricultural Sciences
LFW A2
Universitätsstrasse 2
8092 Zürich
SWITZERLAND

rebecca.hil...@ipw.agrl.ethz.ch
http://www.gl.ethz.ch/

+41 44 632 31 90 Telefon
+41 44 632 11 53 Fax

_

R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] palettes for the color-blind

2011-11-02 Thread Carl Witthoft


Before you pick out a palette:  you are aware that their are several 
different types of color-blindness, aren't you?


http://en.wikipedia.org/wiki/Color_blind


--

Sent from my Cray XK6
Pendeo-navem mei anguillae plena est.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Help with curr directory in R

2011-11-02 Thread Khanvilkar, Shashank
I think I have solved this problem
The issue was:
some user had changed the registry entry for 
HKEY_CURRENT_USER\Software\Microsoft\Command Processor
(added Autorun and set it to C:\)

So the current dir was always pointing to C:\

I deleted that and everything works.

Thanks
Shank

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Khanvilkar, Shashank
Sent: Wednesday, November 02, 2011 2:15 PM
To: R Mailing List
Subject: [R] Help with curr directory in R

Hello All
Thanks for all responses in advance,

I am invoking R from command line from C:\TEMP as

C:\Program Files\R\R-2.9.1\bin\R.exe --vanilla -f C:\temp\test.R

On two different machines
The test.R looks like:
--SNIP-
print(c(CurrDir=, getwd()))

proc.time()
warnings()
--SNIP-


On one machine I get the currDir Correctly printed as C:/TEMP
But on another it gets printed as C:/


Does anyone know why this can be.. Is there some env variable that R is giving 
priority over current dir?

Thanks
Shank




[[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] Error: serialization is too large to store in a raw vector

2011-11-02 Thread Alaios
Dear all,
I have quite large code (with lapply and mclapply)
and I am getting the following error.

Error: serialization is too large to store in a raw vector

Is it possible to ask from R to extend the Error messages with more details?
I would like to see where this problem exists.

B.R
Alex
[[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] palettes for the color-blind

2011-11-02 Thread Thomas Lumley
On Thu, Nov 3, 2011 at 11:04 AM, Carl Witthoft c...@witthoft.com wrote:

 Before you pick out a palette:  you are aware that their are several
 different types of color-blindness, aren't you?

Yes, but to first approximation there are only two, and they have
broadly similar, though not identical impact on choice of color
palettes.  The dichromat package knows about them, and so does
Professor Brewer.

More people will be unable to read your graphs due to some kind of
gross visual impairment (cataracts, uncorrected focusing problems,
macular degeneration, etc) than will have tritanopia or monochromacy.

   -thomas

-- 
Thomas Lumley
Professor of Biostatistics
University of Auckland

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Error: serialization is too large to store in a raw vector

2011-11-02 Thread Bert Gunter
?traceback
?options  ## especially _recover_ for the error option.

-- Bert

On Wed, Nov 2, 2011 at 3:37 PM, Alaios ala...@yahoo.com wrote:

 Dear all,
 I have quite large code (with lapply and mclapply)
 and I am getting the following error.

 Error: serialization is too large to store in a raw vector

 Is it possible to ask from R to extend the Error messages with more
 details?
 I would like to see where this problem exists.

 B.R
 Alex
[[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.




-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

[[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] mysterious warning message regarding bytecode...

2011-11-02 Thread Justin Haynes
While running a long script which source()s other scripts I get the
following warning:

Warning message:
In t(object$S[[1]]) : bytecode version mismatch; using eval


I cannot replicate it if I run the sourced files line by line though...

What is that error?  And do I care about it?  It doesn't seem to
affect my output as far as I can tell.


Thanks!
Justin


 sessionInfo()
R version 2.13.2 (2011-09-30)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=C  LC_MESSAGES=en_US.UTF-8
LC_PAPER=en_US.UTF-8   LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
 [1] mgcv_1.7-9stringr_0.5   RPostgreSQL_0.2-0 biglm_0.8
  DBI_0.2-5 doMC_1.2.3multicore_0.1-7
 [8] foreach_1.3.2 codetools_0.2-8   iterators_1.0.5
cairoDevice_2.19  pixmap_0.4-11 gridExtra_0.8.5   splancs_2.01-29
[15] sp_0.9-91 ellipse_0.3-5 ggplot2_0.8.9
proto_0.3-9.2 reshape_0.8.4 plyr_1.6  MASS_7.3-14

loaded via a namespace (and not attached):
[1] compiler_2.13.2 digest_0.5.1lattice_0.19-33 Matrix_1.0-1nlme_3.1-102

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] StatET: Commands are not submitted to the console

2011-11-02 Thread syrvn
Hello!

I am working for quite a while now with the Eclipse/StatET approach and it
always worked very well

until I updated to the 2.0 version of StatET. After the official release the
RJ console did not start. 

After they released another update a couple of days later it worked fine
again.

I did not do any programming for a week now and today I realised that when I
execute the selected lines 

in an R file they are not submitted to the console. I also tried RTerm
instead of RJ but it's the same 

problem. Commands are not submitted to the console.


Did anyone come across the same problem and knows how to fix that. Googling
does not result in any 

useful pages


I am running Mac OS X Lion + Newest version of Eclipse and StatET.
Everything is up to date.


Cheers,

syrvn
 

--
View this message in context: 
http://r.789695.n4.nabble.com/StatET-Commands-are-not-submitted-to-the-console-tp3983662p3983662.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] Lattice plots and missing x-axis labels on second page

2011-11-02 Thread Evans, David G (DFG)
Hello, 
I'm trying to make a lattice plot (using xyplot()). I have included a
layout=c(3,4) statement, giving me 12 plots per page and an
as.table=TRUE statement, directing the way the plots are laid out.  I
have 18 plots altogether and so 6 of them end up on the second page.
Everything looks fine for the first page, but the x-axis labels (e.g.
1993, 1994...) are all missing on the second page.  The x-axis variable
name (Year) is there at the bottom, however.   Any help is
appreciated. Thanks.

David G. Evans
Biometrician
Division of Sport Fish
Alaska Dept . of Fish and Game
Anchorage, Ak 99518

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 2.14.0 installation problem (?)

2011-11-02 Thread Peter Langfelder
Hi all,

I downloaded R-2.14.0.tar.gz, unpacked, ran configure with
--with-blas=-lgoto2, built, then issued

make install rhome=/usr/local/lib/R-2.14.0-goto

This produced the following error:

[lots of output deleted]

make[3]: Entering directory
`/home/plangfelder/Download/R-2.14.0/src/modules/lapack'
cp: cannot create regular file
`/usr/local/lib/R-2.14.0-goto/lib/libRlapack.so': No such file or
directory
make[3]: *** [install] Error 1
make[3]: Leaving directory
`/home/plangfelder/Download/R-2.14.0/src/modules/lapack'
make[2]: *** [install] Error 1
make[2]: Leaving directory `/home/plangfelder/Download/R-2.14.0/src/modules'
make[1]: *** [install] Error 1
make[1]: Leaving directory `/home/plangfelder/Download/R-2.14.0/src'
make: *** [install] Error 1

Apparently the error was caused by the fact that the script neglected
to create the directory /usr/local/lib/R-2.14.0-goto/lib/ before
attempting to copy the libRlapack.so file into it. Creating the
directory manually and re-running make install
rhome=/usr/local/lib/R-2.14.0-goto solved the problem. The installed R
seems to work fine.

Is it a bug in the appropriate Makefile, or did I do something wrong?
I'm on Fedora 9 (i686, i386, kernel 2.6.27.25-78.2.56.fc9.i686 if that
makes any difference)...

Thanks,

Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Kolmogorov-Smirnov-Test on binned data, I guess gumbel-distributed data

2011-11-02 Thread Jochen1980
Hi R-Users,

I read some texts related to KS-tests. Most of those authors stated, that
KS-Tests are not suitable for binned data, but some of them refer to 'other'
authors who are claiming that KS-Tests are okay for binned data. 

I searched for sources and can't find examples which approve that it is okay
to use KS-Tests for binned data - do you have any links to articles or
tutorials? 

Anyway, I look for a test  which backens me up that my data is
gumbel-distributed. I estimated the gumbel-parameters mue and beta and after
having a look on  resulting plots, in my opinion: that looks quite good! 

You can the plot, related data, and the rscript here:
www.jochen-bauer.net/downloads/kstest/Rplots-1000.pdf
http://www.jochen-bauer.net/downloads/kstest/rm2700-1000.txt
http://www.jochen-bauer.net/downloads/kstest/rcalc.R 

The story about the data:
I am wondering what test I should choose if KS-Test is not appropriate? I
get real high p-Values for data-row-1-histogram-heights and
fitted-gumbel-distribution-function-to-bin-midth-vals. Most of the time,
KS-test results in distances of 0.01 and p-Values of 0.99 or 1. This sounds
strange to me, too high. Otherwise my plots are looking good and as you can
see, in my first experiment I sampled 1000 values. In a second experiment I
created only 50 random-values for the gumbel-parameter-estimation. I try to
reduce permutations, so I will be able to create results faster, but I have
to find out, when data fails for gumbel-distribution. The results surprised
me, I expected that my tests and plots get worse, but I got still high
p-values for the KS-Test and still a nice looking plot.

www.jochen-bauer.net/downloads/kstest/Rplots-0050.pdf
http://www.jochen-bauer.net/downloads/kstest/rm2700-0050.txt

Moreover besides the shuffled data of my randomisation-test there are
real-data-values. I calculated the p-value that my real data point occurs
under estimated gumbel distribution. Those p-values  between
1000permutation-experiment and 50-permutation-experiment are correlating
enormously ... around 0.98. Pearson and Spearman-correlation-coefficients
told me this. I guess that backens up the fact, that my plots are not
getting worse nor the KS-Tests do. 

I hope I was able to state my current situation and you are able to give me
some hints, for some literature or other tests or backen me up in my guess
that my data is gumbel-distributed.

Thanks in advance.

Jochen

I hope I was able to tell  


--
View this message in context: 
http://r.789695.n4.nabble.com/Kolmogorov-Smirnov-Test-on-binned-data-I-guess-gumbel-distributed-data-tp3983781p3983781.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] Lattice plots and missing x-axis labels on second page

2011-11-02 Thread Evans, David G (DFG)
I should say I'm using Windows-7, R version 2.13.0 and lattice version
0.19-33.  I've pared down my code to this :

pdat = read.table(RGRAPHSDGE.csv,header=T,sep=,,fill=T)
print(xyplot(pdat$NITRATE~pdat$DATEYR|pdat$WELL,
as.table=TRUE,
layout=c(3,4),
xlab=Year,
ylab=Nitrate mg / litre,
strip=FALSE
)) 

First 3 lines of pdat looks like this:
  WELL   DATEYR NITRATE
1 ALASKA CHILDRENS SERVICES 1993.8360.81
2 ALASKA CHILDRENS SERVICES 1994.8500.91
3 ALASKA CHILDRENS SERVICES 1995.8030.94

Thanks again.

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Evans, David G (DFG)
Sent: Wednesday, November 02, 2011 3:24 PM
To: r-help@r-project.org
Subject: [R] Lattice plots and missing x-axis labels on second page

Hello,
I'm trying to make a lattice plot (using xyplot()). I have included a
layout=c(3,4) statement, giving me 12 plots per page and an
as.table=TRUE statement, directing the way the plots are laid out.  I
have 18 plots altogether and so 6 of them end up on the second page.
Everything looks fine for the first page, but the x-axis labels (e.g.
1993, 1994...) are all missing on the second page.  The x-axis variable
name (Year) is there at the bottom, however.   Any help is
appreciated. Thanks.

David G. Evans
Biometrician
Division of Sport Fish
Alaska Dept . of Fish and Game
Anchorage, Ak 99518

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] anova or liklihood ratio test from biglm output

2011-11-02 Thread Chris Howden
(Sorry if this is a repost, I got a bounce reply from the r-help server)



Hi,



I’m using the biglm() function to create some linear models for a very
large data set than lm() can’t fit due to memory issues (the problem is
with the number of interactions, I can fit the main effects model)



I need to determine if the 2-way interactions are necessary or not. Ideally
I’d like to use anova() to get an anova table and a p-value for the
interactions, however it appears that anova is not supported for biglm
objects.



So my next idea was to compare the main effects model with the 2-way
interaction model using a likelihood ratio test. I seem to be able to get
the deviance and residual DF from a biglm object, so I think I should be
able to calculate the LRT and get my p-value if I assume a chi-squared
distribution.



I was wondering if anyone sees any problems with this approach (or would be
kind enough to confirm it)? Or has any better suggestions, ideas or
comments?



Thankyou





Chris Howden B.Sc. (Hons) GStat.

Founding Partner

Evidence Based Strategic Development, IP Commercialisation and Innovation,
Data Analysis, Modelling and Training

(mobile) 0410 689 945

(fax) +612 4782 9023

ch...@trickysolutions.com.au

[[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] Error: serialization is too large to store in a raw vector

2011-11-02 Thread David Winsemius


On Nov 2, 2011, at 6:37 PM, Alaios ala...@yahoo.com wrote:

 Dear all,
 I have quite large code (with lapply and mclapply)
 and I am getting the following error.
 
 Error: serialization is too large to store in a raw vector
 
 Is it possible to ask from R to extend the Error messages with more details?
 I would like to see where this problem exists.
 
?traceback

 B.R
 Alex
[[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] palettes for the color-blind

2011-11-02 Thread Max Kuhn
Yes, I was aware of the different type and their respective prevalences.

The dichromat package helped me find what I needed.

Thanks,

Max

On Wed, Nov 2, 2011 at 6:38 PM, Thomas Lumley tlum...@uw.edu wrote:
 On Thu, Nov 3, 2011 at 11:04 AM, Carl Witthoft c...@witthoft.com wrote:

 Before you pick out a palette:  you are aware that their are several
 different types of color-blindness, aren't you?

 Yes, but to first approximation there are only two, and they have
 broadly similar, though not identical impact on choice of color
 palettes.  The dichromat package knows about them, and so does
 Professor Brewer.

 More people will be unable to read your graphs due to some kind of
 gross visual impairment (cataracts, uncorrected focusing problems,
 macular degeneration, etc) than will have tritanopia or monochromacy.

   -thomas

 --
 Thomas Lumley
 Professor of Biostatistics
 University of Auckland

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




-- 

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.