[R] Correlation between two multi-dimensional matrices

2008-04-08 Thread Ng Stanley
Hi,

Are there any methods for computing the correlation between two
multi-dimensional matrices ? Will transforming the matrices into vectors and
applying pearson be fine ? Any blind spots that I should be aware ?

Thanks
Stanley

[[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] preallocating matrices and rda read-back objects

2008-04-08 Thread Alexy Khrabrov
I've read in Phil Spector's new book that it's a good idea to  
preallocate a big matrix, like

u <- matrix(0,nrow,ncol) # (1)

Now, I read contents of a huge matrix from a Fortran binary dump.

u <- readBin(con,what="double",n=nrow*ncol) # (2)

If I do (1) and then (2), u is a vector, obviously it's either  
reallocated or its matrix nature is lost -- overridden?  overwritten?

Instead, I do it now as

u <-  
matrix(readBin(con,what="double",n=nrow*ncol),nrow=nrow,ncol=ncol) # (3)

What's going on with memory management here and what's the right way  
to make it efficient -- and how to preallocate?

After that, I'm saving u as R binary object in an rda file.  Does it  
make sense to preallocate u before reading it back now from the rda  
file?

Cheers,
Alexy

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


Re: [R] R in a cluster environment?

2008-04-08 Thread Prof Brian Ripley

On Tue, 8 Apr 2008, Tornes, Ivan E wrote:

I'm a cluster administrator and one of my users has requested that I 
install R on our system.  Can R be used in a cluster computing 
environment that utilizes batch processing, i.e. no graphical output 
during processing?


Yes, easily.

Also, can R be parallelized to run on many nodes/processors 
simultaneously?


Not R itself. However, there are R extensions to enable R tasks to be 
distributed to R processes running on separate systems, over MPI or PVM 
for example. AFAIK our cluster users of R do not do that, but they do run 
simulations involving many separate R tasks whose results are later 
combined.



Ivan

Ivan E. Tornes Ph.D.
Battelle
505 King Avenue
Columbus, OH 43201-2693
 
Phone:614-424-5165
Fax:614-458-5165


--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] question about nlminb

2008-04-08 Thread Spencer Graves
  Have you considered optimizing over x1 = x[1:(length(x)-1]?   You 
could feed a wrapper function 'f2(x1, ...)' that computes xFull = c(x1, 
1-sum(x1)) and feeds that to your 'fn'. 

  If this makes sense, great.  Else, if my answer is not useful, be 
so kind as to PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html and provide commented, 
minimal, self-contained, reproducible code. 

  Spencer

John Pitchard wrote:
>  Dear All,
>
> I wanted to post some more details about the query I sent to s-news last
> week.
>
> I have a vector with a constraint. The constraint is that the sum of the
> vector must add up to 1 - but not necessarily positive, i.e.
>
> x[n] <- 1 -(x[1] + ...+x[n-1])
>
> I perform the optimisation on the vector x such that
>
> x <- c(x, 1-sum(x))
>
> In other words,
>
> fn <- function(x){
>   x <- c(x, 1 - sum(x))
>   # other calculations here
> }
>
> then feed this into nlminb()
>
> out <- nlminb(x, fn)
> out.x <- out$parameters
> out.x <- c(out.x, 1 - sum(out.x))
> out.x
>
> I would like to calculate standard errors for each of the components of x.
> Is this possible by outputing the Hessian matrix? Furthermore, how would I
> calculate this for the last component (if this is indeed possible) which has
> the restriction (i.e. 1-sum(out.x))?
>
> Any help would be much appreciated.
>
> Regards,
> John
>
>   [[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] R in a cluster environment?

2008-04-08 Thread Tornes, Ivan E
I'm a cluster administrator and one of my users has requested that I install R 
on our system.  Can R be used in a cluster computing environment that utilizes 
batch processing, i.e. no graphical output during processing?  Also, can R be 
parallelized to run on many nodes/processors simultaneously?

Ivan

Ivan E. Tornes Ph.D.
Battelle
505 King Avenue
Columbus, OH 43201-2693
 
Phone:614-424-5165
Fax:614-458-5165

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


[R] problem in ls.ranking.capa.ident mehod

2008-04-08 Thread Hazura Zulzalil
Hi R-experts,

I apologize for the multiple posting...

My previous post seems to have been eaten by the server because of
embedded code. 

First of all, I am working on Windows XP, using R version 2.6.2. 


I got this error message

" Error in drop(.Call("La_dgesv", a, as.matrix(b), tol, PACKAGE = 
"base")) :
  system is computationally singular: reciprocal condition number = 
4.68861e-18


a1 <- c(76.18, 61.84, 60.4, 69.09)
a2 <- c(51.01, 50.39, 87.62, 52.03)
a3 <- c(80.08, 48.49, 90.86, 76.11)
a4 <- c(57.71, 38.99, 88.7, 53.12)
a5 <- c(71.93, 82.04, 83.05, 85.99)
a6 <- c(60.94, 71.12, 63.61, 69.47)

##preference threshold relative
## to the preorder of the alternatives

C<- rbind (a1, a2, a3, a4, a5, a6)
 rk.proto <- rbind (c(5,3), c(3,1), c(1,6), c(6,4), c(4,2))
Asp <-rbind (c(1,2,-delta.S), c(2,1,-delta.S), c(3, 4,-delta.S), c(4, 3, 
-delta.S))
 
## an interaction preorder constraint matrix
delta.I <- 0.05
Aii <- rbind (c(1,2,-1,-delta.I), c(1,3,delta.I, 1), c (1,4,-1,-delta.I),
+ c(2,3, delta.I,1), c(2, 4,-1,-delta.I), c(3,4,delta.I, 1))
 
gls <-ls.ranking.capa.ident(4,2,C, rk.proto,0.5, A.Shapley.preorder = 
Asp, A.interaction.interval = Aii)
Error in drop(.Call("La_dgesv", a, as.matrix(b), tol, PACKAGE = "base")) :

Kindly help me if anyone who has experienced the same problem with me.

Thanks in advance

Hazura

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

2008-04-08 Thread Yuelin Li
Many thanks to John Fox and Charles C. Berry.  Both point to the paper
by Hoenig and Heisey (email from John Fox below):

> Another paper critical of post-hoc power calculations is Hoenig and Heisey,
> 2001. "The Abuse of Power: The Pervasive Fallacy of Power Calculations for
> Data Analysis." The American Statistician, 55, 19-24. Hoenig and Heisey show
> that so-called "observed power" is simply a re-expression of the p-value.


 
 =
 
 Please note that this e-mail and any files transmitted with it may be 
 privileged, confidential, and protected from disclosure under 
 applicable law. If the reader of this message is not the intended 
 recipient, or an employee or agent responsible for delivering this 
 message to the intended recipient, you are hereby notified that any 
 reading, dissemination, distribution, copying, or other use of this 
 communication or any of its attachments is strictly prohibited.  If 
 you have received this communication in error, please notify the 
 sender immediately by replying to this message and deleting this 
 message, any attachments, and all copies and backups from your 
 computer.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] "preferred" version of Linux for R?

2008-04-08 Thread Dirk Eddelbuettel

On 8 April 2008 at 19:06, Mitchell Maltenfort wrote:
| If your criterion is use of resources, then you might be more
| interested in which flavor of Linux makes it easy to turn the X-window
| server off.  No windows or mouse, more RAM and CPU cycles for R.  As I
| recall, the only Linux where that might be a problem is Ubuntu,
| because there's no convenient way to kill the X-server.

That conjecture is easily disproved by example: 'sudo /etc/init.d/gdm stop'
and finding the correct forms for kdm and xdm is left as an exercise for the
reader. 

The /etc/init.d scripts have been working all those fourteen years I've been
using Debian and Ubuntu 

Dirk

--
Three out of two people have difficulties with fractions.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Overlapping distributions (populations) - assigning an individual to a population?

2008-04-08 Thread Ruben Roa Ureta
> Rolf,
>
>
> On Wed, 2008-04-09 at 10:57 +1200, Rolf Turner wrote:
>> On 9/04/2008, at 10:30 AM, Phil Rhoades wrote:
>>
>> > People,
>> >
>> > Say a particular measure of an attribute for individuals in different
>> > populations gives a set of overlapping normal distributions (one
>> > distribution per population).  If I then measure this attribute in
>> > a new
>> > individual - how do I assess the likelihood of this new individual
>> > belonging to each of the different populations?
>>
>> You have a mixture of distributions.  Let the density be
>>
>>  k
>>  f(x) = SUM lambda_i * f_i(x)
>> i=1
>>
>> where the f_i(x) are the densities for the individual components in
>> the mixture,
>> and the lambda_i are the mixing probabilities.
>>
>> The probability that an individual with observation x is from
>> component i is
>>
>> lambda_i * f_i(x)
>> -
>>f(x)
>
>
> Thanks for the quick response but I think I need to put some numbers on
> this so I can see what you mean.  Say I have two pops with individual
> values:
>
> 1 2 3 4 5
>
> 3 4 5 6 7
>
> and a new individual with value 5 - what is the likelihood of assignment
> to each of the populations?

Phil, for an application and more detailed explanation you can check the
article:
A Test for Long-Term Cyclical Clustering of Stock Market Regimes
John Powell, Rubén Roa, Jing Shi, Viliphonh Xayavong
Australian Journal of Management, vol. 32(2), 2007,
available for free download from the journal website:
http://www.agsm.edu.au/~eajm/current.html
I provide there a quotation to a book by Hamilton on time series, where
this technique is further explained.
By the way, the computation suggested is a conditional probability.
Rubén

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


Re: [R] post hoc statistical power

2008-04-08 Thread John Fox
Dear Yuelin,

Another paper critical of post-hoc power calculations is Hoenig and Heisey,
2001. "The Abuse of Power: The Pervasive Fallacy of Power Calculations for
Data Analysis." The American Statistician, 55, 19-24. Hoenig and Heisey show
that so-called "observed power" is simply a re-expression of the p-value.

I hope this helps,
 John


John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> project.org] On Behalf Of Yuelin Li
> Sent: April-08-08 12:47 PM
> To: r-help@r-project.org
> Subject: [R] post hoc statistical power
> 
> I remember reading about post hoc statistical power on R-help.  But I
> can't seem to find them with RSiteSearch("post hoc statistical power")
> and variations of it.
> 
> I would like to learn more about post hoc statistical power, its
> meaningfulness, advantages and disadvantages.  I thought the issue was
> settled after Tukey's 1993 paper about post hoc statistical power
> being "essentially meaningless once the experiment has been done".
> But they seem to be used, and sometimes encouraged
> (e.g., http://www.informaworld.com/smpp/content~content=a787469931).
> 
> I do not intend to start a debate.  I simply would like to learn
> more.  Can anyone suggest a few articles?  Thanks,
> 
> Yuelin.
> 
> Tukey JW. Tightening the clinical trial. Control Clin Trials.
> 1993;14:266-285.
> 
> 
> 
> =
> 
>  Please note that this e-mail and any files transmitted with it may
> be
>  privileged, confidential, and protected from disclosure under
>  applicable law. If the reader of this message is not the intended
>  recipient, or an employee or agent responsible for delivering this
>  message to the intended recipient, you are hereby notified that
> any
>  reading, dissemination, distribution, copying, or other use of
> this
>  communication or any of its attachments is strictly prohibited.
> If
>  you have received this communication in error, please notify the
>  sender immediately by replying to this message and deleting this
>  message, any attachments, and all copies and backups from your
>  computer.
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Overlapping distributions (populations) - assigning an individual to a population?

2008-04-08 Thread Phil Rhoades
Rolf,


On Wed, 2008-04-09 at 10:57 +1200, Rolf Turner wrote:
> On 9/04/2008, at 10:30 AM, Phil Rhoades wrote:
> 
> > People,
> >
> > Say a particular measure of an attribute for individuals in different
> > populations gives a set of overlapping normal distributions (one
> > distribution per population).  If I then measure this attribute in  
> > a new
> > individual - how do I assess the likelihood of this new individual
> > belonging to each of the different populations?
> 
> You have a mixture of distributions.  Let the density be
> 
>  k
>   f(x) = SUM lambda_i * f_i(x)
> i=1
> 
> where the f_i(x) are the densities for the individual components in  
> the mixture,
> and the lambda_i are the mixing probabilities.
> 
> The probability that an individual with observation x is from  
> component i is
> 
> lambda_i * f_i(x)
> -
>f(x)


Thanks for the quick response but I think I need to put some numbers on
this so I can see what you mean.  Say I have two pops with individual
values:

1 2 3 4 5

3 4 5 6 7

and a new individual with value 5 - what is the likelihood of assignment
to each of the populations?

BTW, I say populations, but to keep it simple I didn't go into more
detail - there is no physical overlap in space or time of the
populations/distributions - so there are no gradients from interbreeding
of sub-populations or anything like that.

Regards,

Phil.
-- 
Philip Rhoades

Pricom Pty Limited  (ACN 003 252 275  ABN 91 003 252 275)
GPO Box 3411
Sydney NSW  2001
Australia
Fax: +61:(0)2-8221-9599
E-mail:  [EMAIL PROTECTED]

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


[R] chi-square test

2008-04-08 Thread Roslina Zakaria
Hi R-users,
I would like to find the goodness of fit using Chi-suare test for my data below:
xobs=observed data, xtwe=predicted data using tweedie, xgam=predicted data 
using gamma
> xobs <- c(223,46,12,5,7,17)
> xtwe <- c(217.33,39,14,18.33,6.67,14.67)
> xgam <- c(224.67,37.33,12.33,15.33,5.33,15)

> chisq.test(xobs, xtwe = xtwe, rescale.p = TRUE)
Error in chisq.test(xobs, xtwe = xtwe, rescale.p = TRUE) : 
  unused argument(s) (xtwe = c(217.33, 39, 14, 18.33, 6.67, 14.67))
chisq.test(x, p = p, rescale.p = TRUE)
I'm not sure what's wrong with it. 
Thank you so much for your help.


  

You rock. That's why Blockbuster's offering you one month of Blockbuster Total 
Access, No Cost.  
http://tc.deals.yahoo.com/tc/blockbuster/text5.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] "preferred" version of Linux for R?

2008-04-08 Thread Simon Blomberg
There are binaries on CRAN for several distros. There is the
R-sig-debian list for debian users. As far as I know, there are no
mailing lists for other distros. This may indicate a preference for
debian among R users. Or it may mean that debian is so difficult to use
with R that it requires a mailing list. :-) As a debian user, I prefer
the first explanation.

Cheers,

Simon.

On Tue, 2008-04-08 at 13:36 -0700, Thomas Pujol wrote:
> Is there a recommended/preferred version of Linux for using with R? Is there 
> one version of Linux that R-users prefer, and/or that works "better" with R?  
> I am working with "large" datasets, and hope to take advantage of as much RAM 
> as reasonable (8-32gb?).
> 
> Thanks in advance!
> 
> 
>
> -
> [[elided Yahoo spam]]
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
-- 
Simon Blomberg, BSc (Hons), PhD, MAppStat. 
Lecturer and Consultant Statistician 
Faculty of Biological and Chemical Sciences 
The University of Queensland 
St. Lucia Queensland 4072 
Australia
Room 320 Goddard Building (8)
T: +61 7 3365 2506
http://www.uq.edu.au/~uqsblomb
email: S.Blomberg1_at_uq.edu.au

Policies:
1.  I will NOT analyse your data for you.
2.  Your deadline is your problem.

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

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

2008-04-08 Thread Achim Zeileis
On Wed, 9 Apr 2008, João Fadista wrote:

> But in that paper they refer to another
> (http://www.bepress.com/cgi/viewcontent.cgi?article=1053&context=ucbbiostat)
> where they say that "permutation distribution produces an asymptotically
> correct null distribution if (i) the sample sizes are equal...".

I haven't read that paper in detail (but so do you, it seems). From
looking at abstract and intro, my understanding is that they also study
the behaviour of tests under weaker assumptions than exchangeability.
Z

> Best regards,
> João
>
> 
>
> De: Achim Zeileis [mailto:[EMAIL PROTECTED]
> Enviada: qua 09-04-2008 0:26
> Para: João Fadista
> Cc: ONKELINX, Thierry; r-help@r-project.org
> Assunto: Re: [R] permutation test assumption?
>
>
>
> On Wed, 9 Apr 2008, João Fadista wrote:
>
> > Dear Thierry,
> >
> > Thanks for the reply. But as you may read in the paper
> > http://bioinformatics.oxfordjournals.org/cgi/content/abstract/22/18/2244
> > when the sample sizes are not the same there may be an increase in the
> > Type I error rate.
>
> No, this is false and not what the reference above says. Please read more
> carefully.
>
> > Comments will be appreciated.
>
> The basic assumption for permutation tests is exchangeability of the
> observations (regardless of sample sizes). The reference above describes a
> situation when this assumption is violated.
> Z
>
> > Best regards,
> > João Fadista
> >
> >
> > 
> >
> > De: ONKELINX, Thierry [mailto:[EMAIL PROTECTED]
> > Enviada: ter 08-04-2008 15:27
> > Para: João Fadista; r-help@r-project.org
> > Assunto: RE: [R] permutation test assumption?
> >
> >
> >
> > Dear João,
> >
> > You can do permutation tests on an unbalanced design.
> >
> > HTH,
> >
> > Thierry
> >
> >
> > 
> > ir. Thierry Onkelinx
> > Instituut voor natuur- en bosonderzoek / Research Institute for Nature and 
> > Forest
> > Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, 
> > methodology and quality assurance
> > Gaverstraat 4
> > 9500 Geraardsbergen
> > Belgium
> > tel. + 32 54/436 185
> > [EMAIL PROTECTED]
> > www.inbo.be
> >
> > To call in the statistician after the experiment is done may be no more 
> > than asking him to perform a post-mortem examination: he may be able to say 
> > what the experiment died of.
> > ~ Sir Ronald Aylmer Fisher
> >
> > The plural of anecdote is not data.
> > ~ Roger Brinner
> >
> > The combination of some data and an aching desire for an answer does not 
> > ensure that a reasonable answer can be extracted from a given body of data.
> > ~ John Tukey
> >
> > -Oorspronkelijk bericht-
> > Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens João Fadista
> > Verzonden: dinsdag 8 april 2008 15:18
> > Aan: r-help@r-project.org
> > Onderwerp: [R] permutation test assumption?
> >
> > Dear all,
> >
> > Can I do a permutation test if the number of individuals in one group is 
> > much bigger than in the other group? I searched the literature but I 
> > didin´t find any assumption that refers to this subject for permutation 
> > tests.
> >
> >
> > Best regards
> >
> > João Fadista
> > Ph.d. student
> >
> >
> >
> >  UNIVERSITY OF AARHUS
> > Faculty of Agricultural Sciences
> > Dept. of Genetics and Biotechnology
> > Blichers Allé 20, P.O. BOX 50
> > DK-8830 Tjele
> >
> > Phone:   +45 8999 1900
> > Direct:  +45 8999 1900
> > E-mail:  [EMAIL PROTECTED] 
> > Web: www.agrsci.org 
> > 
> >
> > DJF now offers new degree programmes 
> >  .
> >
> > News and news media  .
> >
> > This email may contain information that is confidential. Any use or 
> > publication of this email without written permission from Faculty of 
> > Agricultural Sciences is not allowed. If you are not the intended 
> > recipient, please notify Faculty of Agricultural Sciences immediately and 
> > delete this email.
> >
> >
> >
> >
> > [[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] Split

2008-04-08 Thread jim holtman
Assuming that this data is character, then this will work: (it removes
the last period in the string)

> x <- scan('clipboard', what='')
Read 4 items
> x
[1] "1234." "2345." "3435." "4343."
> sub("\\.$", "", x)
[1] "1234" "2345" "3435" "4343"
>


On Tue, Apr 8, 2008 at 11:30 AM, Kris Ghosh <[EMAIL PROTECTED]> wrote:
> I have data in the form of a column such as
> 1234.
> 2345.
> 3435.
> 4343.
> I want to have the data in this form ..i.e to remove the "dot" at the
> end of each number above.
> 1234
> 2345
> 3435
> 4343
>
> I am trying to use split but it is not working. Any suggestions?
>
>[[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.
>



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

What is the problem you are trying to solve?

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


Re: [R] Combining many csv files into one and adding a column with an id of each csv file read

2008-04-08 Thread jim holtman
I blew it.  Forgot to use the parameter.  Here is the revised copy:

filenames <- Sys.glob("*.csv")  # however you get the list of file
allData <- lapply(filenames, function(.file){

   dat<-read.csv(.file, header=F)
   dat<-dat[c(-1:-3),c(-1,-4,-5,-6,-7,-9,-10,-11,-12)]
   names(dat)<-c('time','T1','T2')
   dat <- dat[,1:3]

   dat$id<-as.character(.file)

   dat# return the dataframe
})
# combine into a single dataframe
myDF <- do.call(rbind, allData)

On Tue, Apr 8, 2008 at 7:12 PM, jim holtman <[EMAIL PROTECTED]> wrote:
> Here is one way of doing it.  Read the data into a list and then use
> 'do.call(rbind...':
>
> filenames <- Sys.glob("*.csv")  # however you get the list of file
> allData <- lapply(filenames, function(.file){
>dat<-read.csv(filename, header=F)
>dat<-dat[c(-1:-3),c(-1,-4,-5,-6,-7,-9,-10,-11,-12)]
>names(dat)<-c('time','T1','T2')
>dat <- dat[,1:3]
>
>dat$id<-as.character(filename)
>dat# return the dataframe
> })
> # combine into a single dataframe
> myDF <- do.call(rbind, allData)
>
>
> On Tue, Apr 8, 2008 at 3:11 PM, Judith Flores <[EMAIL PROTECTED]> wrote:
> > Dear R experts,
> >
> >   I have been looking into the help-pages and old
> > questions from the R-Help site, but the options
> > offered there don't seem to work in my case.
> >
> >  First of all, I am working on Windows XP, using R
> > version 2.6.2.
> >
> >  I am attaching two csv files as an example of how
> > the data I am traying to put together is delivered to
> > us. On the first row of every csv file is the name of
> > the file, along with the pathfile. This is what I have
> > been doing with every csv files (per seprate), which
> > of course is not the most efficient way to do it;
> > basically, it reads the csv file, then deletes the
> > first 3 rows and some columns that we don't need and
> > finally I add another column that identifies all the
> > rows of the csv file as belonging to one subject only,
> > I have to do this for further manipulations with all
> > the data:
> >
> > filename<-'1_504_d0.csv'
> >
> > dat<-read.csv(filename, header=F)
> > dat<-dat[c(-1:-3),c(-1,-4,-5,-6,-7,-9,-10,-11,-12)]
> > names(dat)<-c('time','T1','T2')
> > dat<-dat[,1:3]
> >
> > dat$id<-as.character(filename)
> >
> >  Since I have multiple csv files to read and I need
> > to have them consolidated in one data frame, how can I
> > apply the above manipulations to all the csv files and
> > at the same time put them in one files?
> >
> > At the end, I need a big data frame that has 4
> > columns"
> >
> > 'Time', 'T1', T2', 'id'
> >
> > I hope I have provided enough information.
> >
> > Thank you in advance for your help,
> >
> > Judith
> >
> >
> >
> >  
> > 
> > [[elided Yahoo spam]]
> >
> > __
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
> >
>
>
>
> --
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
>
> What is the problem you are trying to solve?
>



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

What is the problem you are trying to solve?

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


Re: [R] Combining many csv files into one and adding a column with an id of each csv file read

2008-04-08 Thread jim holtman
Here is one way of doing it.  Read the data into a list and then use
'do.call(rbind...':

filenames <- Sys.glob("*.csv")  # however you get the list of file
allData <- lapply(filenames, function(.file){
dat<-read.csv(filename, header=F)
dat<-dat[c(-1:-3),c(-1,-4,-5,-6,-7,-9,-10,-11,-12)]
names(dat)<-c('time','T1','T2')
dat <- dat[,1:3]

dat$id<-as.character(filename)
dat# return the dataframe
})
# combine into a single dataframe
myDF <- do.call(rbind, allData)

On Tue, Apr 8, 2008 at 3:11 PM, Judith Flores <[EMAIL PROTECTED]> wrote:
> Dear R experts,
>
>   I have been looking into the help-pages and old
> questions from the R-Help site, but the options
> offered there don't seem to work in my case.
>
>  First of all, I am working on Windows XP, using R
> version 2.6.2.
>
>  I am attaching two csv files as an example of how
> the data I am traying to put together is delivered to
> us. On the first row of every csv file is the name of
> the file, along with the pathfile. This is what I have
> been doing with every csv files (per seprate), which
> of course is not the most efficient way to do it;
> basically, it reads the csv file, then deletes the
> first 3 rows and some columns that we don't need and
> finally I add another column that identifies all the
> rows of the csv file as belonging to one subject only,
> I have to do this for further manipulations with all
> the data:
>
> filename<-'1_504_d0.csv'
>
> dat<-read.csv(filename, header=F)
> dat<-dat[c(-1:-3),c(-1,-4,-5,-6,-7,-9,-10,-11,-12)]
> names(dat)<-c('time','T1','T2')
> dat<-dat[,1:3]
>
> dat$id<-as.character(filename)
>
>  Since I have multiple csv files to read and I need
> to have them consolidated in one data frame, how can I
> apply the above manipulations to all the csv files and
> at the same time put them in one files?
>
> At the end, I need a big data frame that has 4
> columns"
>
> 'Time', 'T1', T2', 'id'
>
> I hope I have provided enough information.
>
> Thank you in advance for your help,
>
> Judith
>
>
>
>  
> 
> [[elided Yahoo spam]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>



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

What is the problem you are trying to solve?

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


Re: [R] Separate y-limits in xYplot panels II

2008-04-08 Thread Christoph Meyer
Hi John,

I think even with scales=list(y=list(relation="free") you have to
specify the y-limits for each panel, i.e. add something like
ylim=list(c(0,1200),c(0,1)) to your code.

Best regards,

Christoph


Wednesday, April 9, 2008, 12:37:43 AM, you wrote:

> Hello,

> I have been trying to use xYplot in Hmisc to graph plots, allowing each
> panel to have a y-axis dependent on the data in the panel.

> Following the advice from the R-Help list, message: [R] separate
> y-limits in xYplot panels on Wed, 30 May 2007 08:12:06 -0700 (PDT), I
> used scales=list(y=list(relation="free").

> However, it does not seem to work.  Please see below code, where the
> scale of the y-axis of the 2 panels stays the same despite the scales
> function.

> Does anyone know how to get around this?

> Thanks,
> John


> x1=seq(1,30,0.5)
> y1=x1^2
> y2=10*(x1^2)
> ycomb=c(y1,y2)
> y.up=ycomb+0.1*ycomb
> y.low=ycomb-0.1*ycomb
> grp=rep(c(1,2),each=length(x1))
> dat=as.data.frame(cbind(ycomb, y.up, y.low, grp, rep(x1,2)))
> colnames(dat)=c("ycomb","y.up","y.low","grp","x1")

> with(dat, xYplot(Cbind(ycomb, y.up, y.low)~x1|factor(grp),
> data=dat,type="l", method="bands",
> scales=list(y=list(relation="free"),
> x=list(alternating=c(1,1,1)

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



***
Dr. Christoph Meyer
Institute of Experimental Ecology
University of Ulm
Albert-Einstein-Allee 11
D-89069 Ulm
Germany
Phone:  ++49-(0)731-502-2675
Fax:++49-(0)731-502-2683
Mobile: ++49-(0)1577-156-7049
E-mail: [EMAIL PROTECTED]
http://www.uni-ulm.de/nawi/nawi-bio3.html
***

==End of original message text===

***
Dr. Christoph Meyer
Institute of Experimental Ecology
University of Ulm
Albert-Einstein-Allee 11
D-89069 Ulm
Germany
Phone:  ++49-(0)731-502-2675
Fax:++49-(0)731-502-2683
Mobile: ++49-(0)1577-156-7049
E-mail: [EMAIL PROTECTED]
http://www.uni-ulm.de/nawi/nawi-bio3.html

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] "preferred" version of Linux for R?

2008-04-08 Thread Mitchell Maltenfort
If your criterion is use of resources, then you might be more
interested in which flavor of Linux makes it easy to turn the X-window
server off.  No windows or mouse, more RAM and CPU cycles for R.  As I
recall, the only Linux where that might be a problem is Ubuntu,
because there's no convenient way to kill the X-server.

Also look at Puppy Linux --http://puppylinux.org/wikka/Puppy300 --
which has a rep for very small use of resources.


On Tue, Apr 8, 2008 at 4:36 PM, Thomas Pujol <[EMAIL PROTECTED]> wrote:
> Is there a recommended/preferred version of Linux for using with R? Is there 
> one version of Linux that R-users prefer, and/or that works "better" with R?  
> I am working with "large" datasets, and hope to take advantage of as much RAM 
> as reasonable (8-32gb?).
>
>  Thanks in advance!
>
>
>
>  -
>  [[elided Yahoo spam]]
> [[alternative HTML version deleted]]
>
>  __
>  R-help@r-project.org mailing list
>  https://stat.ethz.ch/mailman/listinfo/r-help
>  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>  and provide commented, minimal, self-contained, reproducible code.
>



-- 
I can answer any question.
"I don't know" is an answer.
"I don't know yet" is a better answer.

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

2008-04-08 Thread Luke Tierney

On Wed, 9 Apr 2008, Christophe Genolini wrote:


Hi Luke

Thanks for all these explanation, things are clearer.

Let me go back on my initial problem, that was, as a programmer, I would like 
to have a tool to detect typo by detecting globals variables:

I get that findGlobals is not design for that.

I did not realy understand the use of checkUsage (sorry for that, I am not a 
high level programmer).

But I find an example on which checkUsage does not detect the typo either:

mObjBis <- 3
f <- function(myOb){
myObBis <- myOb^2
plot(myObBis)
return(mObjBis)
}
checkUsage(f,all=TRUE)


I don't see how a general tool can detect a problem here.  If you know
the only global variables you will ever use are functions then you can
write your own tool to reflect that style, but for common styles there
is no clear reason I can see to detect a problem here.  A C compiler
could not detect a problem here unless the function was declared to
have a different return type than the global variable.

So, my question is a more general question : is there a function that can 
detect global variable with exclusion of the function and the reserved word?


For example:
g <- function(x)return(x+pi)
we don't want pi to be considere as a global variable since it is a 
constant...


But in R pi is a global variable.  checkUsage doesn't warn about its
use because it has a binding.


Is there a function that can deal with that ?


If you know what you want you can write one, something like

myGlobals <- function(f, exclude = c("pi", "T", "F")) {
isGlobFun <- function(s)
! (exists(s, .GlobalEnv) && is.function(get(s,.GlobalEnv)))
g <- findGlobals(f)
setdiff(g[sapply(g, isGlobFun)], exclude)
}

I would suggest you use this sort of thing in conjunction with
checkUsage since that checks for other kinds of errors; for example
look at what it does with the variant

f <- function(myOb){
myObBis <- myOb^2
plot(mObjBis)
return(mObjBis)
}

Best,

luke



Christophe


On Tue, 8 Apr 2008, Christophe Genolini wrote:




f <- function(x){apply(x,2,mean)}
findGlobals(f)

mean is a global variable, so findGlobals gets it right.

That sound strange to me: a "variable" is something that vary... mean
does not vary. maen will ge an argument that is a line of x and will
make some calculous on it, that is the comportement of a function.
Of course, mean is an argument of an other function, but I do not think
this is a reason good enouth to say that mean is a variable.


You are missing some points about R and findGlobals.

In R, functions are first class values: they can be assigned to
variables, passed as arguments, and returned as results, just like
vectors. In contrast to many other languages there is not special
mechanism for defining functions and associating them with a name --
the way you define a function is

foo <- function(...) ...

which creates a function value and assigns it to a variable.

findGlobals just looks at the function body and arguments and
determines which of the variables used would have their definitions
looked up in the global environment if this code is run. It does not
try to detect which of these have values or not, never mind what the
types of those falues are.

The result returned by findGlobals with merge=FALSE separates into
variables that are explicitly used as funcitons, i.e foo in foo(x) and
ones that are not. One could argue that findGlobals should know
enough about apply() to realize that the FUN argument is implicitly
used as a function; if this change were made then

apply(x, 2, pi)

pi would be listed as a function because it is _used_ that way.


Furthemore, I use findGlobals to detect some typo. In

f <- function(myObject){return(mObject^2)}

findGlobals will detect that mObject is a global so I know there is a
typo somewhere.
Considering mean as a globals do not let us use findGlobals this way.


You need to do some extra work to get this -- checking which globals
have values, and maybe whether those that are used as functions have
values that are functions. checkUsage does this, among other things.
For this example checkUsage produces

> checkUsage(f)
: no visible binding for global variable ???mObject???

luke


Christophe

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

and provide commented, minimal, self-contained, reproducible code.








--
Luke Tierney
Chair, Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa  Phone: 319-335-3386
Department of Statistics andFax:   319-335-3017
   Actuarial Science
241 Schaeffer Hall  email:  [EMAIL PROTECTED]
Iowa City, IA 52242 WWW:  http://www.stat.uiowa.edu__
R-help@r-project.org mailing list
https://st

Re: [R] Overlapping distributions (populations) - assigning an individual to a population?

2008-04-08 Thread Rolf Turner

On 9/04/2008, at 10:30 AM, Phil Rhoades wrote:

> People,
>
> Say a particular measure of an attribute for individuals in different
> populations gives a set of overlapping normal distributions (one
> distribution per population).  If I then measure this attribute in  
> a new
> individual - how do I assess the likelihood of this new individual
> belonging to each of the different populations?

You have a mixture of distributions.  Let the density be

 k
f(x) = SUM lambda_i * f_i(x)
i=1

where the f_i(x) are the densities for the individual components in  
the mixture,
and the lambda_i are the mixing probabilities.

The probability that an individual with observation x is from  
component i is

lambda_i * f_i(x)
-
   f(x)


cheers,

Rolf Turner

##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

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

2008-04-08 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of João Fadista
> Sent: Tuesday, April 08, 2008 3:10 PM
> To: ONKELINX, Thierry; r-help@r-project.org
> Subject: Re: [R] permutation test assumption?
> 
> Dear Thierry,
>  
> Thanks for the reply. But as you may read in the paper 
> http://bioinformatics.oxfordjournals.org/cgi/content/abstract/
> 22/18/2244 when the sample sizes are not the same there may 
> be an increase in the Type I error rate.
>  
> Comments will be appreciated.
>  
> Best regards,
> João Fadista
>  
> 
> 
> 
> De: ONKELINX, Thierry [mailto:[EMAIL PROTECTED]
> Enviada: ter 08-04-2008 15:27
> Para: João Fadista; r-help@r-project.org
> Assunto: RE: [R] permutation test assumption?
> 
> 
> 
> Dear João,
> 
> You can do permutation tests on an unbalanced design.
> 
> HTH,
> 
> Thierry
> 

João,

I haven't read the paper, but the abstract didn't mention different sample 
sizes as a problem.  Do the authors comment on sample size in the paper itself? 
 If so, what did they say?  If not, then why do you think sample size is a 
problem?

Dan 

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

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


Re: [R] permutation test assumption?

2008-04-08 Thread João Fadista
But in that paper they refer to another 
(http://www.bepress.com/cgi/viewcontent.cgi?article=1053&context=ucbbiostat) 
where they say that "permutation distribution produces an asymptotically 
correct null distribution if (i) the sample sizes are equal...".
 
Best regards,
João



De: Achim Zeileis [mailto:[EMAIL PROTECTED]
Enviada: qua 09-04-2008 0:26
Para: João Fadista
Cc: ONKELINX, Thierry; r-help@r-project.org
Assunto: Re: [R] permutation test assumption?



On Wed, 9 Apr 2008, João Fadista wrote:

> Dear Thierry,
>
> Thanks for the reply. But as you may read in the paper
> http://bioinformatics.oxfordjournals.org/cgi/content/abstract/22/18/2244
> when the sample sizes are not the same there may be an increase in the
> Type I error rate.

No, this is false and not what the reference above says. Please read more
carefully.

> Comments will be appreciated.

The basic assumption for permutation tests is exchangeability of the
observations (regardless of sample sizes). The reference above describes a
situation when this assumption is violated.
Z

> Best regards,
> João Fadista
>
>
> 
>
> De: ONKELINX, Thierry [mailto:[EMAIL PROTECTED]
> Enviada: ter 08-04-2008 15:27
> Para: João Fadista; r-help@r-project.org
> Assunto: RE: [R] permutation test assumption?
>
>
>
> Dear João,
>
> You can do permutation tests on an unbalanced design.
>
> HTH,
>
> Thierry
>
>
> 
> ir. Thierry Onkelinx
> Instituut voor natuur- en bosonderzoek / Research Institute for Nature and 
> Forest
> Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, 
> methodology and quality assurance
> Gaverstraat 4
> 9500 Geraardsbergen
> Belgium
> tel. + 32 54/436 185
> [EMAIL PROTECTED]
> www.inbo.be
>
> To call in the statistician after the experiment is done may be no more than 
> asking him to perform a post-mortem examination: he may be able to say what 
> the experiment died of.
> ~ Sir Ronald Aylmer Fisher
>
> The plural of anecdote is not data.
> ~ Roger Brinner
>
> The combination of some data and an aching desire for an answer does not 
> ensure that a reasonable answer can be extracted from a given body of data.
> ~ John Tukey
>
> -Oorspronkelijk bericht-
> Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens João Fadista
> Verzonden: dinsdag 8 april 2008 15:18
> Aan: r-help@r-project.org
> Onderwerp: [R] permutation test assumption?
>
> Dear all,
>
> Can I do a permutation test if the number of individuals in one group is much 
> bigger than in the other group? I searched the literature but I didin´t find 
> any assumption that refers to this subject for permutation tests.
>
>
> Best regards
>
> João Fadista
> Ph.d. student
>
>
>
>  UNIVERSITY OF AARHUS
> Faculty of Agricultural Sciences
> Dept. of Genetics and Biotechnology
> Blichers Allé 20, P.O. BOX 50
> DK-8830 Tjele
>
> Phone:   +45 8999 1900
> Direct:  +45 8999 1900
> E-mail:  [EMAIL PROTECTED] 
> Web: www.agrsci.org 
> 
>
> DJF now offers new degree programmes 
>  .
>
> News and news media  .
>
> This email may contain information that is confidential. Any use or 
> publication of this email without written permission from Faculty of 
> Agricultural Sciences is not allowed. If you are not the intended recipient, 
> please notify Faculty of Agricultural Sciences immediately and delete this 
> email.
>
>
>
>
> [[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] Separate y-limits in xYplot panels II

2008-04-08 Thread John Poulsen
Hello,

I have been trying to use xYplot in Hmisc to graph plots, allowing each
panel to have a y-axis dependent on the data in the panel.

Following the advice from the R-Help list, message: [R] separate
y-limits in xYplot panels on Wed, 30 May 2007 08:12:06 -0700 (PDT), I
used scales=list(y=list(relation="free").

However, it does not seem to work.  Please see below code, where the
scale of the y-axis of the 2 panels stays the same despite the scales
function.

Does anyone know how to get around this?

Thanks,
John


x1=seq(1,30,0.5)
y1=x1^2
y2=10*(x1^2)
ycomb=c(y1,y2)
y.up=ycomb+0.1*ycomb
y.low=ycomb-0.1*ycomb
grp=rep(c(1,2),each=length(x1))
dat=as.data.frame(cbind(ycomb, y.up, y.low, grp, rep(x1,2)))
colnames(dat)=c("ycomb","y.up","y.low","grp","x1")

with(dat, xYplot(Cbind(ycomb, y.up, y.low)~x1|factor(grp),
data=dat,type="l", method="bands", scales=list(y=list(relation="free"),
x=list(alternating=c(1,1,1)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Overlapping distributions (populations) - assigning an individual to a population?

2008-04-08 Thread Phil Rhoades
People,

Say a particular measure of an attribute for individuals in different
populations gives a set of overlapping normal distributions (one
distribution per population).  If I then measure this attribute in a new
individual - how do I assess the likelihood of this new individual
belonging to each of the different populations?

Thanks,

Phil.
-- 
Philip Rhoades

Pricom Pty Limited  (ACN 003 252 275  ABN 91 003 252 275)
GPO Box 3411
Sydney NSW  2001
Australia
Fax: +61:(0)2-8221-9599
E-mail:  [EMAIL PROTECTED]

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


Re: [R] permutation test assumption?

2008-04-08 Thread Achim Zeileis
On Wed, 9 Apr 2008, João Fadista wrote:

> Dear Thierry,
>
> Thanks for the reply. But as you may read in the paper
> http://bioinformatics.oxfordjournals.org/cgi/content/abstract/22/18/2244
> when the sample sizes are not the same there may be an increase in the
> Type I error rate.

No, this is false and not what the reference above says. Please read more
carefully.

> Comments will be appreciated.

The basic assumption for permutation tests is exchangeability of the
observations (regardless of sample sizes). The reference above describes a
situation when this assumption is violated.
Z

> Best regards,
> João Fadista
>
>
> 
>
> De: ONKELINX, Thierry [mailto:[EMAIL PROTECTED]
> Enviada: ter 08-04-2008 15:27
> Para: João Fadista; r-help@r-project.org
> Assunto: RE: [R] permutation test assumption?
>
>
>
> Dear João,
>
> You can do permutation tests on an unbalanced design.
>
> HTH,
>
> Thierry
>
>
> 
> ir. Thierry Onkelinx
> Instituut voor natuur- en bosonderzoek / Research Institute for Nature and 
> Forest
> Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, 
> methodology and quality assurance
> Gaverstraat 4
> 9500 Geraardsbergen
> Belgium
> tel. + 32 54/436 185
> [EMAIL PROTECTED]
> www.inbo.be
>
> To call in the statistician after the experiment is done may be no more than 
> asking him to perform a post-mortem examination: he may be able to say what 
> the experiment died of.
> ~ Sir Ronald Aylmer Fisher
>
> The plural of anecdote is not data.
> ~ Roger Brinner
>
> The combination of some data and an aching desire for an answer does not 
> ensure that a reasonable answer can be extracted from a given body of data.
> ~ John Tukey
>
> -Oorspronkelijk bericht-
> Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens João Fadista
> Verzonden: dinsdag 8 april 2008 15:18
> Aan: r-help@r-project.org
> Onderwerp: [R] permutation test assumption?
>
> Dear all,
>
> Can I do a permutation test if the number of individuals in one group is much 
> bigger than in the other group? I searched the literature but I didin´t find 
> any assumption that refers to this subject for permutation tests.
>
>
> Best regards
>
> João Fadista
> Ph.d. student
>
>
>
>  UNIVERSITY OF AARHUS
> Faculty of Agricultural Sciences
> Dept. of Genetics and Biotechnology
> Blichers Allé 20, P.O. BOX 50
> DK-8830 Tjele
>
> Phone:   +45 8999 1900
> Direct:  +45 8999 1900
> E-mail:  [EMAIL PROTECTED] 
> Web: www.agrsci.org 
> 
>
> DJF now offers new degree programmes 
>  .
>
> News and news media  .
>
> This email may contain information that is confidential. Any use or 
> publication of this email without written permission from Faculty of 
> Agricultural Sciences is not allowed. If you are not the intended recipient, 
> please notify Faculty of Agricultural Sciences immediately and delete this 
> email.
>
>
>
>
> [[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] permutation test assumption?

2008-04-08 Thread João Fadista
Dear Thierry,
 
Thanks for the reply. But as you may read in the paper 
http://bioinformatics.oxfordjournals.org/cgi/content/abstract/22/18/2244 when 
the sample sizes are not the same there may be an increase in the Type I error 
rate.
 
Comments will be appreciated.
 
Best regards,
João Fadista
 



De: ONKELINX, Thierry [mailto:[EMAIL PROTECTED]
Enviada: ter 08-04-2008 15:27
Para: João Fadista; r-help@r-project.org
Assunto: RE: [R] permutation test assumption?



Dear João,

You can do permutation tests on an unbalanced design.

HTH,

Thierry



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

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

The plural of anecdote is not data.
~ Roger Brinner

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

-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens João Fadista
Verzonden: dinsdag 8 april 2008 15:18
Aan: r-help@r-project.org
Onderwerp: [R] permutation test assumption?

Dear all,

Can I do a permutation test if the number of individuals in one group is much 
bigger than in the other group? I searched the literature but I didin´t find 
any assumption that refers to this subject for permutation tests.


Best regards

João Fadista
Ph.d. student


   
 UNIVERSITY OF AARHUS  
Faculty of Agricultural Sciences   
Dept. of Genetics and Biotechnology
Blichers Allé 20, P.O. BOX 50  
DK-8830 Tjele  
   
Phone:   +45 8999 1900 
Direct:  +45 8999 1900 
E-mail:  [EMAIL PROTECTED] 
Web: www.agrsci.org    


DJF now offers new degree programmes 
 .

News and news media  .

This email may contain information that is confidential. Any use or publication 
of this email without written permission from Faculty of Agricultural Sciences 
is not allowed. If you are not the intended recipient, please notify Faculty of 
Agricultural Sciences immediately and delete this email.




[[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] findGlobals on apply

2008-04-08 Thread Christophe Genolini
Hi Luke

Thanks for all these explanation, things are clearer.

Let me go back on my initial problem, that was, as a programmer, I would 
like to have a tool to detect typo by detecting globals variables:
I get that findGlobals is not design for that.

I did not realy understand the use of checkUsage (sorry for that, I am 
not a high level programmer).
But I find an example on which checkUsage does not detect the typo either:

mObjBis <- 3
f <- function(myOb){
myObBis <- myOb^2
plot(myObBis)
return(mObjBis)
}
checkUsage(f,all=TRUE)

So, my question is a more general question : is there a function that 
can detect global variable with exclusion of the function and the 
reserved word?

For example:
g <- function(x)return(x+pi)
we don't want pi to be considere as a global variable since it is a 
constant...

Is there a function that can deal with that ?

Christophe

> On Tue, 8 Apr 2008, Christophe Genolini wrote:
>
>>
 f <- function(x){apply(x,2,mean)}
 findGlobals(f)
>>> mean is a global variable, so findGlobals gets it right.
>> That sound strange to me: a "variable" is something that vary... mean
>> does not vary. maen will ge an argument that is a line of x and will
>> make some calculous on it, that is the comportement of a function.
>> Of course, mean is an argument of an other function, but I do not think
>> this is a reason good enouth to say that mean is a variable.
>
> You are missing some points about R and findGlobals.
>
> In R, functions are first class values: they can be assigned to
> variables, passed as arguments, and returned as results, just like
> vectors. In contrast to many other languages there is not special
> mechanism for defining functions and associating them with a name --
> the way you define a function is
>
> foo <- function(...) ...
>
> which creates a function value and assigns it to a variable.
>
> findGlobals just looks at the function body and arguments and
> determines which of the variables used would have their definitions
> looked up in the global environment if this code is run. It does not
> try to detect which of these have values or not, never mind what the
> types of those falues are.
>
> The result returned by findGlobals with merge=FALSE separates into
> variables that are explicitly used as funcitons, i.e foo in foo(x) and
> ones that are not. One could argue that findGlobals should know
> enough about apply() to realize that the FUN argument is implicitly
> used as a function; if this change were made then
>
> apply(x, 2, pi)
>
> pi would be listed as a function because it is _used_ that way.
>
>> Furthemore, I use findGlobals to detect some typo. In
>>
>> f <- function(myObject){return(mObject^2)}
>>
>> findGlobals will detect that mObject is a global so I know there is a
>> typo somewhere.
>> Considering mean as a globals do not let us use findGlobals this way.
>
> You need to do some extra work to get this -- checking which globals
> have values, and maybe whether those that are used as functions have
> values that are functions. checkUsage does this, among other things.
> For this example checkUsage produces
>
> > checkUsage(f)
> : no visible binding for global variable ‘mObject’
>
> luke
>
>> Christophe
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide 
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>

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


Re: [R] Problem with NA data when computing standard error

2008-04-08 Thread Paul Johnson
On Tue, Apr 8, 2008 at 12:44 PM, LeCzar <[EMAIL PROTECTED]> wrote:
>
>  Hey,
>
>  I want to compute means and standard errors as two tables like this:
>
>   se<-function(x)sqrt(var(x)/length(x))
>
>

The missings are not your main problem.

The command var computes the variance-covariance matrix.  Some
covariance values can be negative.  Trying to take square roots is a
mistake.

For example, run

> example(var)

to get some matrices to work with.

> C1[3,4] <- NA
> C1[3,5] <- NA

Observe you can calculate

> var(C1, na.rm=T)

but you cannot take sqrt of that because it would try to apply sqrt to
negative values.

To get the standard errors, it is necessary to reconsider the problem,
do something like

> diag(var(C1, na.rm=T))

That will give the diagonals, which are positive, so

> sqrt(diag(var(C1, na.rm=T)))

Works as well.

But you have the separate problem of dividing each one by the square
root of the length, and since there are missings that is not the same
for every column.  Maybe somebody knows a smarter way, but this
appears to give the correct answer:

validX <- colSums( ! is.na(C1))

This gives the roots:

sqrt(validX)

Put that together, it seems to me you could try

se <- function(x) {

myDiag <- sqrt(diag(var(x, na.rm=T)))

 validX <- colSums(! is.na(x))

 myDiag/sqrt(validX)
}

That works for me:

> se(C1)
   Fertility  Agriculture  ExaminationEducation
   50.740226   110.80861439.39061139.303898
Catholic Infant.Mortality
  328.272207 4.513863


-- 
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] save multiple pages lattice-plot

2008-04-08 Thread Deepayan Sarkar
On 4/8/08, Katell HAMON <[EMAIL PROTECTED]> wrote:
> Dear R-helper,
>
>  I am trying to save some plots I made with lattice, but I have several
>  pages printed for each call.
>
>  My layout is something like c(col=2,row=4,pages=12) and I didn't find a
>  way to save those plots, because I am usually using savePlot() which
>  from what I saw can only save one page/device a the time.
>
>  Is there an easy way to save all the plots?

Use a suitable graphics device: e.g., see ?png and ?pdf

-Deepayan

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


[R] "preferred" version of Linux for R?

2008-04-08 Thread Thomas Pujol
Is there a recommended/preferred version of Linux for using with R? Is there 
one version of Linux that R-users prefer, and/or that works "better" with R?  I 
am working with "large" datasets, and hope to take advantage of as much RAM as 
reasonable (8-32gb?).

Thanks in advance!


   
-
[[elided Yahoo spam]]
[[alternative HTML version deleted]]

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


Re: [R] reading in a Fortran binary array

2008-04-08 Thread Prof Brian Ripley
See ?readBin

The format of a Fortran unformatted file is compiler- and OS-dependent, 
but if you know what it is, readBin() can read it.

On Tue, 8 Apr 2008, Alexy Khrabrov wrote:

> Greetings -- I'd like to avoid converting a Fortran array of floats
> into ASCII and back reading it in R.  Furthermore it's much faster to
> dump large arrays in binary, as they take up much less space with full
> precision -- many decimal points take up many bytes in ASCII versus
> four or eight per float in raw. Is there a way to read such a Fortran
> unformatted file back into R?
>
> Cheers,
> Alexy
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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

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


Re: [R] Problem with NA data when computing standard error

2008-04-08 Thread Jorge Velez
Hi there,

Perhaps

se<-function(x)sqrt(var(x,na.rm=T)/sum(!is.na(x)))
object1<-as.data.frame.table(tapply(Data[Year=="1999"],list(Group[Year=="1999"],Season[Year=="1999"]),mean))
object2<-as.data.frame.table(tapply(Data[Year=="1999"],list(Group[Year=="1999"],Season[Year=="1999"]),se))


Hope this helps,

Jorge


On Tue, Apr 8, 2008 at 1:44 PM, LeCzar <[EMAIL PROTECTED]> wrote:

>
> Hey,
>
> I want to compute means and standard errors as two tables like this:
>
>  se<-function(x)sqrt(var(x)/length(x))
>
>
> object1<-as.data.frame.table(tapply(Data[Year=="1999"],na.rm=T,list(Group[Year=="1999"],Season[Year=="1999"]),mean))
>
>
> object2<-as.data.frame.table(tapply(Data[Year=="1999"],na.rm=T,list(Group[Year=="1999"],Season[Year=="1999"]),se))
>
> Part of the data is labeled as NA, therfore the na.rm=T. I succeed in
> creating the table for the means, but not for the standard errors. The
> message is "Error in FUN(X[[1L]], ...) : unused argument(s) (na.rm =
> TRUE)".
> Does anyone have an idea how to get the standard error computed?
>
> Thx!
>
> --
> View this message in context:
> http://www.nabble.com/Problem-with-NA-data-when-computing-standard-error-tp16569057p16569057.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.
>

[[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 check if a variable is preferentially present in a sample

2008-04-08 Thread Jorge Velez
Hi Tania,

I think it could be. I tried a solution based on your data set using a
chi-squared approach. Here is what I got:

# 
# Data set
set.seed(123)
d <- data.frame(cbind(val=rnorm(1:10)^2,
group=sample(LETTERS[1:5],100,repl=TRUE)))
d[,"val"]<-as.numeric(as.character(d$val))

# Ranking "d" in decreasing order based on "val" and counting the number of
observation in each group
TABLE=table(d[order(val,decreasing=TRUE),][1:10,"group"])
TABLE

A B C D E
3 2 3 1 1

# Chi-squared
cht=chisq.test(TABLE)
cht

Chi-squared test for given probabilities

data:  TABLE
X-squared = 2, df = 4, p-value = 0.7358

cht$p.value
[1] 0.7357589


Hope this helps,


Jorge


On Tue, Apr 8, 2008 at 11:24 AM, Tania Oh <[EMAIL PROTECTED]> wrote:

> Dear All,
>
> I do apologise if this question is out of place for this list but I've
> tried searching mailing lists and read "Introductory Statistics with
> R" by Peter Dalgaard, but couldn't find any hints on solving my
> question below:
>
> I have a data frame (d) of values which I will rank in decreasing
> order of "val". Each value belongs to a group, either 'A', 'B', 'C',
> 'D', or 'E'.  I then take the first 10 entries in data frame 'd'  and
> count the number of occurrences for each of the groups.  I want to
> test if certain groups occur more frequently than by chance in my
> first 10 entries. Would a chi-square test or a hypergeometric test be
> more suitable? If neither, what would be an alternative solution in
> R?  Below is my data:
>
>
> ## data
> L5 <- LETTERS[1:5]
> d <- data.frame(cbind(val= rnorm(1:10)^2, group=sample(L5,100,
> repl=TRUE)))
>
> str(d)
> ##'data.frame': 100 obs. of  2 variables:
> ##$ val  : Factor w/ 10 levels "0.000169268449333046",..: 10 3 5 6 1 2
> 7 8 4 9 ...
> ##$ group: Factor w/ 5 levels "A","B","C","D",..: 4 4 4 5 3 1 5 2 1
> 2 ...
>
>
> Many thanks in advance and apologies again,
> tania
>
> D. phil student
> Department of Physiology, Anatomy and Genetics
> University of Oxford
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] fit points to plane

2008-04-08 Thread Luca Penasa

Bert Gunter wrote:

But probably not a good idea, as there are likely to be some scientfically
"interesting" local inhomogeneities that an appropriate nonparametric
smoother (e.g. splines,...) could reveal.
  


ok... im working on laser scanner cloud of points... the model im 
working with is something like a plane...
i need to project the points over a straight plane so i think it would 
be a good idea to use the best-fitting plane for this.
maybe is there a function to decimate the points?? so i can use this 
function:

http://www.csse.uwa.edu.au/~pk/research/matlabfns/Robust/fitplane.m
starting it on 25000 points give an "out of memory"...
sorry for my english :-)
thanks

-- Bert Gunter

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Rolf Turner
Sent: Tuesday, April 08, 2008 1:16 PM
To: Luca Penasa
Cc: r-help@r-project.org
Subject: Re: [R] fit points to plane


On 9/04/2008, at 8:28 AM, Luca Penasa wrote:

  
Is there a function for obtaining the best-fitting plane from a  
large number of points (something like 25.000 points)?




?lm


##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

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


  





--
Email.it, the professional e-mail, gratis per te: http://www.email.it/f

Sponsor:
Scopri le tue passioni con Leonardo.it!
* 
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=7613&d=8-4
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] fit points to plane

2008-04-08 Thread Luca Penasa

Rolf Turner wrote:


On 9/04/2008, at 8:28 AM, Luca Penasa wrote:

Is there a function for obtaining the best-fitting plane from a large 
number of points (something like 25.000 points)?



?lm


what does it mean?



##
Attention:This e-mail message is privileged and confidential. If you 
are not theintended recipient please delete the message and notify the 
sender.Any views or opinions presented are solely those of the author.


This e-mail has been scanned and cleared by 
MailMarshalwww.marshalsoftware.com

##






--
Email.it, the professional e-mail, gratis per te: http://www.email.it/f

Sponsor:
Scopri le tue passioni con Leonardo.it!
* 
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=7614&d=8-4
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] diagonally fill a rectangle with color gradient

2008-04-08 Thread Paul Murrell
Hi


tom soyer wrote:
> Hi,
> 
> Is it possible to diagonally fill a rectangle with a color gradient? I
> noticed that the gradient.rect of plotrix could fill a rect either up and
> down or from side to side. I am looking for something similar but fills
> diagonally instead, e.g., from the upper left corner to the bottom right.
> Does anyone know how to do it in R?


Do you mean something like this ... ?

library(grid)
pushViewport(viewport(width=.5, height=.5, clip="on"))
pushViewport(viewport(width=2, height=2, angle=45))
grid.rect(y=100:1/100, just="top",
  gp=gpar(col=NA,
  fill=colorRampPalette(c("blue", "green"),
space="Lab")(100)))

Paul
-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
[EMAIL PROTECTED]
http://www.stat.auckland.ac.nz/~paul/

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


Re: [R] distance matrix as text file - how to import?

2008-04-08 Thread Paul Johnson
On Tue, Apr 8, 2008 at 1:50 PM, Hans-Jörg Bibiko <[EMAIL PROTECTED]> wrote:
> Dear all,
>
>  I have -hopefully- a tiny problem.
>
>  I was sent a text file containing a distance matrix à la:
>
>  1
>  2 3
>  4 5 6
>


Try this! I put your test data in "text.txt" and voila:


mat <- matrix(0, 3,3)

mat[row(mat) >= col(mat)] <- scan("test.txt")


I found this Idea after "RSiteSearch("scan triangular") led to this
item as the very first link:

http://finzi.psych.upenn.edu/R/Rhelp02a/archive/22369.html


PJ


-- 
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas

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

2008-04-08 Thread Ruby_Stanford

Hey. I have a set of data points (x1,y1,z1;
x2,y2,z2;...xn,yn,zn). I need to smooth these in 3D.
For example if these were in 2 D then one would use inverse distance
weighting or moving averages. Does anyone know of any funtion in R that can
be used to do this (Using 3D data as mine)? 
-- 
View this message in context: 
http://www.nabble.com/Smoothing-3-D-data-tp16571189p16571189.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] fit points to plane

2008-04-08 Thread Bert Gunter
But probably not a good idea, as there are likely to be some scientfically
"interesting" local inhomogeneities that an appropriate nonparametric
smoother (e.g. splines,...) could reveal.

-- Bert Gunter

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Rolf Turner
Sent: Tuesday, April 08, 2008 1:16 PM
To: Luca Penasa
Cc: r-help@r-project.org
Subject: Re: [R] fit points to plane


On 9/04/2008, at 8:28 AM, Luca Penasa wrote:

> Is there a function for obtaining the best-fitting plane from a  
> large number of points (something like 25.000 points)?


?lm


##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Problem with NA data when computing standard error

2008-04-08 Thread LeCzar

Hey,

I want to compute means and standard errors as two tables like this:

  se<-function(x)sqrt(var(x)/length(x))
 
object1<-as.data.frame.table(tapply(Data[Year=="1999"],na.rm=T,list(Group[Year=="1999"],Season[Year=="1999"]),mean))
 
object2<-as.data.frame.table(tapply(Data[Year=="1999"],na.rm=T,list(Group[Year=="1999"],Season[Year=="1999"]),se))

Part of the data is labeled as NA, therfore the na.rm=T. I succeed in
creating the table for the means, but not for the standard errors. The
message is "Error in FUN(X[[1L]], ...) : unused argument(s) (na.rm = TRUE)". 
Does anyone have an idea how to get the standard error computed?

Thx!

-- 
View this message in context: 
http://www.nabble.com/Problem-with-NA-data-when-computing-standard-error-tp16569057p16569057.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] Separate y-limits in xYplot panels II

2008-04-08 Thread John Poulsen
Hello,

I have been trying to use xYplot in Hmisc to graph plots, allowing each 
panel to have a y-axis dependent on the data in the panel.

Following the advice from the R-Help list, message: [R] separate 
y-limits in xYplot panels on Wed, 30 May 2007 08:12:06 -0700 (PDT), I 
used scales=list(y=list(relation="free").

However, it does not seem to work.  Please see below code, where the 
scale of the y-axis of the 2 panels stays the same despite the scales 
function.

Does anyone know how to get around this?

Thanks,
John


x1=seq(1,30,0.5)
y1=x1^2
y2=10*(x1^2)
ycomb=c(y1,y2)
y.up=ycomb+0.1*ycomb
y.low=ycomb-0.1*ycomb
grp=rep(c(1,2),each=length(x1))
dat=as.data.frame(cbind(ycomb, y.up, y.low, grp, rep(x1,2)))
colnames(dat)=c("ycomb","y.up","y.low","grp","x1")

with(dat, xYplot(Cbind(ycomb, y.up, y.low)~x1|factor(grp), 
data=dat,type="l", method="bands", scales=list(y=list(relation="free"),
x=list(alternating=c(1,1,1)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] save multiple pages lattice-plot

2008-04-08 Thread Katell HAMON
Dear R-helper,

I am trying to save some plots I made with lattice, but I have several 
pages printed for each call.

My layout is something like c(col=2,row=4,pages=12) and I didn't find a 
way to save those plots, because I am usually using savePlot() which 
from what I saw can only save one page/device a the time.

Is there an easy way to save all the plots? or should I use a loop and 
cut my dataframe along my conditioning variables to make different calls 
and then save 1 page per call?

Thanks for your help,

Katell
-- 
Katell HAMON

Doctorante / PhD student

IFREMER-Brest
Departement d'économie maritime / Marine Economics Department
Technopole Brest Iroise
B.P. 70
29280 Plouzané
France

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

2008-04-08 Thread Kris Ghosh
I have data in the form of a column such as
1234.
2345.
3435.
4343.
I want to have the data in this form ..i.e to remove the "dot" at the
end of each number above.
1234
2345
3435
4343

I am trying to use split but it is not working. Any suggestions?

[[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] fit points to plane

2008-04-08 Thread Rolf Turner

On 9/04/2008, at 8:28 AM, Luca Penasa wrote:

> Is there a function for obtaining the best-fitting plane from a  
> large number of points (something like 25.000 points)?


?lm


##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

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

2008-04-08 Thread Paul Johnson
On Tue, Apr 8, 2008 at 2:18 PM, stephen sefick <[EMAIL PROTECTED]> wrote:
> #copy and paste this into R
>  f <- (structure(list(TKN = c(0.103011025, 0.018633208, 0.104235702,
>  0.074537363, 0.138286096), RM = c(215, 198, 148, 119, 61)), .Names = c("TKN",
>  "RM"), class = "data.frame", row.names = 25:29))
>  plot(f$TKN~f$RM, type="b")
>
>  I would like to reverse the X-Axis.  How do I do this?
>


Hello, Stephen:

It appears you might be new in R, so let me point out a couple of
things.  First, this works:


f <- data.frame( TKN = c(0.103011025, 0.018633208,
0.104235702,0.074537363, 0.138286096), RM = c(215, 198, 148, 119, 61),
row.names = 25:29)

plot(TKN~RM, data=f, type="b", xlim=rev(range(f$RM)))


Note that I've created your data frame in a more usual way and I've
reversed the x axis in the plot by reversing the range of the X
variable. I've also used the data option to plot

Second, I had  reversed an axis before, but I quickly learned how by
typing the following command:

RSiteSearch("reverse axis")

That opened up the web browser and it listed many items, the second of
which was this:

http://finzi.psych.upenn.edu/R/Rhelp02a/archive/66958.html

thread, the title of which is "How to reverse the sequence of axis Y ? "

Generally, if you try RSiteSearch() and don't find what you need after
exploring a page or two of threads, then you can post here and ask
questions without people saying "go read the posting guide before
posting questions."


Good luck
PJ



-- 
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas

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

2008-04-08 Thread benlafleche
This is maybe not the most elegant way, but it does de job. You first  
put f$RM values in negative form. Then you plot your graph without the  
x axis labels. After, you create the labels you want.

Try this :

f <- (structure(list(TKN = c(0.103011025, 0.018633208, 0.104235702,
0.074537363, 0.138286096), RM = c(215, 198, 148, 119, 61)), .Names =  
c("TKN",
"RM"), class = "data.frame", row.names = 25:29))

f$rms=f$RM*(-1)
plot(f$TKN~f$rms ,xaxt="n", type="b")

axis(side=1, seq(min(pretty(f$rms,n=3)),max(pretty(f$rms,n=3)),50),  
labels=seq(min(pretty(f$rm,n=3))*(-1),max(pretty(f$rm,n=3))*(-1),-50))


Benoit Bruneau
Canada


On Apr 8, 2008, at 3:52 PM, stephen sefick wrote:

> On Tue, Apr 8, 2008 at 3:52 PM, stephen sefick <[EMAIL PROTECTED]>  
> wrote:
>> Sorry, to have the x-axis to go from 200 to 0 or to reverse the x
>> points-  the line starts on the left hand side of the graph at   
>> x=215,
>> y=0.10301103   ...   and end with x=61, y=0.13828610. does this make
>> sense?  reverse order x-axis in excel is what I would use if this
>> helps
>>
>>
>>
>> On Tue, Apr 8, 2008 at 3:43 PM, Henrique Dallazuanna <[EMAIL PROTECTED] 
>> > wrote:
>>> Try:
>>>
>>> plot(f$RM~f$TKN, type="b")
>>>
>>>
>>>
>>>
>>> On Tue, Apr 8, 2008 at 4:18 PM, stephen sefick <[EMAIL PROTECTED]>  
>>> wrote:



 #copy and paste this into R
 f <- (structure(list(TKN = c(0.103011025, 0.018633208, 0.104235702,
 0.074537363, 0.138286096), RM = c(215, 198, 148, 119,  
 61)), .Names =
>>> c("TKN",
 "RM"), class = "data.frame", row.names = 25:29))
 plot(f$TKN~f$RM, type="b")

 I would like to reverse the X-Axis.  How do I do this?

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

   -K. Mullis


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

>>>
>>>
>>>
>>> --
>>> Henrique Dallazuanna
>>> Curitiba-Paraná-Brasil
>>> 25° 25' 40" S 49° 16' 22" O
>>
>>
>>
>> --
>>
>>
>> Let's not spend our time and resources thinking about things that are
>> so little or so large that all they really do for us is puff us up  
>> and
>> make us feel like gods. We are mammals, and have not exhausted the
>> annoying little problems of being mammals.
>>
>>-K. Mullis
>>
>
>
>
> -- 
> Let's not spend our time and resources thinking about things that are
> so little or so large that all they really do for us is puff us up and
> make us feel like gods. We are mammals, and have not exhausted the
> annoying little problems of being mammals.
>
>   -K. Mullis
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


[[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] simple graphing question

2008-04-08 Thread stephen sefick
On Tue, Apr 8, 2008 at 3:52 PM, stephen sefick <[EMAIL PROTECTED]> wrote:
> Sorry, to have the x-axis to go from 200 to 0 or to reverse the x
>  points-  the line starts on the left hand side of the graph at  x=215,
>  y=0.10301103   ...   and end with x=61, y=0.13828610. does this make
>  sense?  reverse order x-axis in excel is what I would use if this
>  helps
>
>
>
>  On Tue, Apr 8, 2008 at 3:43 PM, Henrique Dallazuanna <[EMAIL PROTECTED]> 
> wrote:
>  > Try:
>  >
>  > plot(f$RM~f$TKN, type="b")
>  >
>  >
>  >
>  >
>  > On Tue, Apr 8, 2008 at 4:18 PM, stephen sefick <[EMAIL PROTECTED]> wrote:
>  > >
>  > >
>  > >
>  > > #copy and paste this into R
>  > > f <- (structure(list(TKN = c(0.103011025, 0.018633208, 0.104235702,
>  > > 0.074537363, 0.138286096), RM = c(215, 198, 148, 119, 61)), .Names =
>  > c("TKN",
>  > > "RM"), class = "data.frame", row.names = 25:29))
>  > > plot(f$TKN~f$RM, type="b")
>  > >
>  > > I would like to reverse the X-Axis.  How do I do this?
>  > >
>  > > --
>  > > Let's not spend our time and resources thinking about things that are
>  > > so little or so large that all they really do for us is puff us up and
>  > > make us feel like gods. We are mammals, and have not exhausted the
>  > > annoying little problems of being mammals.
>  > >
>  > >-K. Mullis
>  > >
>  > >
>  > > __
>  > > R-help@r-project.org mailing list
>  > > https://stat.ethz.ch/mailman/listinfo/r-help
>  > > PLEASE do read the posting guide
>  > http://www.R-project.org/posting-guide.html
>  > > and provide commented, minimal, self-contained, reproducible code.
>  > >
>  >
>  >
>  >
>  > --
>  > Henrique Dallazuanna
>  > Curitiba-Paraná-Brasil
>  > 25° 25' 40" S 49° 16' 22" O
>
>
>
>  --
>
>
> Let's not spend our time and resources thinking about things that are
>  so little or so large that all they really do for us is puff us up and
>  make us feel like gods. We are mammals, and have not exhausted the
>  annoying little problems of being mammals.
>
> -K. Mullis
>



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

-K. Mullis

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


Re: [R] simple graphing question

2008-04-08 Thread Henrique Dallazuanna
Try:

plot(f$RM~f$TKN, type="b")


On Tue, Apr 8, 2008 at 4:18 PM, stephen sefick <[EMAIL PROTECTED]> wrote:

> #copy and paste this into R
> f <- (structure(list(TKN = c(0.103011025, 0.018633208, 0.104235702,
> 0.074537363, 0.138286096), RM = c(215, 198, 148, 119, 61)), .Names =
> c("TKN",
> "RM"), class = "data.frame", row.names = 25:29))
> plot(f$TKN~f$RM, type="b")
>
> I would like to reverse the X-Axis.  How do I do this?
>
> --
> Let's not spend our time and resources thinking about things that are
> so little or so large that all they really do for us is puff us up and
> make us feel like gods. We are mammals, and have not exhausted the
> annoying little problems of being mammals.
>
>-K. Mullis
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



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

[[alternative HTML version deleted]]

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


Re: [R] plot function / par() settings

2008-04-08 Thread Paul Johnson
On Tue, Apr 8, 2008 at 12:47 PM, Pedro Mardones <[EMAIL PROTECTED]> wrote:
> Dear all;
>
>  I'm trying to create a 2 x 3 plot (something I know like lattice can
>  do better) using the plot function. However; I'm not sure how to make
>  the width of the plots to be the same on each column. I guess the
>  answer maybe obvious but I haven't been able to figure it out. I'll
>  appreciate any suggestion. Here is the (highly inefficient) code for
>  the first row:
>
Dear Pedro:

I played around with the layout function and I think this does what
you want.  Because I set the widths exactly, there is no "squishing"
of the outer plots anymore.

Try this:

nf <- layout(matrix(c(1,2,3,4,5,6),2,3,byrow=TRUE), widths=c(lcm(5),
lcm(5), lcm(5)), heights=c(1,1), TRUE)

layout.show(nf)

par(mar=c(1,0,0,0))

  plot(1:5, 1:5, xlab = "", ylab = "", xaxt = "n", col = "blue");
  axis(3, at = seq(1:5), labels = rep("", 5))


  plot(1:5, 1:5, xlab = "", ylab = "", xaxt = "n", yaxt = "n", col =
  "red"); axis(3, at = seq(1:5), labels = seq(1:5))

  plot(1:5, 1:5, xlab = "", ylab = "", xaxt = "n", yaxt = "n", col =
  "red"); axis(3, at = seq(1:5), labels = rep("", 5))
  axis(4, at = seq(1:5), labels = rep("", 5))



  plot(1:5, 1:5, xlab = "", ylab = "", xaxt = "n", col = "blue");
  axis(3, at = seq(1:5), labels = rep("", 5))


  plot(1:5, 1:5, xlab = "", ylab = "", xaxt = "n", yaxt = "n", col =
  "red"); axis(3, at = seq(1:5), labels = seq(1:5))

  plot(1:5, 1:5, xlab = "", ylab = "", xaxt = "n", yaxt = "n", col =
  "red"); axis(3, at = seq(1:5), labels = rep("", 5))
  axis(4, at = seq(1:5), labels = rep("", 5))





>
>  par(mfrow = c(2, 3))
>  par(omi = c(0.60, 0.60, 0.60, 0.10))
>
>  par(mai = c(0.00, 0.50, 0.50, 0.00))
>  plot(1:5, 1:5, xlab = "", ylab = "", xaxt = "n", col = "blue");
>  axis(3, at = seq(1:5), labels = rep("", 5))
>
>  par(mai = c(0.00, 0.00, 0.50, 0.00))
>  plot(1:5, 1:5, xlab = "", ylab = "", xaxt = "n", yaxt = "n", col =
>  "red"); axis(3, at = seq(1:5), labels = seq(1:5))
>
>  par(mai = c(0.00, 0.00, 0.50, 0.50))
>  plot(1:5, 1:5, xlab = "", ylab = "", xaxt = "n", yaxt = "n", col =
>  "red"); axis(3, at = seq(1:5), labels = rep("", 5))
>  axis(4, at = seq(1:5), labels = rep("", 5))
>
>  Thanks
>  PM
>
>  __
>  R-help@r-project.org mailing list
>  https://stat.ethz.ch/mailman/listinfo/r-help
>  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>  and provide commented, minimal, self-contained, reproducible code.
>



-- 
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas

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

2008-04-08 Thread Anup Nandialath
Hi Michael,

Actually I was wrong in the initial mail. rbprobitGibbs uses the Gibbs Sampler. 
I think the rhierbinLogit does the Logit model which uses a Metropolis hastings 
approach uses the acceptance rate and the function outputs the rejection rate 
in the output list. So you are not required to change the source code.

HTH 

ANup

Michael Margolis <[EMAIL PROTECTED]> wrote: Is there a way to recover 
Metropolis-step acceptance rates AFTER  
completing posterior draws?

The immediate application is in the probit.bayes and logit.bayes  
models used by Zelig... which I believe is merely calling MCMCpack.  
So one strategy, to which I am fixing to resort, is to call, say,  
MCMClogit with verbose set to mcmc (or mcmc divided by an integer)   
and then look at my screen. But it seems odd that this datum is not  
being put into output objects, so I wonder if I'm missing something.

Plus sometimes I can save the output object, but then the power goes  
out and what's on screen is gone forever.

Thanks,
Michael



Michael Margolis
Profesor Investigador
Escuela de Economía
Universidad de Guanajuato
UCEA-Campus Marfil, Fracc 1
El Establo, Guanajuato, Gto. CP 36250
Mexico
(52)(473) 735 29 25 Ext. 2858





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


   
-
[[elided Yahoo spam]]
[[alternative HTML version deleted]]

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


[R] simple graphing question

2008-04-08 Thread stephen sefick
#copy and paste this into R
f <- (structure(list(TKN = c(0.103011025, 0.018633208, 0.104235702,
0.074537363, 0.138286096), RM = c(215, 198, 148, 119, 61)), .Names = c("TKN",
"RM"), class = "data.frame", row.names = 25:29))
plot(f$TKN~f$RM, type="b")

I would like to reverse the X-Axis.  How do I do this?

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

-K. Mullis

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


[R] reading in a Fortran binary array

2008-04-08 Thread Alexy Khrabrov
Greetings -- I'd like to avoid converting a Fortran array of floats  
into ASCII and back reading it in R.  Furthermore it's much faster to  
dump large arrays in binary, as they take up much less space with full  
precision -- many decimal points take up many bytes in ASCII versus  
four or eight per float in raw. Is there a way to read such a Fortran  
unformatted file back into R?

Cheers,
Alexy

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Combining many csv files into one and adding a column with an id of each csv file read

2008-04-08 Thread Judith Flores
Dear R experts,

   I have been looking into the help-pages and old
questions from the R-Help site, but the options
offered there don't seem to work in my case.

  First of all, I am working on Windows XP, using R
version 2.6.2.

  I am attaching two csv files as an example of how
the data I am traying to put together is delivered to
us. On the first row of every csv file is the name of
the file, along with the pathfile. This is what I have
been doing with every csv files (per seprate), which
of course is not the most efficient way to do it;
basically, it reads the csv file, then deletes the
first 3 rows and some columns that we don't need and
finally I add another column that identifies all the
rows of the csv file as belonging to one subject only,
I have to do this for further manipulations with all
the data:

filename<-'1_504_d0.csv'

dat<-read.csv(filename, header=F)
dat<-dat[c(-1:-3),c(-1,-4,-5,-6,-7,-9,-10,-11,-12)]
names(dat)<-c('time','T1','T2')
dat<-dat[,1:3]

dat$id<-as.character(filename)

  Since I have multiple csv files to read and I need
to have them consolidated in one data frame, how can I
apply the above manipulations to all the csv files and
at the same time put them in one files?

At the end, I need a big data frame that has 4
columns"

'Time', 'T1', T2', 'id'

I hope I have provided enough information.

Thank you in advance for your help,

Judith



  

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


[R] distance matrix as text file - how to import?

2008-04-08 Thread Hans-Jörg Bibiko
Dear all,

I have -hopefully- a tiny problem.

I was sent a text file containing a distance matrix à la:

1
2 3
4 5 6

Now I wanted to import these data into a dist object to, let's say,  
do 'plot(hclust(v))'.

My first naïve approach was to scan the text file in order to get a  
vector v. Then I did:

class(v) <- "dist"
attr(v, "Size") <- 4

But, of course, I got this:

1
2 4
3 5 6

I wonder if there's an elegant way to do it. The only way I know of  
is very very stony one.

I'd be very appreciated for any hint.

Cheers,

--Hans

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] diagonally fill a rectangle with color gradient

2008-04-08 Thread tom soyer
Hi,

Is it possible to diagonally fill a rectangle with a color gradient? I
noticed that the gradient.rect of plotrix could fill a rect either up and
down or from side to side. I am looking for something similar but fills
diagonally instead, e.g., from the upper left corner to the bottom right.
Does anyone know how to do it in R?

Thanks,

-- 
Tom

[[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] fit points to plane

2008-04-08 Thread Luca Penasa
Is there a function for obtaining the best-fitting plane from a large 
number of points (something like 25.000 points)?

Thank you...
Luca



--
Email.it, the professional e-mail, gratis per te: http://www.email.it/f

Sponsor:
Gioca con i Supereroi Marvel sul cellulare!
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=7752&d=8-4
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] plotmath "overstrikes" in output on a Linux system

2008-04-08 Thread Paul Johnson
On Tue, Apr 8, 2008 at 4:29 AM, Prof Brian Ripley <[EMAIL PROTECTED]> wrote:
> Looks likes the the laptop is using different fonts with incorrect font
> metrics.  This could happen because it has a different screen resolution, or
> one of the systems is set to use scalable fonts or it is giving metrics for
> one fonts and using another or 
>
>  BTW, this is probably nothing to do with plotmath per se -- the issue is
> most likely the device (presumably X11(), but you did not say) and its
> handling of font metric requests.  It looks to me as if the widths of normal
> text strings (and not symbols) is the problem.  I have seen something
> similar where there was a long-standing bug in plotmath (fixed in r44534),
> but this only manifested itself when text was kerned, which the X11() device
> in 2.6.2 does not ask for.
>
>  My best guess is that the font selected is (to use the technical terms)
> returning glyph widths without left/right bearings.
>
>  Please try 2.7.0 beta, which has a different X11() device (and the above
> bug fixed).  That ought to solve the problem for you, but otherwise you'll
> need to debug what the X11 metricInfo callback is giving you.
>
>

I installed R-latest from the beta directory.  Following your leads,
I've got some information that may help you see if this is purely an
isolated X11 problem on my computer or something you might fix in R.

On screen, I see this bad looking plot:

http://pj.freefaculty.org/R/png-screenshot-notOK.png

Using a png device to write the graph to file, either with

dev.copy(png ... )

or

png (file = " ")
plot ( )
dev.off()

The saved file is GOOD:

http://pj.freefaculty.org/R/png-output-OK.png

http://pj.freefaculty.org/R/png_dev_copy_OK.png

More details about this laptop.  The display has a native resolution
of 1680x1050, and IF I put the X11 display at that resolution, then
the on-screen X11 display of that particular graph is fine.

However, if I change the display to another value, the one I prefer is
1400x1050, and re-start, then I see the bad on-screen display.   In
both cases, however, I have confirmed that the DPI settings in
xdpyinfo are correctly representing pixels/inches.

That leads me back to Prof. Ripley's suggestion that I've got a
mismatch in fonts between what X11 really wants and what it gets.  The
font configuration on these systems is becoming so complicated I'm
completely bewildered, as Fedora has both traditional linux font
server and xft fonts and pango/cairo and freetype and apparently
anything else they can think of.  I'm going to keep studying the R
admin guide to see how to debug it.




Finally,  something came up that I don't want to forget. It is an RPM
building question for R fans.  This concerns my experience with
R-beta-20080407.r45159.  R built & installed without any apparent
trouble, and I decided to try to make an RPM package of it so other
Fedora people can test.  I took the spec file from the existing Fedora
8 updates R package, and made a few changes to suit the new file name
for R, and I built RPMS.  The build proceeds without noticeable
trouble, but when I try to install the RPM, I get this error

 $ sudo rpm -ivh R-2.7.20080407.r45159-1fc8.1.i386.rpm
Password:
error: Failed dependencies:
perl(R::Dcf) is needed by R-2.7.20080407.r45159-1fc8.1.i386
perl(R::Logfile) is needed by R-2.7.20080407.r45159-1fc8.1.i386
perl(R::Rd) is needed by R-2.7.20080407.r45159-1fc8.1.i386
perl(R::Rdconv) is needed by R-2.7.20080407.r45159-1fc8.1.i386
perl(R::Rdtools) is needed by R-2.7.20080407.r45159-1fc8.1.i386
perl(R::Utils) is needed by R-2.7.20080407.r45159-1fc8.1.i386
perl(R::Vars) is needed by R-2.7.20080407.r45159-1fc8.1.i386

As you can see, the package does have the perl modules, but something
has gone wrong in the scripting process that takes note of them:

$ rpm -qilp R-2.7.20080407.r45159-1fc8.1.i386.rpm | grep perl
/usr/share/R/perl
/usr/share/R/perl/File
/usr/share/R/perl/File/Copy
/usr/share/R/perl/File/Copy/Recursive.pm
/usr/share/R/perl/R
/usr/share/R/perl/R/Dcf.pm
/usr/share/R/perl/R/Logfile.pm
/usr/share/R/perl/R/Rd.pm
/usr/share/R/perl/R/Rdconv.pm
/usr/share/R/perl/R/Rdlists.pm
/usr/share/R/perl/R/Rdtools.pm
/usr/share/R/perl/R/Utils.pm
/usr/share/R/perl/R/Vars.pm
/usr/share/R/perl/Text
/usr/share/R/perl/Text/DelimMatch.pm
/usr/share/R/perl/build-help-windows.pl
/usr/share/R/perl/build-help.pl
/usr/share/R/perl/massage-Examples.pl

I'm contacting the RPM maintainer from redhat to see if he knows. But
if you know, please let me know.

-- 
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] plot function / par() settings

2008-04-08 Thread Pedro Mardones
Dear all;

I'm trying to create a 2 x 3 plot (something I know like lattice can
do better) using the plot function. However; I'm not sure how to make
the width of the plots to be the same on each column. I guess the
answer maybe obvious but I haven't been able to figure it out. I'll
appreciate any suggestion. Here is the (highly inefficient) code for
the first row:


par(mfrow = c(2, 3))
par(omi = c(0.60, 0.60, 0.60, 0.10))

par(mai = c(0.00, 0.50, 0.50, 0.00))
plot(1:5, 1:5, xlab = "", ylab = "", xaxt = "n", col = "blue");
axis(3, at = seq(1:5), labels = rep("", 5))

par(mai = c(0.00, 0.00, 0.50, 0.00))
plot(1:5, 1:5, xlab = "", ylab = "", xaxt = "n", yaxt = "n", col =
"red"); axis(3, at = seq(1:5), labels = seq(1:5))

par(mai = c(0.00, 0.00, 0.50, 0.50))
plot(1:5, 1:5, xlab = "", ylab = "", xaxt = "n", yaxt = "n", col =
"red"); axis(3, at = seq(1:5), labels = rep("", 5))
axis(4, at = seq(1:5), labels = rep("", 5))

Thanks
PM

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

2008-04-08 Thread Dieter Menne
Cristian Carranza  hotmail.com> writes:
> After fitting a mixed effects model to repeated measurements data set, and
after several unsuccessful
> atempts to make a simple plot of the confidence interval for the fitted model,
I gave up and now I am asking
> for help in this useful list.
> 
> Could anyone be so kind to give me some code lines in order to make a plot of
the fitted equation and the
> correspondent confidence interval?

The fitted equation is simple: use predict in its variations. For the
"confidence interval", most people on the list will ask back what it means. But
I know my colleagues, they or their reviewers insist on having error bar in the
graphics, and don't care about the interpretation.

Dimitri has given an approach that could be used to produce some
reviewer-satisfaction plots limited borborygmy.

http://finzi.psych.upenn.edu/R/Rhelp02a/archive/118174.html

Note that his method is meant to estimate well-defined confidence intervals for
the coefficients, but you can use the profiled fits and compute the "confidence
intervals" at the data points. Alternatively, you could use mcmc to get a range
of curves for averaging.

Dieter

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

2008-04-08 Thread Anup Nandialath
Hi Michael,
 
 If you are using the standard logit or probit model, it is fairly easy to save 
the acceptance rate after each draw. I would recommend using the "bayesm" 
package as the source code is easy to manipulate. For instance in the probit 
function (rbprobitGibbs),  you need to include a couple of lines of code to 
save the acceptance rate. I'm sure it is possible with the other packages as 
well. 

HTH

Anup 

Michael Margolis <[EMAIL PROTECTED]> wrote: Is there a way to recover 
Metropolis-step acceptance rates AFTER  
completing posterior draws?

The immediate application is in the probit.bayes and logit.bayes  
models used by Zelig... which I believe is merely calling MCMCpack.  
So one strategy, to which I am fixing to resort, is to call, say,  
MCMClogit with verbose set to mcmc (or mcmc divided by an integer)   
and then look at my screen. But it seems odd that this datum is not  
being put into output objects, so I wonder if I'm missing something.

Plus sometimes I can save the output object, but then the power goes  
out and what's on screen is gone forever.

Thanks,
Michael



Michael Margolis
Profesor Investigador
Escuela de Economía
Universidad de Guanajuato
UCEA-Campus Marfil, Fracc 1
El Establo, Guanajuato, Gto. CP 36250
Mexico
(52)(473) 735 29 25 Ext. 2858





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


   
-
[[elided Yahoo spam]]
[[alternative HTML version deleted]]

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


Re: [R] findGlobals on apply

2008-04-08 Thread Gabor Grothendieck
Yes, based on that it seems understandable although
initially suprising.

On Tue, Apr 8, 2008 at 12:56 PM, Duncan Murdoch <[EMAIL PROTECTED]> wrote:
> On 4/8/2008 7:42 AM, Gabor Grothendieck wrote:
> > I think what he is referring to is that findGlobals lists mean under
> > variables rather than functions when you do this with his f:
> >
> >
> > > findGlobals(f, FALSE)
> > >
> > $functions
> > [1] "{" "apply"
> >
> > $variables
> > [1] "mean"
> >
>
> Yes, I understood that, and I think it's reasonable behaviour. findGlobals
> analyzes the syntax, not the semantics.
>
> Duncan Murdoch
>
>
>
> >
> > On Tue, Apr 8, 2008 at 7:14 AM, Duncan Murdoch <[EMAIL PROTECTED]>
> wrote:
> >
> > > Christophe Genolini wrote:
> > > >>> f <- function(x){apply(x,2,mean)}
> > > >>> findGlobals(f)
> > > >>>
> > > >> mean is a global variable, so findGlobals gets it right.
> > > >>
> > > > That sound strange to me: a "variable" is something that vary... mean
> > > > does not vary. maen will ge an argument that is a line of x and will
> > > > make some calculous on it, that is the comportement of a function.
> > > > Of course, mean is an argument of an other function, but I do not
> think
> > > > this is a reason good enouth to say that mean is a variable.
> > > >
> > >
> > > findGlobals doesn't try to tell what mean is; it's just reporting on how
> > > you've used it.  Your usage means that the interpreter will treat it as
> > > a variable, getting a copy of its value and passing it as an argument to
> > > apply.  (That's an oversimplification, of course:  it's very unlikely
> > > that an actual copy will be made, but it will act as if one was made.)
> > >
> > > > Furthemore, I use findGlobals to detect some typo. In
> > > >
> > > > f <- function(myObject){return(mObject^2)}
> > > >
> > > > findGlobals will detect that mObject is a global so I know there is a
> > > > typo somewhere.
> > > > Considering mean as a globals do not let us use findGlobals this way.
> > > >
> > > >
> > >
> > > You can still use it to detect that kind of typo, but you need a second
> > > step where you check whether the globals exist in the environment of the
> > > function or not.  That test won't be perfect either:  it will miss cases
> > > where you meant to type a local variable, but by mistake typed the name
> > > of some global.  Most uses of mean as a variable would fall into that
> > > category; unfortunately (?) apply means some of them are legitimate.
> > >
> > > I think the best you'll ever be able to do is to get some suggestions of
> > > errors, with both false positives and false negatives.  If there were
> > > cases where some usage was definitely an error, the parser would
> > > probably catch it.
> > >
> > > Duncan Murdoch
> > >
> > >
> > >
> > > > Christophe
> > > >
> > > > __
> > > > R-help@r-project.org mailing list
> > > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > > > and provide commented, minimal, self-contained, reproducible code.
> > > >
> > >
> > > __
> > > R-help@r-project.org mailing list
> > > https://stat.ethz.ch/mailman/listinfo/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] Help me about singular error nls

2008-04-08 Thread Dieter Menne
jarod_v6  libero.it> writes:
> 
> I have that problem:
> this is file : PBS.txt
> Time  RFU
> 0.27.3021
> 0.080026.1565

> rm(list=ls())
> print("ls()")
> #carica Dati con file di testo
> 
> b <-read.table("PBS.txt", sep="\t", header= TRUE)
> print("b")
> b
> nlmod1 <- nls(RFU ~ A + (B+c*Time)/(1+exp(k*(e-Time))),
>  data = b,
> start = list(A = 1, c = 1, B = 1, k =1, e = 1),
>  trace = TRUE))

Thanks for providing a self-running example. There are two reasons for the lack
of success. First, your starting values were totally off (the curve was rising
strongly). Always plot the curve with the starting values together with the data
to be fitted, to be sure, that your are at least coming close. Note that your
data level off at around 22, so having A=22 is a good first choice.

With the starting values shown below, the iteration starts quite well, but ends
in a "step factor reduced ..." error. This almost always means: you want to much
from your data. The algorithm cannot decide, what combination of the FIVE
coefficients you ask to be estimated is the right one. You have a very smooth
curve with little "personality", so I would never use more than 2 or 3
coefficients to fit these. Or, less polite: your model is nonsense; try a
simpler one, for example as shown below. And in case you are sure that your
model is "the only truth": if you have a whole set of curves, for example from a
series of pharmacological tests, you might try nlme; it may work, but not from
the beginning.

In case you should argue that software XX does give results (I know a few
packages that do): these are wrong. If you are lucky, the software gives you the
standard error of the coefficients, possibly in the order of 10^7, which should
make you think it over.

Dieter


b <-read.table("PBS.txt", sep="\t", header= TRUE)
print("b")
b

A = 22
c = -0.1
B = 10
k = -2
e = 0
Time = seq(0,2,by=0.1)
plot(b$Time,b$RFU)
lines(Time, A + (B+c*Time)/(1+exp(k*(e-Time

nlmod1 <- nls(RFU ~ A + (B+c*Time)/(1+exp(k*(e-Time))),
 data = b,start = list(A = A, c = c, B = B, k =k, e = e),
 trace = TRUE)


nlmod2 <- nls(RFU ~A - B*exp(k*Time),
 data = b,start = list(A = A, B = B, k =k),
 trace = TRUE)
lines(b$Time,predict(nlmod2),col="red")

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

2008-04-08 Thread Charles C. Berry
On Tue, 8 Apr 2008, Yuelin Li wrote:

> I remember reading about post hoc statistical power on R-help.  But I
> can't seem to find them with RSiteSearch("post hoc statistical power")
> and variations of it.
>
> I would like to learn more about post hoc statistical power, its
> meaningfulness, advantages and disadvantages.  I thought the issue was
> settled after Tukey's 1993 paper about post hoc statistical power
> being "essentially meaningless once the experiment has been done".
> But they seem to be used, and sometimes encouraged
> (e.g., http://www.informaworld.com/smpp/content~content=a787469931).
>
> I do not intend to start a debate.  I simply would like to learn
> more.  Can anyone suggest a few articles?  Thanks,

Start here:

Hoenig, John M. and Heisey, Dennis M. (2001)
The abuse of power: The pervasive fallacy of power calculations for data 
analysis
The American Statistician, 55, 19-24
Keywords: bioequivalence testing; BURDEN OF PROOF; OBSERVED POWER; 
RETROSPECTIVE POWER ANALYSIS; statistical power; Type II error
CISid: 222509

HTH,

Chuck


>
> Yuelin.
>
> Tukey JW. Tightening the clinical trial. Control Clin Trials. 1993;14:266-285.
>
>
> =
>
> Please note that this e-mail and any files transmitted with it may be
> privileged, confidential, and protected from disclosure under
> applicable law. If the reader of this message is not the intended
> recipient, or an employee or agent responsible for delivering this
> message to the intended recipient, you are hereby notified that any
> reading, dissemination, distribution, copying, or other use of this
> communication or any of its attachments is strictly prohibited.  If
> you have received this communication in error, please notify the
> sender immediately by replying to this message and deleting this
> message, any attachments, and all copies and backups from your
> computer.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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

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


[R] nonlinear regression model to data with power exponential distributed errors

2008-04-08 Thread Yan (Daniel) Zhao
Hi, are you aware of any R packages that can fit a nonlinear
regression model to a dataset with power exponential distributed
random errors?
Daniel

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

2008-04-08 Thread Duncan Murdoch
On 4/8/2008 7:42 AM, Gabor Grothendieck wrote:
> I think what he is referring to is that findGlobals lists mean under
> variables rather than functions when you do this with his f:
> 
>> findGlobals(f, FALSE)
> $functions
> [1] "{" "apply"
> 
> $variables
> [1] "mean"

Yes, I understood that, and I think it's reasonable behaviour. 
findGlobals analyzes the syntax, not the semantics.

Duncan Murdoch

> 
> On Tue, Apr 8, 2008 at 7:14 AM, Duncan Murdoch <[EMAIL PROTECTED]> wrote:
>> Christophe Genolini wrote:
>> >>> f <- function(x){apply(x,2,mean)}
>> >>> findGlobals(f)
>> >>>
>> >> mean is a global variable, so findGlobals gets it right.
>> >>
>> > That sound strange to me: a "variable" is something that vary... mean
>> > does not vary. maen will ge an argument that is a line of x and will
>> > make some calculous on it, that is the comportement of a function.
>> > Of course, mean is an argument of an other function, but I do not think
>> > this is a reason good enouth to say that mean is a variable.
>> >
>>
>> findGlobals doesn't try to tell what mean is; it's just reporting on how
>> you've used it.  Your usage means that the interpreter will treat it as
>> a variable, getting a copy of its value and passing it as an argument to
>> apply.  (That's an oversimplification, of course:  it's very unlikely
>> that an actual copy will be made, but it will act as if one was made.)
>>
>> > Furthemore, I use findGlobals to detect some typo. In
>> >
>> > f <- function(myObject){return(mObject^2)}
>> >
>> > findGlobals will detect that mObject is a global so I know there is a
>> > typo somewhere.
>> > Considering mean as a globals do not let us use findGlobals this way.
>> >
>> >
>>
>> You can still use it to detect that kind of typo, but you need a second
>> step where you check whether the globals exist in the environment of the
>> function or not.  That test won't be perfect either:  it will miss cases
>> where you meant to type a local variable, but by mistake typed the name
>> of some global.  Most uses of mean as a variable would fall into that
>> category; unfortunately (?) apply means some of them are legitimate.
>>
>> I think the best you'll ever be able to do is to get some suggestions of
>> errors, with both false positives and false negatives.  If there were
>> cases where some usage was definitely an error, the parser would
>> probably catch it.
>>
>> Duncan Murdoch
>>
>>
>>
>> > Christophe
>> >
>> > __
>> > R-help@r-project.org mailing list
>> > https://stat.ethz.ch/mailman/listinfo/r-help
>> > PLEASE do read the posting guide 
>> > http://www.R-project.org/posting-guide.html
>> > and provide commented, minimal, self-contained, reproducible code.
>> >
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/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] Practical Data Limitations with R

2008-04-08 Thread Sankalp Upadhyay
Millions of rows can be a problem if all is loaded into memory, 
depending on type of data. Numeric should be fine but if you have 
strings and you would want to process based on that column (string 
comparisons etc) then it would be slow.
You may want to combine sources outside - stored procedures maybe - and 
then load to R. Joining of data within R code can be costly if you are 
selecting from a data frame based on a string.
I have, personally, run into 'out of memory' problems only beyond 1G of 
data on a windows 32 bit system with 3 GB RAM. That happens with C++ also.
Regarding speed, I find MATLAB faster than R for matrix operations. In 
other areas they are in same range. R is much better to program as it is 
has a much more complete programming language.
R can use multiple cores / cpus with a suitable multi threaded linear 
algebra library. Though this will only be for linear algebra operations.
64 bit binary for R is not available for windows.

Sankalp


Jeff Royce wrote:
> We are new to R and evaluating if we can use it for a project we need to
> do.  We have read that R is not well suited to handle very large data
> sets.  Assuming we have the data prepped and stored in an RDBMS (Oracle,
> Teradata, SQL Server), what can R reasonably handle from a volume
> perspective?   Are there some guidelines on memory/machine sizing based
> on data volume?  We need to be able to handle Millions of Rows from
> several sources.  Any advice is much appreciated.  Thanks.  
>
>   [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>

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


[R] post hoc statistical power

2008-04-08 Thread Yuelin Li
I remember reading about post hoc statistical power on R-help.  But I
can't seem to find them with RSiteSearch("post hoc statistical power")
and variations of it.

I would like to learn more about post hoc statistical power, its
meaningfulness, advantages and disadvantages.  I thought the issue was
settled after Tukey's 1993 paper about post hoc statistical power
being "essentially meaningless once the experiment has been done".
But they seem to be used, and sometimes encouraged 
(e.g., http://www.informaworld.com/smpp/content~content=a787469931).

I do not intend to start a debate.  I simply would like to learn
more.  Can anyone suggest a few articles?  Thanks,

Yuelin.

Tukey JW. Tightening the clinical trial. Control Clin Trials. 1993;14:266-285.

 
 =
 
 Please note that this e-mail and any files transmitted with it may be 
 privileged, confidential, and protected from disclosure under 
 applicable law. If the reader of this message is not the intended 
 recipient, or an employee or agent responsible for delivering this 
 message to the intended recipient, you are hereby notified that any 
 reading, dissemination, distribution, copying, or other use of this 
 communication or any of its attachments is strictly prohibited.  If 
 you have received this communication in error, please notify the 
 sender immediately by replying to this message and deleting this 
 message, any attachments, and all copies and backups from your 
 computer.

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

2008-04-08 Thread J Greenbaum
My previous post seems to have been eaten by the server because of
embedded code.  You can now find that code at:

http://tinyurl.com/3o88j2

I aoplogize for the double-posting...

-Jay

Hi all,

I'm trying to use the RSPerl module in a script that uses threads. I am
able to call R functions without a problem when I don't use threads.
However, using threads, I get varying errors depending on how I call the R
functions. If I call the R::initR function in the "boss" thread and then
try to call R functions from a "worker" thread, I get the following error:

Error: C stack usage is too close to the limit
Caught error in R::call()

However, if I move the "use" declarations for R & RReferences to the worker
thread, along with the initR call, I get this:

Fatal error: R home directory is not defined

I've attached some code for your reference. Is there any way to get this
module working with Perl threads? Thanks in advance for your help.

-Jay

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

2008-04-08 Thread Alexandra Ramos
Dear all,

 

Is it possible to use chisq.test(x,p) (where  x = c(N1,...,Nk) are the
counts in the k "bins" and p is a vector of the probabilities that a
random observation will fall in the various bins) to test the goodness
of fit of a certain distribution for which we had to estimate the
parameters? Is there another function to do that?

 

Also, how can I use chisq.test or other function to perform a goodness
of fit test for 2 independent samples (to check if they come from the
same distribution)?

Ks.test is not adequate for discrete samples.

 

And, is it possible to use ks.test to test the goodness of fit of a
certain given distribution that is not in its list (as it is pnorm,
pgamma, ...)? 

Again I can't estimate any distribution parameter!

Is it possible to do a Lilliefors test in R?

 

I couldn't find any of these answers in the literature. Can anyone help
me?

 

Alexandra




[[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] RSPerl & threads

2008-04-08 Thread J Greenbaum
Hi all,

I'm trying to use the RSPerl module in a script that uses threads.  I am
able to call R functions without a problem when I don't use threads.
However, using threads, I get varying errors depending on how I call the R
functions.  If I call the R::initR function in the "boss" thread and then
try to call R functions from a "worker" thread, I get the following error:

Error: C stack usage is too close to the limit
Caught error in R::call()

However, if I move the "use" declarations for R & RReferences to the worker
thread, along with the initR call, I get this:

Fatal error: R home directory is not defined

I've attached some code for your reference.  Is there any way to get this
module working with Perl threads?  Thanks in advance for your help.

-Jay

#!/usr/bin/perl

use warnings;
use strict;

#use R;
#use RReferences;
#&R::initR("--silent");

use threads;
use threads::shared;
use Thread::Queue;

our $queue : shared = Thread::Queue->new;
our $hold : shared;

my $thr = threads->new (\&command_runner);

$hold =1;
$queue->enqueue("ls");
while ($hold) {
sleep(1);
}
$queue->enqueue("end");

$thr->join();

# Thread for processing functions
sub command_runner {

use R;
use RReferences;
&R::initR("--silent");

my $run = 1;
# run until return
while ($run) {
# This call will block until the main thread sends the job
my $job = $queue->dequeue;

print "j: $job\n";

if ($job eq "ls"){
R::ls();
} elsif ($job eq "end") {
$run = 0
}
{ lock $hold; $hold = 0; }
}

}

[[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] re garding Garch prediction mechanism

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

  In particular, I suggest you use a published data set from a 
package like tseries, fEcofin, or FinTS.  If you want to compare results 
with Matlab, please provide code you used in both R and Matlab, along 
with an explanation of which versions of each you used including any 
add-on packages.  For R, you can get this version information with 
'sessionInfo()'.  Please include comparable information from Matlab. 

  Without this, it is usually more difficult for someone to 
understand your question, and any answers are less likely to help you. 

  Hope this helps. 
  Spencer 

rocky787 wrote:
> Hi,
> I am having some confusion.It has been said that we can only estimate the
> future values using meanForecast +/- 2*standardDeviation. with 95%
> confidence.This means using this garch model we can only have a upper and
> lower limit of the values within which the next actual value is expected to
> lie.Then how come in research papers they plot the actual and predicted
> value so neatly.The simple problem i am finding is that i am having say 200
> data values in time series and say i take 150 values for model parameter
> estimation.Now what i get in matlab is the mean and variance forecast of
> 51,52nd etc intervals.Now i need to plot the graph showing the closenes of
> the predicted and actual return values and not the variance .How can i do
> so???Plzz help in this regard.Will be of great help
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Change the position of panel strips in a lattice plot.

2008-04-08 Thread Deepayan Sarkar
On 4/8/08, Gustaf Rydevik <[EMAIL PROTECTED]> wrote:
> Hi all,
>
>
>  In lattice plots, is there any option to position the panel strips
>  with text below each subgraph, instead of above?

No.

-Deepayan

>  i.e. in:
>  Depth <- equal.count(quakes$depth, number=8, overlap=.1)
>  xyplot(lat ~ long | Depth, data = quakes)
>  ,is there any way to make "Depth" appear below the subgraphs, instead of 
> above?
>  I've been looking through the lattice documentation and the list
>  archive but have not found such a thing.
>
>  Many thanks in advance,
>
>  Gustaf
>
>  --
>  Gustaf Rydevik, M.Sci.
>  tel: +46(0)703 051 451
>  address:Essingetorget 40,112 66 Stockholm, SE
>  skype:gustaf_rydevik
>
>  __
>  R-help@r-project.org mailing list
>  https://stat.ethz.ch/mailman/listinfo/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 me about singular error nls

2008-04-08 Thread jarod_v6
Dear List

I have that problem:
this is file : PBS.txt
TimeRFU
0.  27.3021
0.0800  26.1565
0.1600  25.4836
0.2400  25.2104
0.3200  24.7967
0.4000  24.6310
0.4800  24.3472
0.5600  24.2905
0.6400  24.1394
0.7200  24.0244
0.8000  23.8532
0.8800  23.7908
0.9600  23.6668
1.0400  23.7458
1.1200  23.6787
1.2000  23.5651
1.2800  23.4757
1.3600  23.5172
1.4400  23.4748
1.5200  23.6037
1.6000  23.4516
1.6800  23.5655
1.7600  23.4365
1.8400  23.3553
1.9200  23.5021
2.  23.4123 


rm(list=ls())
print("ls()")
#carica Dati con file di testo

b <-read.table("PBS.txt", sep="\t", header= TRUE)
print("b")
b
nlmod1 <- nls(RFU ~ A + (B+c*Time)/(1+exp(k*(e-Time))),
 data = b,
start = list(A = 1, c = 1, B = 1, k =1, e = 1),
 trace = TRUE))

#-
13413478 :  1 1 1 1 1 
Errore in nls(RFU ~ A + (B + c * Time)/(1 + exp(k * (e - Time))), data = b,  : 
  gradiente singolare

Could you help me? The plot of data I don`t found errors and I don`t know  why 
sometimes in similar data function and sometimes not.
thanks for the help!

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 me about singular error nls

2008-04-08 Thread jarod_v6
Dear List

I have that problem:
this is file : PBS.txt
TimeRFU
0.  27.3021
0.0800  26.1565
0.1600  25.4836
0.2400  25.2104
0.3200  24.7967
0.4000  24.6310
0.4800  24.3472
0.5600  24.2905
0.6400  24.1394
0.7200  24.0244
0.8000  23.8532
0.8800  23.7908
0.9600  23.6668
1.0400  23.7458
1.1200  23.6787
1.2000  23.5651
1.2800  23.4757
1.3600  23.5172
1.4400  23.4748
1.5200  23.6037
1.6000  23.4516
1.6800  23.5655
1.7600  23.4365
1.8400  23.3553
1.9200  23.5021
2.  23.4123 


rm(list=ls())
print("ls()")
#carica Dati con file di testo

b <-read.table("PBS.txt", sep="\t", header= TRUE)
print("b")
b
nlmod1 <- nls(RFU ~ A + (B+c*Time)/(1+exp(k*(e-Time))),
 data = b,
start = list(A = 1, c = 1, B = 1, k =1, e = 1),
 trace = TRUE))

#-
13413478 :  1 1 1 1 1 
Errore in nls(RFU ~ A + (B + c * Time)/(1 + exp(k * (e - Time))), data = b,  : 
  gradiente singolare

Could you help me? The plot of data I don`t found errors and I don`t know  why 
sometimes in similar data function and sometimes not.
thanks for the help!

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

2008-04-08 Thread hadley wickham
> We are new to R and evaluating if we can use it for a project we need to
>  do.  We have read that R is not well suited to handle very large data
>  sets.  Assuming we have the data prepped and stored in an RDBMS (Oracle,
>  Teradata, SQL Server), what can R reasonably handle from a volume
>  perspective?   Are there some guidelines on memory/machine sizing based
>  on data volume?  We need to be able to handle Millions of Rows from
>  several sources.  Any advice is much appreciated.  Thanks.

The most important thing is what type of analysis do you want to do
with the data?  Is the algorithm that implements the analysis O(n),
O(n log n) or O(n^2) ?

Hadley

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

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


[R] how to check if a variable is preferentially present in a sample

2008-04-08 Thread Tania Oh
Dear All,

I do apologise if this question is out of place for this list but I've  
tried searching mailing lists and read "Introductory Statistics with  
R" by Peter Dalgaard, but couldn't find any hints on solving my  
question below:

I have a data frame (d) of values which I will rank in decreasing  
order of "val". Each value belongs to a group, either 'A', 'B', 'C',  
'D', or 'E'.  I then take the first 10 entries in data frame 'd'  and  
count the number of occurrences for each of the groups.  I want to  
test if certain groups occur more frequently than by chance in my  
first 10 entries. Would a chi-square test or a hypergeometric test be  
more suitable? If neither, what would be an alternative solution in  
R?  Below is my data:


## data
L5 <- LETTERS[1:5]
d <- data.frame(cbind(val= rnorm(1:10)^2, group=sample(L5,100,  
repl=TRUE)))

str(d)
##'data.frame': 100 obs. of  2 variables:
##$ val  : Factor w/ 10 levels "0.000169268449333046",..: 10 3 5 6 1 2  
7 8 4 9 ...
##$ group: Factor w/ 5 levels "A","B","C","D",..: 4 4 4 5 3 1 5 2 1  
2 ...


Many thanks in advance and apologies again,
tania

D. phil student
Department of Physiology, Anatomy and Genetics
University of Oxford

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

2008-04-08 Thread Philipp Pagel
On Tue, Apr 08, 2008 at 09:26:22AM -0500, Jeff Royce wrote:
> We are new to R and evaluating if we can use it for a project we need to
> do.  We have read that R is not well suited to handle very large data
> sets.  Assuming we have the data prepped and stored in an RDBMS (Oracle,
> Teradata, SQL Server), what can R reasonably handle from a volume
> perspective?   Are there some guidelines on memory/machine sizing based
> on data volume?  We need to be able to handle Millions of Rows from
> several sources.

As so often the answer is "it depends". R does not have an inherent
maximum number of rows it can deal with - the available memory
determines how big a dataset you can fit into RAM. So often the answer
would be "yes - just buy more RAM".

A couple million rows are no problem at all if you don't have too many
columns (done that). If you realy have a very large set of data which
you cannot fit into memory, you may still be able to use R: Do you
really need ALL data in memory at the same time? Often, very large
datasets actually contain many different subsets of data which you want
to analyze separately, anyway. The solution of storing the full data
in an RDBMS and selecting the required subsets as needed is the best
solution.

In your situation, I would simply load the full dataset into R and see
what happens.

cu
Philipp

-- 
Dr. Philipp Pagel  Tel.  +49-8161-71 2131
Lehrstuhl für Genomorientierte Bioinformatik   Fax.  +49-8161-71 2186
Technische Universität München
Wissenschaftszentrum Weihenstephan
85350 Freising, Germany
 
 and
 
Institut für Bioinformatik und Systembiologie / MIPS
Helmholtz Zentrum München -
Deutsches Forschungszentrum für Gesundheit und Umwelt
Ingolstädter Landstrasse 1
85764 Neuherberg, Germany
http://mips.gsf.de/staff/pagel

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


Re: [R] Practical Data Limitations with R

2008-04-08 Thread ajay ohri
Dear Jeff,

R works fine for 22 rows that i tested on a home PC with XP . Memory is
limited to hardware that you have. I suggest beefing up RAM to 2 GB and hard
disk space and then  working it out. I evaluated R too on my site
www.decisionstats.com and I found it comparable if not better to SPSS , SAS.


As a beginner , and in corporate projects try using the *GUI* R Commander or
the *Data Mining GUI Rattle *, its faster and will help you skip some steps,
you can also look at code generated side by side to learn the
language.

I am not sure on the server client version, but that should work too ..

Also look at the book http://oit.utk.edu/scc/RforSAS&SPSSusers.pdf

that helps you as a reference guide. Rest of details are on my site
www.decisionstats.com

Also *try the software WPS* http://www.teamwpc.co.uk/products/wps, which
uses SAS language and provides the same functionality at 10-20 % of cost for
millions of rows.


Hope this helps,

Ajay


On Tue, Apr 8, 2008 at 7:56 PM, Jeff Royce <[EMAIL PROTECTED]> wrote:

> We are new to R and evaluating if we can use it for a project we need to
> do.  We have read that R is not well suited to handle very large data
> sets.  Assuming we have the data prepped and stored in an RDBMS (Oracle,
> Teradata, SQL Server), what can R reasonably handle from a volume
> perspective?   Are there some guidelines on memory/machine sizing based
> on data volume?  We need to be able to handle Millions of Rows from
> several sources.  Any advice is much appreciated.  Thanks.
>
>[[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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] Question Regarding 'pipe'

2008-04-08 Thread Jan T. Kim
On Tue, Apr 08, 2008 at 06:52:33AM -0500, [EMAIL PROTECTED] wrote:
> Reason, I need to do this in awk and not R:
> 
> Let's say 'x' is the tabular representation of a sparse contingency table
> > x
>x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 Freq
> 10   0   0   2   2   2   0   2   0   2   54
> 51   0   0   2   2   2   0   2   1   21
> 61   0   1   0   2   2   0   2   0   2  137
> 71   0   1   1   2   1   0   1   0   1   14
> 10   1   0   1   1   2   2   0   2   1   2  110
> 
> 
> I need to generate that dataset from which such a contingency table could be
> made. That dataset would have sum(x$Freq) = 316 rows. Note that this is only
> a sample example. Real examples that I could be dealing with would have up
> to 50 variables and tens of thousands of cases. I can definitely make a
> dataset in R itself by replicating the first row 54 times, the third row 137
> times and so on (for a real example, each replication could be a 1000
> times), but I bet this is going to be as inefficient way of doing things as
> it could be.
> 
> However, if I write 'x' to file and then call the awk script above, I get my
> dataset within fraction of seconds (including the time to write and read
> files on the OS).
> 
> Any suggestions now on how to get the 'pipe' command work?

Escape the quotes that you want to include in the string by preceding them with
a backslash. Otherwise R will interpret them to terminate or start a string --
essentially as awk would do with double quotes just the same.

I'm still not convinced, though, that running that while loop using awk has
any advantages over programming it in R, but it's your choice...

Best regards, Jan


> On Tue, Apr 8, 2008 at 4:45 AM, Jan T. Kim <[EMAIL PROTECTED]> wrote:
> 
> > On Mon, Apr 07, 2008 at 07:42:50PM -0500, [EMAIL PROTECTED] wrote:
> > > Can anyone point out why this is not working?
> > >
> > > y<-read.table(pipe('  awk '{ n = $1; sub( ".*" $1 " " ,"") ; while ( n--
> > )
> >^
> > > print }'  temp.txt '))
> >  ^
> >
> > one problem is that your single-quoted R string contains single quotes
> > which I've pointed to with "^" above. You probably intend these single
> > quotes to be part of the awk command line, but R can\'t know that unless
> > you escape them...  ;-)
> >
> > In the future, can you please describe explicitly how it "is not working",
> > and also give a bit more context, such as a few lines of description of
> > the content of temp.txt, and why you're trying to use awk (rather than R
> > itself) to achieve whatever you're trying to achieve?
> >
> > Best regards, Jan
> > --
> >  +- Jan T. Kim ---+
> >  | email: [EMAIL PROTECTED]   |
> >  | WWW:   http://www.cmp.uea.ac.uk/people/jtk |
> >  *-=<  hierarchical systems are for files, not for humans  >=-*
> >
> > __
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/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.

-- 
 +- Jan T. Kim ---+
 | email: [EMAIL PROTECTED]   |
 | WWW:   http://www.cmp.uea.ac.uk/people/jtk |
 *-=<  hierarchical systems are for files, not for humans  >=-*

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

2008-04-08 Thread Jeff Royce
We are new to R and evaluating if we can use it for a project we need to
do.  We have read that R is not well suited to handle very large data
sets.  Assuming we have the data prepped and stored in an RDBMS (Oracle,
Teradata, SQL Server), what can R reasonably handle from a volume
perspective?   Are there some guidelines on memory/machine sizing based
on data volume?  We need to be able to handle Millions of Rows from
several sources.  Any advice is much appreciated.  Thanks.  

[[alternative HTML version deleted]]

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


Re: [R] How to access the attributes of a ggplot?

2008-04-08 Thread hadley wickham
>  Thanks for replying. I know that I can directly modify some of the
>  properties of the plot object, but I was more interested in querying
>  the current plot properties, something like:
>
>  xlimits <- getggopts(pobj, "x_scale_limits")
>
>  Is there anything like this implemented?

Ah, that's much more tricky.  The problem is that many of these values
are not calculated until you actually draw the plot, and then they are
immediately thrown away because of the copy-on-modify semantics that
I'm following (to match the rest of R).  You can access some info
about the scales by looking at str(pobj$scales), but most of the
interesting stuff isn't calculated until draw time.

Hadley

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

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


[R] Porting from 1 stats platform to another

2008-04-08 Thread ajay ohri
Dear All,


I was recommended this book "
http://oit.utk.edu/scc/RforSAS&SPSSusers.pdfand found it very good as
a 3-in-1 reference guide , and also as migration
guide from 1 platform to another. Many Thanks to the people who helped me in
this.

It took me some time to find out the R GUI though, that really helped me
learn even faster thanks to code which gets generated side by side.

In case you are a member of Linkedin , you can join the Linked In Community
for Decision Sciences at http://www.linkedin.com/e/gis/54257/45BBEE7E671E

I am not connected with Linkedin or any of these companies in any commercial
way.

This is for users of either SAS,SPSS ,WPS , or R as well as other major
softwares in this field (??)

Regards,

Ajay

www.decisionstats.com
"Read the technical review of WPS here "

[[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 pack my stuff into a package (library, collection)?

2008-04-08 Thread Martin Maechler
> "TL" == Tribo Laboy <[EMAIL PROTECTED]>
> on Tue, 8 Apr 2008 22:15:13 +0900 writes:

TL> okey-dokey, one more problem resolved.
TL> Keeping one documentation .Rd file for each R source file.

not at all ...  you still think "Matlab"

One R source file typically contains several function (and maybe
class and method) definitions.

Often on Rd file contains documentation for more than one
object.

Look at the R sources , at any package sources (i.e. not the
*.zip, but the *.tar.gz files).

Martin Maechler, ETH Zurich

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Change the position of panel strips in a lattice plot.

2008-04-08 Thread Gustaf Rydevik
Hi all,


In lattice plots, is there any option to position the panel strips
with text below each subgraph, instead of above?
i.e. in:
Depth <- equal.count(quakes$depth, number=8, overlap=.1)
xyplot(lat ~ long | Depth, data = quakes)
,is there any way to make "Depth" appear below the subgraphs, instead of above?
I've been looking through the lattice documentation and the list
archive but have not found such a thing.

Many thanks in advance,

Gustaf

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

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

2008-04-08 Thread Bill.Venables
'mode' is a mutually exclusive classification of objects according to
their basic structure.  The 'atomic' modes are numeric, complex,
charcter and logical.  Recursive objects have modes such as 'list' or
'function' or a few others.  An object has one and only one mode.

'class' is a property assigned to an object that determines how generic
functions operate with it.  It is not a mutually exclusive
classification.  If an object has no specific class assigned to it, such
as a simple numeric vector, it's class is usually the same as its mode,
by convention.

Changing the mode of an object is often called 'coercion'.  The mode of
an object can change without necessarily changing the class.  e.g.

> x <- 1:16
> mode(x)
[1] "numeric"
> dim(x) <- c(4,4)
> mode(x)
[1] "numeric"
> class(x)
[1] "matrix"
> is.numeric(x)
[1] TRUE
> mode(x) <- "character"
> mode(x)
[1] "character"
> class(x)
[1] "matrix"

However:

> x <- factor(x)
> class(x)
[1] "factor"
> mode(x)
[1] "numeric"
> 

At this stage, even though x has mode numeric again, its new class,
'factor', inhibits it being used in arithmetic operations.

In practice, mode is not used very much, other than to define a class
implicitly when no explicit class has been assigned. 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Shubha Vishwanath Karanth
Sent: Tuesday, 8 April 2008 10:20 PM
To: [EMAIL PROTECTED]
Subject: [R] Mode Vs Class

Hi R,

Just came across the 'mode' of an object. What is the basic difference
between ?class and ?mode ... For example:

d <- data.frame(a = c(1,2), b = c(5,6))

class(d)

[1] "data.frame"

mode(d)

[1] "list"

But,

c <- c(2,3,5,6,7)

class(c)

[1] "numeric"

mode(c)

[1] "numeric" 

Could anyone help me out... 

Thanks,

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

2008-04-08 Thread Terry Therneau

The 'basehaz' function is just a wrapper for survfit, and includes only some of
the arguments of the former.  It's main reason for existence is that another 
more well known (but inferior :-) package uses that term.

I don't understand the final comment in the exchange, however:

> I had been hoping the tedious
> alignment of the baseline curve with the value of the variables in the
> new data set would be [somehow] handled for me.

Terry Therneau

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

2008-04-08 Thread ONKELINX, Thierry
Dear João,

You can do permutation tests on an unbalanced design. 

HTH,

Thierry



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

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

The plural of anecdote is not data.
~ Roger Brinner

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

-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens João Fadista
Verzonden: dinsdag 8 april 2008 15:18
Aan: r-help@r-project.org
Onderwerp: [R] permutation test assumption?

Dear all,

Can I do a permutation test if the number of individuals in one group is much 
bigger than in the other group? I searched the literature but I didin´t find 
any assumption that refers to this subject for permutation tests.


Best regards

João Fadista
Ph.d. student



 UNIVERSITY OF AARHUS   
Faculty of Agricultural Sciences
Dept. of Genetics and Biotechnology 
Blichers Allé 20, P.O. BOX 50   
DK-8830 Tjele   

Phone:   +45 8999 1900  
Direct:  +45 8999 1900  
E-mail:  [EMAIL PROTECTED]    
Web: www.agrsci.org 


DJF now offers new degree programmes 
 . 

News and news media  .

This email may contain information that is confidential. Any use or publication 
of this email without written permission from Faculty of Agricultural Sciences 
is not allowed. If you are not the intended recipient, please notify Faculty of 
Agricultural Sciences immediately and delete this email.




[[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] permutation test assumption?

2008-04-08 Thread João Fadista
Dear all,
 
Can I do a permutation test if the number of individuals in one group is much 
bigger than in the other group? I searched the literature but I didin´t find 
any assumption that refers to this subject for permutation tests.
 

Best regards

João Fadista
Ph.d. student



 UNIVERSITY OF AARHUS   
Faculty of Agricultural Sciences
Dept. of Genetics and Biotechnology 
Blichers Allé 20, P.O. BOX 50   
DK-8830 Tjele   

Phone:   +45 8999 1900  
Direct:  +45 8999 1900  
E-mail:  [EMAIL PROTECTED]    
Web: www.agrsci.org 


DJF now offers new degree programmes 
 . 

News and news media  .

This email may contain information that is confidential. Any use or publication 
of this email without written permission from Faculty of Agricultural Sciences 
is not allowed. If you are not the intended recipient, please notify Faculty of 
Agricultural Sciences immediately and delete this email.




[[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 pack my stuff into a package (library, collection)?

2008-04-08 Thread Tribo Laboy
okey-dokey, one more problem resolved.
Keeping one documentation .Rd file for each R source file.
Thanks!

TL

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 pack my stuff into a package (library, collection)?

2008-04-08 Thread Duncan Murdoch
On 08/04/2008 7:08 AM, Tribo Laboy wrote:
> Thanks all for the help and suggestions. I am little by little finding
> my way. I have another question to the people who use the R packaging
> system. Say I have a function called "myfun.R". 

I guess you mean you have a source file myfun.R, containing a definition 
of a function myfun.  You would put this in the R subdirectory of the 
package.  (You could have a function named myfun.R, but it looks a 
little strange.)

Where am I supposed to
> write the help to that function? When I use promt("myfun") or
> package.skeleton("myfun") I get a skeleton of the .Rd file which
> contains both help and R source. What do you do with the original .R
> source file then - do you delete it? I suppose it is not necessary
> anymore and all changes to R source and help can be done
> simultaneously in the .Rd file.

No, definitely not.  The source is copied to the Rd file just to remind 
you of what the function looks like, so that you can write documentation 
that is correct.  By the time you're finished editing that file, you'll 
have actual working examples in the Examples section, not the function 
definition.  You'll put the .Rd file into the man subdirectory of the 
package; R uses the \alias{myfun} line at the top to find the connection 
to your myfun function.

There is a proposal on the Google Summer of Code page to mix 
documentation with definitions in the .R file, but so far we don't do that.

  Then it can be used to generate all
> the help and R files to be run. But then .Rd files cannot be run
> directly from R, so each time a change is done to the source, it must
> be re-exported in an .R file and run. Please tell me if I am wrong. Do
> you keep R-souce and R-help in separate files while developing and
> then combine them in a single .Rd file when you're finished?

No, they are separate from the beginning, and stay separate.

Duncan Murdoch

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


[R] Metropolis acceptance rates

2008-04-08 Thread Michael Margolis
Is there a way to recover Metropolis-step acceptance rates AFTER  
completing posterior draws?

The immediate application is in the probit.bayes and logit.bayes  
models used by Zelig... which I believe is merely calling MCMCpack.  
So one strategy, to which I am fixing to resort, is to call, say,  
MCMClogit with verbose set to mcmc (or mcmc divided by an integer)   
and then look at my screen. But it seems odd that this datum is not  
being put into output objects, so I wonder if I'm missing something.

Plus sometimes I can save the output object, but then the power goes  
out and what's on screen is gone forever.

Thanks,
Michael



Michael Margolis
Profesor Investigador
Escuela de Economía
Universidad de Guanajuato
UCEA-Campus Marfil, Fracc 1
El Establo, Guanajuato, Gto. CP 36250
Mexico
(52)(473) 735 29 25 Ext. 2858





[[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] Install spatstat package on gentoo

2008-04-08 Thread Uwe Ligges


Luca Penasa wrote:
> Anybody know how to install R-spatstat package on a gentoo based system?

Same as on any other system, see the manual R Installation and 
Administration and please do read the posting guide.

Best,
Uwe Ligges



> Thanks you
> Luca
> 
> 
> 
> -- 
> Email.it, the professional e-mail, gratis per te: http://www.email.it/f
> 
> Sponsor:
> Una BMW Z4 Roadster a 10€? Prova gratis su Bidplaza.it!
> * Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=7673&d=8-4
> 
> 
> 
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Mode Vs Class

2008-04-08 Thread Shubha Vishwanath Karanth
Hi R,

 

Just came across the 'mode' of an object. What is the basic difference
between ?class and ?mode...For example:

 

d=data.frame(a=c(1,2),b=c(5,6))

class(d)

[1] "data.frame"

mode(d)

[1] "list"

 

But,

 

c=c(2,3,5,6,7)

class(c)

[1] "numeric"

mode(c)

[1] "numeric"

 

Could anyone help me out...

 

Thanks,

shubha

 

This e-mail may contain confidential and/or privileged i...{{dropped:13}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] sample size for log-rank test with more than 2 groups

2008-04-08 Thread Frank E Harrell Jr
Essioux, Laurent wrote:
> Hi everyone,
> 
> I was wondering whether extension of the current spower function for
> Hmisc were existing?
> 
> My current focus is to calculate sample size based on the log-rank test
> with more than 2 groups (with/without trend)
> 
> Taking into account the loss of follow up and the accrual processes.
> 
> A SPSS library (ART) is existing but can't find anything in R
> 
> Any information is welcome !
> 
> Many thanks
> 
> Laurent

spower only implements the two-sample problem.

Frank

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


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

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


Re: [R] Question Regarding 'pipe'

2008-04-08 Thread born . to . b . wyld
Reason, I need to do this in awk and not R:

Let's say 'x' is the tabular representation of a sparse contingency table
> x
   x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 Freq
10   0   0   2   2   2   0   2   0   2   54
51   0   0   2   2   2   0   2   1   21
61   0   1   0   2   2   0   2   0   2  137
71   0   1   1   2   1   0   1   0   1   14
10   1   0   1   1   2   2   0   2   1   2  110


I need to generate that dataset from which such a contingency table could be
made. That dataset would have sum(x$Freq) = 316 rows. Note that this is only
a sample example. Real examples that I could be dealing with would have up
to 50 variables and tens of thousands of cases. I can definitely make a
dataset in R itself by replicating the first row 54 times, the third row 137
times and so on (for a real example, each replication could be a 1000
times), but I bet this is going to be as inefficient way of doing things as
it could be.

However, if I write 'x' to file and then call the awk script above, I get my
dataset within fraction of seconds (including the time to write and read
files on the OS).

Any suggestions now on how to get the 'pipe' command work?

Thanks






On Tue, Apr 8, 2008 at 4:45 AM, Jan T. Kim <[EMAIL PROTECTED]> wrote:

> On Mon, Apr 07, 2008 at 07:42:50PM -0500, [EMAIL PROTECTED] wrote:
> > Can anyone point out why this is not working?
> >
> > y<-read.table(pipe('  awk '{ n = $1; sub( ".*" $1 " " ,"") ; while ( n--
> )
>^
> > print }'  temp.txt '))
>  ^
>
> one problem is that your single-quoted R string contains single quotes
> which I've pointed to with "^" above. You probably intend these single
> quotes to be part of the awk command line, but R can\'t know that unless
> you escape them...  ;-)
>
> In the future, can you please describe explicitly how it "is not working",
> and also give a bit more context, such as a few lines of description of
> the content of temp.txt, and why you're trying to use awk (rather than R
> itself) to achieve whatever you're trying to achieve?
>
> Best regards, Jan
> --
>  +- Jan T. Kim ---+
>  | email: [EMAIL PROTECTED]   |
>  | WWW:   http://www.cmp.uea.ac.uk/people/jtk |
>  *-=<  hierarchical systems are for files, not for humans  >=-*
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] findGlobals on apply

2008-04-08 Thread Luke Tierney

On Tue, 8 Apr 2008, Christophe Genolini wrote:




f <- function(x){apply(x,2,mean)}
findGlobals(f)

mean is a global variable, so findGlobals gets it right.

That sound strange to me: a "variable" is something that vary... mean
does not vary. maen will ge an argument that is a line of x and will
make some calculous on it, that is the comportement of a function.
Of course, mean is an argument of an other function, but I do not think
this is a reason good enouth to say that mean is a variable.


You are missing some points about R and findGlobals.

In R, functions are first class values: they can be assigned to
variables, passed as arguments, and returned as results, just like
vectors.  In contrast to many other languages there is not special
mechanism for defining functions and associating them with a name --
the way you define a function is

foo <- function(...) ...

which creates a function value and assigns it to a variable.

findGlobals just looks at the function body and arguments and
determines which of the variables used would have their definitions
looked up in the global environment if this code is run.  It does not
try to detect which of these have values or not, never mind what the
types of those falues are.

The result returned by findGlobals with merge=FALSE separates into
variables that are explicitly used as funcitons, i.e foo in foo(x) and
ones that are not.  One could argue that findGlobals should know
enough about apply() to realize that the FUN argument is implicitly
used as a function; if this change were made then

apply(x, 2, pi)

pi would be listed as a function because it is _used_ that way.


Furthemore, I use findGlobals to detect some typo. In

f <- function(myObject){return(mObject^2)}

findGlobals will detect that mObject is a global so I know there is a
typo somewhere.
Considering mean as a globals do not let us use findGlobals this way.


You need to do some extra work to get this -- checking which globals
have values, and maybe whether those that are used as functions have
values that are functions.  checkUsage does this, among other things.
For this example checkUsage produces

> checkUsage(f)
: no visible binding for global variable ‘mObject’

luke


Christophe

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



--
Luke Tierney
Chair, Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa  Phone: 319-335-3386
Department of Statistics andFax:   319-335-3017
   Actuarial Science
241 Schaeffer Hall  email:  [EMAIL PROTECTED]
Iowa City, IA 52242 WWW:  http://www.stat.uiowa.edu__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] findGlobals on apply

2008-04-08 Thread Gabor Grothendieck
I think what he is referring to is that findGlobals lists mean under
variables rather than functions when you do this with his f:

> findGlobals(f, FALSE)
$functions
[1] "{" "apply"

$variables
[1] "mean"

On Tue, Apr 8, 2008 at 7:14 AM, Duncan Murdoch <[EMAIL PROTECTED]> wrote:
> Christophe Genolini wrote:
> >>> f <- function(x){apply(x,2,mean)}
> >>> findGlobals(f)
> >>>
> >> mean is a global variable, so findGlobals gets it right.
> >>
> > That sound strange to me: a "variable" is something that vary... mean
> > does not vary. maen will ge an argument that is a line of x and will
> > make some calculous on it, that is the comportement of a function.
> > Of course, mean is an argument of an other function, but I do not think
> > this is a reason good enouth to say that mean is a variable.
> >
>
> findGlobals doesn't try to tell what mean is; it's just reporting on how
> you've used it.  Your usage means that the interpreter will treat it as
> a variable, getting a copy of its value and passing it as an argument to
> apply.  (That's an oversimplification, of course:  it's very unlikely
> that an actual copy will be made, but it will act as if one was made.)
>
> > Furthemore, I use findGlobals to detect some typo. In
> >
> > f <- function(myObject){return(mObject^2)}
> >
> > findGlobals will detect that mObject is a global so I know there is a
> > typo somewhere.
> > Considering mean as a globals do not let us use findGlobals this way.
> >
> >
>
> You can still use it to detect that kind of typo, but you need a second
> step where you check whether the globals exist in the environment of the
> function or not.  That test won't be perfect either:  it will miss cases
> where you meant to type a local variable, but by mistake typed the name
> of some global.  Most uses of mean as a variable would fall into that
> category; unfortunately (?) apply means some of them are legitimate.
>
> I think the best you'll ever be able to do is to get some suggestions of
> errors, with both false positives and false negatives.  If there were
> cases where some usage was definitely an error, the parser would
> probably catch it.
>
> Duncan Murdoch
>
>
>
> > Christophe
> >
> > __
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


Re: [R] How to pack my stuff into a package (library, collection)?

2008-04-08 Thread Duncan Murdoch
Yesterday I wrote:
> I took a look at this today.  You get an error message but the package 
> is still installed without the CHM compiler, so that's less urgent.
>
> I did add a menu entry to install a source package from a directory:
>
> Packages | Install source package from local folder...
>
> to the alpha version.  I don't guarantee this will survive testing:  it 
> gives a fairly ugly error message if you don't have Rtools installed.
>
>   
It didn't survive.  We'll be looking at a more complete solution for 
2.8.0, but we're out of time for 2.7.0.

Duncan Murdoch

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


[R] Install spatstat package on gentoo

2008-04-08 Thread Luca Penasa

Anybody know how to install R-spatstat package on a gentoo based system?
Thanks you
Luca



--
Email.it, the professional e-mail, gratis per te: http://www.email.it/f

Sponsor:
Una BMW Z4 Roadster a 10€? Prova gratis su Bidplaza.it!
* 
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=7673&d=8-4
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


  1   2   >