Re: [R] Re peated Measure ANOVA-Old question

2008-07-30 Thread Mark Difford

Hi Chunhao,

 I google the website and I found that there are three ways to perform  
 repeated measure ANOVA: aov, lme and lmer.

It's also a good idea to search through the archives.

 I use the example that is provided in the above link and I try
  tt-aov(p.pa~group*time+Error(subject/time),data=P.PA)
  TukeyHSD(tt)
 Error in UseMethod(TukeyHSD) : no applicable method for TukeyHSD

Because of ... + Error().

See the following thread, where this is answered:

http://www.nabble.com/Tukey-HSD-(or-other-post-hoc-tests)-following-repeated-measures-ANOVA-td17508294.html#a17559307

HTH, Mark.


ctu wrote:
 
 Hi R users,
 I google the website and I found that there are three ways to perform  
 repeated measure ANOVA: aov, lme and lmer.
 http://www.mail-archive.com/[EMAIL PROTECTED]/msg58502.html
 But the questions are which one is good to use and how to do post-hoc
 test?
 
 I use the example that is provided in the above link and I try
 tt-aov(p.pa~group*time+Error(subject/time),data=P.PA)
 TukeyHSD(tt)
 Error in UseMethod(TukeyHSD) : no applicable method for TukeyHSD
 
 Any suggestions?
 
 Appreciate in advance~
 Chunhao
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/Repeated-Measure-ANOVA-Old-question-tp18726146p18726722.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] Urgent

2008-07-30 Thread Moshe Olshansky
Hi Yunlei,

Is your problem constrained or not?
If it is unconstrained and your matrix is not positive definite, the minimum is 
unbounded (unless you are extremely lucky and the matrix is positive 
semi-definite and the vector which multiplies the unknowns is exactly 
perpendicular to all the eigenvectors with 0 eigenvalues).
If the problem is constrained you may use regular optimization functions (like 
optim).

Regards,

Moshe.


--- On Tue, 22/7/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 From: [EMAIL PROTECTED] [EMAIL PROTECTED]
 Subject: [R] Urgent
 To: r-help@r-project.org
 Received: Tuesday, 22 July, 2008, 6:12 PM
 Hi everyone
 
 I try to use the solve.QP to solve the quadratic
 programming problem.
 But the Dmat in the funciotn is non-positive definite.
 
 Can anyone tell me which R function can deal with the
 quadratic
 programming with non positive definite Dmat matrix ( in
 solve.QP)
 
 I really appreaciated.
 
 Yunlei Hu
 
 ___
 
 This e-mail may contain information that is confidential,
 privileged or otherwise protected from disclosure. If you
 are not an intended recipient of this e-mail, do not
 duplicate or redistribute it by any means. Please delete it
 and any attachments and notify the sender that you have
 received it in error. Unless specifically indicated, this
 e-mail is not an offer to buy or sell or a solicitation to
 buy or sell any securities, investment products or other
 financial product or service, an official confirmation of
 any transaction, or an official statement of Barclays. Any
 views or opinions presented are solely those of the author
 and do not necessarily represent those of Barclays. This
 e-mail is subject to terms available at the following link:
 www.barcap.com/emaildisclaimer. By messaging with Barclays
 you consent to the foregoing.  Barclays Capital is the
 investment banking division of Barclays Bank PLC, a company
 registered in England (number 1026167) with its registered
 offi!
  ce at 1 Churchill Place, London, E14 5HP.  This email may
 relate to or be sent from other members of the Barclays
 Group.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] Re peated Measure ANOVA-Old question

2008-07-30 Thread ctu

Tank you (Anna  Mark) very much for this super information
Let me confirm that IF I want to perform the RM-ANOVA
I should use lmer and perform the post-hoc test by using glht, right?

Because I am not so familiar with lmer so I have two more questions.
Let me use that following example again,
1. Is the random effect statement correct? if no what will be?
2. What did I do wrong in glht?


require(lme4);require(nlme)
group -rep(rep(1:2, c(5,5)), 3);time -rep(1:3, rep(10,3));subject -  
rep(1:10,3)

p.pa - c(92, 44, 49, 52, 41, 34, 32, 65, 47, 58, 94, 82, 48, 60, 47,
46, 41, 73, 60, 69, 95, 53, 44, 66, 62, 46, 53, 73, 84, 79)
P.PA - data.frame(subject, group, time, p.pa)
P.PA$group=factor(P.PA$group);P.PA$time=factor(P.PA$time)
P.PA$subject=factor(P.PA$subject)

tlmer-lmer (p.pa ~ time * group + (time*group | subject), data=P.PA )


summary(glht(tlmer,linfct=mcp(group=Tukey)))

Error in UseMethod(fixef) : no applicable method for fixef
In addition: Warning message

Thank you very much
Chunhao

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


Re: [R] R command history -- can it be like Matlab's?

2008-07-30 Thread Martin Maechler
 l == losemind  [EMAIL PROTECTED]
 on Tue, 29 Jul 2008 12:23:36 -0700 (PDT) writes:

l Hi all,

l In R GUI window, if you use up and down key, you will be able to 
recall
l the previous and next command that has been used and stored in the 
command
l history cache.

l But there is one inconvenience:

as Prof. Ripley said already, this is only an inconvenience for
those who are used aka addicted to such behavior

l In Matlab, you can type the first a few characters of the command that 
you
l previously used, 

l and then press “up key, you will be able to get to that previous command
l very fast,

l no matter how long ago it has been used...

no matter how long?  ...
  as of ten years ago ? 
 ;-) ;-)

Anyway --- as nobody said so till now, and the vi-aficionados
have already raised the flag --- I'd like to remark that
the behaviour you desire has been the default behavior in ESS
(The Emacs Speaks Statistics plugin for Emacs,
 http://ess.r-project.org/ ) for many months now.

l In R GUI, there is no such functionality.

l Any thoughts on making R work my productivity?

leaving R GUI for ESS  :-) :-)

For Windows, there's a very nice package of Emacs, bundled with
ESS (and AucTeX, *the* recommended LaTeX plugin for Emacs)
thanks to Vincent Goulet, at
http://vgoulet.act.ulaval.ca/en/ressources/emacs/

Martin Maechler, ETH Zurich

l --

l Also where do I find good debugger for R?

l Thanks!

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] What's the best way to operate R from within Excel?

2008-07-30 Thread Patrizio Frederic
have a look at

http://sunsite.univie.ac.at/rcom/server/doc/RExcel.html

regards,

PF

2008/7/30 losemind [EMAIL PROTECTED]:

 Hi all,

 How do I operate R from within Excel?

 I mean, highlight a bunch of cells, and send to R, and do some statistics in
 R, and return back the numbers and do some plots in R.

 For example, I have some parameters for Gaussian Random variable, and I
 would find the most convenient way to send these numbers to R and do some
 plots...

 How to do that?

 Thanks a lot!

 --
 View this message in context: 
 http://www.nabble.com/What%27s-the-best-way-to-operate-R-from-within-Excel--tp18722737p18722737.html
 Sent from the R help mailing list archive at Nabble.com.

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


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


[R] problem with nested loops

2008-07-30 Thread Jens Oldeland

Dear all,

I have a problem with constructing a nested loop.

I have two matrices:

pnr:
800 rows 14 columns

where rows are 40x20 meaning that 40 rows belong to one of twenty 
objects in the matrix pnr


mvp:
20 rows and 14 columns

I want to:
calculate a distance value with the first 40 rows of pnr but 20times 
with the 1st row of mvp


then the next 40 rows of pnr and 20times with the second row of mvp and 
so on. in total 20 times.


i tried with:


 dim(p)
[1] 800  14
 dim(mvp)
[1] 20 14

specdist -matrix(NA,nrow=40,ncol=20)

for (j in 1:40){
  for(i in 1:20){
specdist[j,i]-sqrt((pnr[i,1]-mvp[i,1])^2+(pnr[i,2]-mvp[i,2])^2)++(pnr[i,14]-mvp[i,14])^2))
}
}

but it only repeats from 1:40 and does not step from 41 to 80; from 81 
to 40 etc. certainly there is a if else next step?? or while 
missing, but I never implemented one of those. :(


I would be very grateful for any help!
thank you

Jens

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

2008-07-30 Thread renata.camargo05
Hello,

What the tilde and dot means? I believe is something to do with formula, but 
how do they work?

An example:
(fk5 ~ ., size = 10)

Do you know what the fk5 ~ . means?

Thank you!
Renata


-
Email sent from www.virginmedia.com/email
Virus-checked using McAfee(R) Software and scanned for spam

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


Re: [R] Re peated Measure ANOVA-Old question

2008-07-30 Thread Mark Difford

Hi Chunhao,

If you carefully read the posting that was referred to you will see that
lme() and not lmer() was used as an example (for using with the multcomp
package). lmer() was only mentioned as an aside... lmer() is S4 and doesn't
work with multcomp, which is S3.

Apropos of specifying random effects: an example was given in the posting
showing that aov(... +Error(...)) and lme(..., random =...) give the same
result. Use that as your guideline.

HTH, Mark.


ctu wrote:
 
 Tank you (Anna  Mark) very much for this super information
 Let me confirm that IF I want to perform the RM-ANOVA
 I should use lmer and perform the post-hoc test by using glht, right?
 
 Because I am not so familiar with lmer so I have two more questions.
 Let me use that following example again,
 1. Is the random effect statement correct? if no what will be?
 2. What did I do wrong in glht?
 
 
 require(lme4);require(nlme)
 group -rep(rep(1:2, c(5,5)), 3);time -rep(1:3, rep(10,3));subject -  
 rep(1:10,3)
 p.pa - c(92, 44, 49, 52, 41, 34, 32, 65, 47, 58, 94, 82, 48, 60, 47,
 46, 41, 73, 60, 69, 95, 53, 44, 66, 62, 46, 53, 73, 84, 79)
 P.PA - data.frame(subject, group, time, p.pa)
 P.PA$group=factor(P.PA$group);P.PA$time=factor(P.PA$time)
 P.PA$subject=factor(P.PA$subject)
 
 tlmer-lmer (p.pa ~ time * group + (time*group | subject), data=P.PA )
 
 summary(glht(tlmer,linfct=mcp(group=Tukey)))
 Error in UseMethod(fixef) : no applicable method for fixef
 In addition: Warning message
 
 Thank you very much
 Chunhao
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/Repeated-Measure-ANOVA-Old-question-tp18726146p18727795.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] Coarsening the Resolution of a Dataset

2008-07-30 Thread Steve Murray

Hi - thanks for the advice - I am however applying this to the whole data 
frame. And the code that I'm using is just to read in the data (using 
read.table) and then the code that you supplied. I could send you the actual 
dataset if you don't mind a file ~50MB?!

Thanks again,

Steve


 Date: Tue, 29 Jul 2008 15:34:31 -0400
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: Re: [R] Coarsening the Resolution of a Dataset
 CC: r-help@r-project.org
 
 I assume that you are doing this on one column of the matrix which
 should only have 2160 entries in it.  can you send the actual code you
 are using.  I tried it with 10,000 samples and it works fine.  So I
 need to understand the data structure you are using.  Also the
 infinite recursion sounds strange; do you have function like 'cut' or
 'c' redefined?  So it would help if you could supply a reproducible
 example.
 
 On Tue, Jul 29, 2008 at 10:09 AM, Steve Murray [EMAIL PROTECTED] wrote:
 
  Unfortunately, when I get to the 'myCuts' line, I receive the following 
  error:
 
  Error: evaluation nested too deeply: infinite recursion / 
  options(expressions=)?
 
  ...and I also receive warnings about memory allocation being reached (even 
  though I've already used memory.limit() to maximise the memory) - this is a 
  fairly sizeable dataset afterall, 2160 rows by 4320 columns.
 
  Therefore I was wondering if there are any alternative ways of coarsening a 
  dataset? Or are there any packages/commands built for this sort of thing?
 
  Any advice would be much appreciated!
 
  Thanks again,
 
  Steve
 
 
  _
  Find the best and worst places on the planet
  http://clk.atdmt.com/UKM/go/101719807/direct/01/
 
 
 
 -- 
 Jim Holtman
 Cincinnati, OH
 +1 513 646 9390
 
 What is the problem you are trying to solve?

_
100’s of Nikon cameras to be won with Live Search

[[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] Coarsening the Resolution of a Dataset

2008-07-30 Thread Steve Murray

Hi - thanks for the advice - I am however applying this to the whole data 
frame. And the code that I'm using is just to read in the data (using 
read.table) and then the code that you supplied. I could send you the actual 
dataset if you don't mind a file ~50MB?!

Thanks again,

Steve


 Date: Tue, 29 Jul 2008 15:34:31 -0400
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: Re: [R] Coarsening the Resolution of a Dataset
 CC: r-help@r-project.org

 I assume that you are doing this on one column of the matrix which
 should only have 2160 entries in it. can you send the actual code you
 are using. I tried it with 10,000 samples and it works fine. So I
 need to understand the data structure you are using. Also the
 infinite recursion sounds strange; do you have function like 'cut' or
 'c' redefined? So it would help if you could supply a reproducible
 example.

 On Tue, Jul 29, 2008 at 10:09 AM, Steve Murray  wrote:

 Unfortunately, when I get to the 'myCuts' line, I receive the following 
 error:

 Error: evaluation nested too deeply: infinite recursion / 
 options(expressions=)?

 ...and I also receive warnings about memory allocation being reached (even 
 though I've already used memory.limit() to maximise the memory) - this is a 
 fairly sizeable dataset afterall, 2160 rows by 4320 columns.

 Therefore I was wondering if there are any alternative ways of coarsening a 
 dataset? Or are there any packages/commands built for this sort of thing?

 Any advice would be much appreciated!

 Thanks again,

 Steve


 _
 Find the best and worst places on the planet
 http://clk.atdmt.com/UKM/go/101719807/direct/01/



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

 What is the problem you are trying to solve?

_
Play and win great prizes with Live Search and Kung Fu Panda

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Eclipse/Statet: How to set breakpoints

2008-07-30 Thread [EMAIL PROTECTED]

Hi,
I'm using the IDE Eclipse with the Statet-Plugin to develop R-code.
Is there a possibility to set breakpoints for debugging in R-script files
(just like in Java-code)?
Cheers,
Eli

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 command history -- can it be like Matlab's?

2008-07-30 Thread Gad Abraham

Prof Brian Ripley wrote:
A patch to do this was posted on 2007-09-29 by Glenn Davis.  Some people 
not addicted to Matlab find the behaviour very inconvenient and prefer 
the getline/readline behaviour (triggered by ^R/^S) of Rterm and R on 
Unixen.


Now that you've mentioned readline, it doesn't behave exactly the same 
in Bash and R: if you press ctrl-r and then ctrl-c in Bash, it breaks 
the search and you go back to the prompt as normal. In R on Linux (all 
versions I've tried, 2.2 to 2.7.1), doing that returns you to the prompt 
but you can't type anything, and the input buffer retains the text from 
the search, so pressing enter makes the historical command run again.


Try this:
 ls()
character(0)
[ctrl-r]
(reverse-i-search)`l': ls()
[ctrl-c, then enter]
 ls()
character(0)


--
Gad Abraham
Dept. CSSE and NICTA
The University of Melbourne
Parkville 3010, Victoria, Australia
email: [EMAIL PROTECTED]
web: http://www.csse.unimelb.edu.au/~gabraham

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

2008-07-30 Thread Kurapati, Ravichandra (Ravichandra)
Hi

 Can any body explain the meaning of the following R code

 

   if(interactive())

  stop(msg, call. = FALSE)

   else

quit()

 

Thanks

K.Ravichandra

 

 


[[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] Howto Draw Bimodal Gamma Curve with User Supplied Parameters

2008-07-30 Thread Patrizio Frederic
can you write the bimodal gamma pdf?
if so create your own pdf:

dbigamma=function(x,alpha1,alpha2,beta1,beta2)
{
# ... the bimodal gamma pdf (I can't find it)
}

hist(x,probability=T)
curve(dbigamma(x,alpha1,alpha2,beta1,beta2))

and look at the result

regards,

PF

2008/7/29 Gundala Viswanath [EMAIL PROTECTED]:
 Hi,

 Suppose I have the following vector (data points):
 x
  [1]  36.0  57.3  73.3  92.0 300.4  80.9  19.8  31.4  85.8  44.9  24.6  48.0
  [13]  28.0  38.3  85.2 103.6 154.4 128.5  38.3  72.4 122.7 123.1  41.8  21.7
  [25] 143.6 120.2  46.6  29.2  44.8  25.0  57.3  96.4  29.4  62.9  66.4  30.0
  [37]  24.1  14.8  56.6 102.4 117.5  90.4  37.2  79.6  27.8  17.1  26.6  16.3
  [49]  41.4  48.9  24.1  23.3   9.9  11.5  15.0  23.6  29.3  27.0  19.2  18.7
  [61]   4.1  13.0   3.3   5.5  38.2   8.5  39.6  39.2  16.1  35.3  23.3  31.5
  [73]  38.8  51.5  28.4  18.8  24.1  25.4  28.8  32.8  31.0  28.8  33.3  55.5
  [85]  39.2  21.0  43.7  16.3  50.6  34.6  66.3  50.5  59.4  46.7  51.9 125.6
  [97]  69.8  43.7  86.8  50.6 132.4  56.0   6.1   4.9   7.1   7.1  12.8  12.1
 [109] 164.2  69.3  15.6  11.4  34.3   9.2  17.6  21.7  19.2  30.7  61.1  35.8
 [121] 185.8 118.4  13.0   9.6  19.1  45.2  94.5 248.0  56.3  24.4  13.8  12.8
 [133]  35.0  31.6  22.5  50.1  18.7  22.1  28.3  39.5  48.2  33.1  43.5  35.1
 [145]  37.4  30.3  15.8  13.9  15.3  16.1  12.7  11.4  13.0  13.8  31.5  25.3
 [157]  65.2  39.5


 And the following parameter set (2 component) for gamma function.

 comp.1comp.2
 alpha (shape)  2.855444  2.152056
 beta  (scale)   10.418785 39.296224

 These params are predefined/precalculated by user.

 My question is how can I create a bimodal gamma curve - based on the
 two parameter set -
 on top of the histogram of data points above?

 - Gundala Viswanath
 Jakarta - Indonesia

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

2008-07-30 Thread renata.camargo05
Hello,

Can someone help me to understand the meaning of the following R line?

list(fk5 ~ .)

Thanks, Renata

-
Email sent from www.virginmedia.com/email
Virus-checked using McAfee(R) Software and scanned for spam

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


Re: [R] R command history -- can it be like Matlab's?

2008-07-30 Thread bartjoosen

Here is the post where Prof Ripley is reffering to:
http://tolstoy.newcastle.edu.au/R/e2/help/07/09/26668.html


Bart


losemind wrote:
 
 
 
 Prof Brian Ripley wrote:
 
 A patch to do this was posted on 2007-09-29 by Glenn Davis.  Some people 
 not addicted to Matlab find the behaviour very inconvenient and prefer
 the 
 getline/readline behaviour (triggered by ^R/^S) of Rterm and R on Unixen.
 
 On Tue, 29 Jul 2008, losemind wrote:
 

 Hi all,

 In R GUI window, if you use up and down key, you will be able to
 recall
 the previous and next command that has been used and stored in the
 command
 history cache.

 But there is one inconvenience:
 
 Or an inconvenience of Matlab not shared by R, depending on your 
 preferences.
 
 In Matlab, you can type the first a few characters of the command that
 you
 previously used,

 and then press “up key, you will be able to get to that previous
 command
 very fast,

 no matter how long ago it has been used...

 In R GUI, there is no such functionality.

 Any thoughts on making R work my productivity?

 --

 Also where do I find good debugger for R?

 Thanks!
 -- 
 View this message in context:
 http://www.nabble.com/R-command-historycan-it-be-like-Matlab%27s--tp18719530p18719530.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.

 
 -- 
 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.
 
 
 
 
 
 Hi,
 
 I don't find Glenn Davis's patch... where is it?
 
 I like that Matlab feature. And I am using R GUI on windows...
 
 Please help me!
 
 Please also give me pointers to good R debuggers?
 
 Thanks!
 
 

-- 
View this message in context: 
http://www.nabble.com/R-command-historycan-it-be-like-Matlab%27s--tp18719530p18728916.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] Need help

2008-07-30 Thread Richard . Cotton
 Can someone help me to understand the meaning of the following R line?
 
 list(fk5 ~ .)
fk5 ~. is a formula, most likely used by a regression (or similar model). 
fk5 is the response variable, and the dot is a placeholder for 'whatever 
was on that side of the formula before'.  (This is usually used for 
updating models.)  list() places the formula in a list, obviously.  It's 
hard to provide more meaning without the context.

(Also, mailing list etiquette suggests you should provide a more 
informative subject line than 'need help'.)

Regards,
Richie.

Mathematical Sciences Unit
HSL



ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 peated Measure ANOVA-Old question

2008-07-30 Thread Gavin Simpson
On Wed, 2008-07-30 at 00:49 -0700, Mark Difford wrote:
 Hi Chunhao,
 
 If you carefully read the posting that was referred to you will see that
 lme() and not lmer() was used as an example (for using with the multcomp
 package). lmer() was only mentioned as an aside... lmer() is S4 and doesn't
 work with multcomp, which is S3.

That is not true (but it may once have been?). multcomp ``suggests''
lme4 and is distributed with a vignette that has a lmer example with the
same random effect expression as the R-Help thread you directed the OP
to read.

The OP's example works for me with latest CRAN versions of multcomp,
lme4 and Matrix installed (well, with a warning about false convergence
from nlminb in the lmer call and a warning from the call to glht about
the covariate interaction and questioning if the default contrasts are
appropriate - all things for Chunhao to consider himself me thinks...).

Chunhoa, I'm not familiar enough with lme4 to know what is the correct
way to specify the random effects you want. You could consider moving
this onto the R-mixed-models SIG:

https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

or search the archives of that list as lmer/lm4 are discussed there
quite a lot.

HTH

G

 
 Apropos of specifying random effects: an example was given in the posting
 showing that aov(... +Error(...)) and lme(..., random =...) give the same
 result. Use that as your guideline.
 
 HTH, Mark.
 
 
 ctu wrote:
  
  Tank you (Anna  Mark) very much for this super information
  Let me confirm that IF I want to perform the RM-ANOVA
  I should use lmer and perform the post-hoc test by using glht, right?
  
  Because I am not so familiar with lmer so I have two more questions.
  Let me use that following example again,
  1. Is the random effect statement correct? if no what will be?
  2. What did I do wrong in glht?
  
  
  require(lme4);require(nlme)
  group -rep(rep(1:2, c(5,5)), 3);time -rep(1:3, rep(10,3));subject -  
  rep(1:10,3)
  p.pa - c(92, 44, 49, 52, 41, 34, 32, 65, 47, 58, 94, 82, 48, 60, 47,
  46, 41, 73, 60, 69, 95, 53, 44, 66, 62, 46, 53, 73, 84, 79)
  P.PA - data.frame(subject, group, time, p.pa)
  P.PA$group=factor(P.PA$group);P.PA$time=factor(P.PA$time)
  P.PA$subject=factor(P.PA$subject)
  
  tlmer-lmer (p.pa ~ time * group + (time*group | subject), data=P.PA )
  
  summary(glht(tlmer,linfct=mcp(group=Tukey)))
  Error in UseMethod(fixef) : no applicable method for fixef
  In addition: Warning message
  
  Thank you very much
  Chunhao
  
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
  
  
 
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Coarsening the Resolution of a Dataset

2008-07-30 Thread jim holtman
Can you at least send the output from the script so that we can see
exactly how you are reading in the data and then processing it.  Doing
'str(yourData)' would help to understand what the data looks like.
The exactly error messages would also help.  Is the data entirely
numeric, or does it also contain factors?  So this type of information
is needed to understand the context of where your problem is.

On Wed, Jul 30, 2008 at 4:09 AM, Steve Murray [EMAIL PROTECTED] wrote:

 Hi - thanks for the advice - I am however applying this to the whole data 
 frame. And the code that I'm using is just to read in the data (using 
 read.table) and then the code that you supplied. I could send you the actual 
 dataset if you don't mind a file ~50MB?!

 Thanks again,

 Steve


 Date: Tue, 29 Jul 2008 15:34:31 -0400
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: Re: [R] Coarsening the Resolution of a Dataset
 CC: r-help@r-project.org

 I assume that you are doing this on one column of the matrix which
 should only have 2160 entries in it. can you send the actual code you
 are using. I tried it with 10,000 samples and it works fine. So I
 need to understand the data structure you are using. Also the
 infinite recursion sounds strange; do you have function like 'cut' or
 'c' redefined? So it would help if you could supply a reproducible
 example.

 On Tue, Jul 29, 2008 at 10:09 AM, Steve Murray  wrote:

 Unfortunately, when I get to the 'myCuts' line, I receive the following 
 error:

 Error: evaluation nested too deeply: infinite recursion / 
 options(expressions=)?

 ...and I also receive warnings about memory allocation being reached (even 
 though I've already used memory.limit() to maximise the memory) - this is a 
 fairly sizeable dataset afterall, 2160 rows by 4320 columns.

 Therefore I was wondering if there are any alternative ways of coarsening a 
 dataset? Or are there any packages/commands built for this sort of thing?

 Any advice would be much appreciated!

 Thanks again,

 Steve


 _
 Find the best and worst places on the planet
 http://clk.atdmt.com/UKM/go/101719807/direct/01/



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

 What is the problem you are trying to solve?

 _
 Play and win great prizes with Live Search and Kung Fu Panda
 http://clk.atdmt.com/UKM/go/101719966/direct/01/



-- 
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] need some help

2008-07-30 Thread jim holtman
I assume that it is testing to see if you are in the interactive mode
(typically using RGUI or Rterm) and not a batch file.  If it is
interactive, it issues a 'stop' (this lets the person take action on
the problem).  If in the batch, it just terminates the execution of
the script.

On Wed, Jul 30, 2008 at 4:44 AM, Kurapati, Ravichandra (Ravichandra)
[EMAIL PROTECTED] wrote:
 Hi

 Can any body explain the meaning of the following R code



   if(interactive())

  stop(msg, call. = FALSE)

   else

quit()



 Thanks

 K.Ravichandra






[[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] problem with nested loops

2008-07-30 Thread Kenn Konstabel
What you need is chapter 9 in
http://cran.r-project.org/doc/manuals/R-intro.pdf . And you could also use
chapter 2, especially 2.2.

 specdist -matrix(NA,nrow=40,ncol=20)

 for (j in 1:40){
  for(i in 1:20){

specdist[j,i]-sqrt((pnr[i,1]-mvp[i,1])^2+(pnr[i,2]-mvp[i,2])^2)++(pnr[i,14]-mvp[i,14])^2))
 }
 }
 but it only repeats from 1:40 and does not step from 41 to 80; from 81 to
40 etc. certainly there is a if else next step?? or while
 missing, but I never implemented one of those. :(

It does exactly what you've told it to do. And if(you really insist on using
loops) it would be easy to add another loop that would go from 0 to 40 to 80
etc:
for(another.unnecessary.loop in seq(0,800,40){ # and now add that one to i
for pnr

And things like dist() might make calculating distance matrices /see:
help(dist) / a bit easier. As you see from documentation, it calculates
distances between rows of a matrix; so you can first rbind your 2 matrices,
then use dist, and then extract the part you want. Or at least you might
want to consider making your calculations simpler by using vectors in a
decent way:

sqrt(sum((pnr[i,]-mvp[i,])^2 ))   # instead of adding them one by one

good luck,
Kenn

On Wed, Jul 30, 2008 at 10:49 AM, Jens Oldeland [EMAIL PROTECTED] wrote:

 Dear all,

 I have a problem with constructing a nested loop.

 I have two matrices:

 pnr:
 800 rows 14 columns

 where rows are 40x20 meaning that 40 rows belong to one of twenty objects
 in the matrix pnr

 mvp:
 20 rows and 14 columns

 I want to:
 calculate a distance value with the first 40 rows of pnr but 20times with
 the 1st row of mvp

 then the next 40 rows of pnr and 20times with the second row of mvp and so
 on. in total 20 times.

 i tried with:


  dim(p)
 [1] 800  14
  dim(mvp)
 [1] 20 14

 specdist -matrix(NA,nrow=40,ncol=20)

 for (j in 1:40){
  for(i in 1:20){

 specdist[j,i]-sqrt((pnr[i,1]-mvp[i,1])^2+(pnr[i,2]-mvp[i,2])^2)++(pnr[i,14]-mvp[i,14])^2))
 }
 }

 but it only repeats from 1:40 and does not step from 41 to 80; from 81 to
 40 etc. certainly there is a if else next step?? or while missing,
 but I never implemented one of those. :(

 I would be very grateful for any help!
 thank you

 Jens

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


[[alternative HTML version deleted]]

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


[R] read XML

2008-07-30 Thread Paulo Cardoso
I have a xml exported by Manifold GIS but I'm not being able to import it
into R using XLM package.

 

The file have this structure:

 

  ?xml version=1.0 encoding=UTF-8 ? 

- layout

  nameLayout 2/name 

  pagesByX1/pagesByX 

  pagesByY1/pagesByY 

- elements

  legend refParent=r3 xmax=0.54156171284634758
xmin=0.020151133501259435 ymax=0.31480598161051165
ymin=0.042461931948864044 / 

  component background=auto border=none borderDegMinSec=false
borderEachPage=true borderFont=Tahoma, 8 borderFore=#00
borderMargin=12 borderNoOverlaps=true borderRounding=0 borderStep=1
borderUnit=Meter controlPoints=auto graticule=auto grid=auto
legend=auto name=MapMnaziBayhab northArrow=auto paging=continuous
ref=r1 scaleBar=auto scope=locked center / scale
scopeDetail=646802.61034615175,8856311.5759953968,150
xmax=0.35877862595419846 xmin=0.027989821882951665
ymax=0.98902384414662947 ymin=0.32371064328183174 / 

  component background=auto border=none borderDegMinSec=false
borderEachPage=true borderFont=Tahoma, 8 borderFore=#00
borderMargin=12 borderNoOverlaps=true borderRounding=0 borderStep=1
borderUnit=Meter controlPoints=auto graticule=auto grid=auto
legend=hide name=MapMnaziBayall northArrow=auto paging=continuous
ref=r3 scaleBar=auto scope=locked center / scale
scopeDetail=646802.61034615175,8856311.5759953968,150
xmax=0.707379134860051 xmin=0.37659033078880411
ymax=0.98902384414662947 ymin=0.32371064328183174 / 

  component background=auto border=none borderDegMinSec=false
borderEachPage=true borderFont=Tahoma, 8 borderFore=#00
borderMargin=12 borderNoOverlaps=true borderRounding=0 borderStep=1
borderUnit=Degree controlPoints=auto graticule=auto grid=auto
legend=auto name=Map Africa Mnazi northArrow=auto paging=continuous
ref=r6 scaleBar=auto scope=entire component xmax=0.93198992443324935
xmin=0.73047858942065491 ymax=0.98902384414662947
ymin=0.84662172667648694 / 

  /elements

  /layout

 

Any idea?

 

Thanks.

 

Paulo Cardoso


[[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] function to transform response of a formula

2008-07-30 Thread Paul Emberson

Hi,

I am trying to write a function which takes a formula as input and 
outputs a new formula with a different response while keeping the rest 
of the formula the same.


I.e.

respapply : ( y ~ a+b ) - ( f(y) ~ a + b )

I have tried the following but it doesn't work.  The terms become 
invalid as shown below.


respapply - function(fm, f) {

fm[[2]] - f(eval(fm[[2]]))
fm;

}

 fm - formula(y ~ a + b)
 y - runif(5)
 newfm - respapply(fm,identity)
 newfm

c(0.552921097259969, 0.939932722365484, 0.62522904924117, 
0.899310540175065,

0.877736972644925) ~ a + b

 terms(newfm)
Error in terms.formula(fmapply(fm, identity)) :
  invalid term in model formula

Could someone put me in the right direction of how to correctly write a 
respapply function as described.


Regards,

Paul Emberson

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

2008-07-30 Thread Birgitle

I am sorry I just found the stupid mistake.

I did not specify dec=, because I usually use . 

Anyway thanks for having the opportunity to get help in this list.

B.


Birgitle wrote:
 
 Hello R-User
 
 I have a table as tab-delimited textfile (291 rows, 83 columns).
 The first row are labels and the first line the variable names.
 
 I used the following code several times with different similar tables and
 it always worked.
 But now:
 
setClass(of)
setAs(character, of, function(from) as.ordered(from))
 
   Classe82-cclasses - c(rep(factor, 63),  rep(numeric,7), rep (of,
 12))
   Table-read.table(Table.txt,header=TRUE,row.names=1, na.strings=NA
 ,colClasses = Classe82)
 
 I get this error-message:
 
   Fehler in scan(file, what, nmax, sep, dec, quote, skip, nlines,
 na.strings,  : 
   scan() erwartete 'a real', bekam '8,5'
 
   Error in scan(file, what, nmax, sep, dec, quote, skip, nlines,
 na.strings,  : 
   scan()  expected 'a real', got '8,5'
 
 It seems that the error is in the colClasses-argument. Without this
 argument it reads the table.
 I checked allready if there are empty cells or blanks in the header but
 could not find.
 Maybe that its just a simple thing and I know that I can change the
 classes after reading in the table, but I really would like to know how to
 do this right.
 
 I would be very glad if somebody has an idea, or could tell me, how I
 could find out, what`s going wrong.
 
 Many thanks in advance
 
 B.
 


-
The art of living is more like wrestling than dancing.
(Marcus Aurelius)
-- 
View this message in context: 
http://www.nabble.com/problem-with-read.table%28%29-tp18729348p18729917.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] problem with read.table()

2008-07-30 Thread Philipp Pagel
   Table-read.table(Table.txt,header=TRUE,row.names=1, na.strings=NA
 ,colClasses = Classe82)
 
 
   Fehler in scan(file, what, nmax, sep, dec, quote, skip, nlines,
 na.strings,  : 
   scan() erwartete 'a real', bekam '8,5'
 
   Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, 
 : 
   scan()  expected 'a real', got '8,5'

It looks like your tab separated file uses ',' as a decimal point
(german convention) while read.table expects '.'. Try giving the dec=,
option to read.table.

cu
Philipp

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

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


[R] Bizarre - R crashes on merge

2008-07-30 Thread Williams, Robin
Hi all, 
  I have a large data.frame, 1530 observation with 6 columns. I want to
merge a 7th column, a transformation of the response variable (hospital
admissions), namely 
trans-sqrt(copd$admissions+0.25)
trans-data.frame(trans)
And now when I do 
copd2-merge(copd,trans)
(copd being my original data.frame), R either crashes or is taking an
extremely long time to do the computation. I had expected the
computation to be done almost instantly as I have done similar things in
R recently, however my system becomes very slow to the point of being
unusable. Would people expect this computation to take a long time? Most
of the data in the data.frame are just integers.
  I want to perform linear regression on the data trans, so I would like
it in the data.frame to save typing.
Any ideas?
 

Robin Williams
Met Office summer intern - Health Forecasting
[EMAIL PROTECTED] 

 

[[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] Need help

2008-07-30 Thread Prof Brian Ripley

See

?formula
?terms.formula

or ask the author of the line (it doesn't make much sense to use '.' 
unless you have a 'data' argument to pass to terms()).


On Wed, 30 Jul 2008, [EMAIL PROTECTED] wrote:


Hello,

Can someone help me to understand the meaning of the following R line?

list(fk5 ~ .)

Thanks, Renata

-
Email sent from www.virginmedia.com/email
Virus-checked using McAfee(R) Software and scanned for 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.



--
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] Need help

2008-07-30 Thread Prof Brian Ripley

On Wed, 30 Jul 2008, [EMAIL PROTECTED] wrote:


Can someone help me to understand the meaning of the following R line?

list(fk5 ~ .)

fk5 ~. is a formula, most likely used by a regression (or similar model).
fk5 is the response variable, and the dot is a placeholder for 'whatever
was on that side of the formula before'.  (This is usually used for
updating models.)


That's the meaning only for update.formula() AFAIK: the far more common 
meaning is given in ?terms.formula.



list() places the formula in a list, obviously.  It's
hard to provide more meaning without the context.

(Also, mailing list etiquette suggests you should provide a more
informative subject line than 'need help'.)

Regards,
Richie.

Mathematical Sciences Unit
HSL


--
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] Eclipse/Statet: How to set breakpoints

2008-07-30 Thread Duncan Murdoch

On 30/07/2008 4:28 AM, [EMAIL PROTECTED] wrote:

Hi,
I'm using the IDE Eclipse with the Statet-Plugin to develop R-code.
Is there a possibility to set breakpoints for debugging in R-script files
(just like in Java-code)?


I believe the answer is no, but R does contain (some of?) the necessary 
infrastructure to add that.  It will just take some time, and some happy 
coincidences.  (I don't know StatET, so I'll need to learn what it needs.)


Duncan Murdoch

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


Re: [R] Bizarre - R crashes on merge

2008-07-30 Thread Philipp Pagel
   I have a large data.frame, 1530 observation with 6 columns. I want to
 merge a 7th column, a transformation of the response variable (hospital
 admissions), namely 
 trans-sqrt(copd$admissions+0.25)
 trans-data.frame(trans)
 And now when I do 
 copd2-merge(copd,trans)
 (copd being my original data.frame), R either crashes or is taking an
 extremely long time to do the computation. I had expected the
 computation to be done almost instantly as I have done similar things in
 R recently, however my system becomes very slow to the point of being
 unusable.

If I understand correctly, all you want to do is add another column to
your data.frame. Unless I have overlooked something, a simple
assignement should do:

copd$trans - copd$admissions+0.25

The reason your computation takes long/crashes is that you are merging
two data frames which have no common columns to merge on. So merge() is
generating all possible combinations for you.

 a = data.frame(1:3)
 b = data.frame(4:6)
 merge(a,b)
  X1.3 X4.6
114
224
334
415
525
635
716
826
936

This is most likely not what you intended. I guess you were looking for
cbind() rather than merge()

cu
Philipp


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

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


Re: [R] table questions

2008-07-30 Thread Jim Lemon
On Tue, 2008-07-29 at 11:28 -0500, Edna Bell wrote:
 Hi again!
 
 
 Suppose I have the following:
 
  xy - round(rexp(20),1)
  xy
  [1] 0.1 3.4 1.6 0.4 1.0 1.4 0.2 0.3 1.6 0.2 0.0 0.1 0.1 1.0 2.0 0.9
 2.5 0.1 1.5 0.4
  table(xy)
 xy
   0 0.1 0.2 0.3 0.4 0.9   1 1.4 1.5 1.6   2 2.5 3.4
   1   4   2   1   2   1   2   1   1   2   1   1   1
 
 Is there a way to set things up to have
 0 - 0.4   0.5 - 0.9  etc. please?
 
 I know there is the cut functions, but breaks are required.  If you
 don't have breaks, what should you do, please?
 
 Would using the breaks from the hist function work appropriately, please?
 
Well, Edna, this looked like fun, so here is something that may help you
out.

lumpyTable-function(x,breaks) {
 xcounts-hist(x,breaks=breaks,plot=FALSE)$counts
 nbreaks-length(breaks)
 binnames-paste(breaks[1:(nbreaks-1)],
  breaks[2:nbreaks],sep=-,collapse=\t)
 cat(binnames,\n,paste(xcounts,collapse=\t),\n)
}
xy-round(rexp(20),1)
lumpyTable(xy,c(0,0.5,1,2,4))

Jim

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


[R] glm error: factor levels

2008-07-30 Thread Birgitle

Hello R-Users, again me!

I have a data.frame with 291 rows, 82 columns. 
Tha variables in the columns are factors, numerics and ordered factors.

The response variable is a factor with two levels.

I would like to find the best model by trying every possible variable
combination using a logistic regression and comparing the AIC (still have to
find out how to do this fast and easy).
I am aware of the step function but would like to do it also without step.

But unfortunatley I have allready a problem with the first model using all
variables:

   df.glm-glm(RespVar~.,family=binomial,data=df)

I get back this:

   Fehler in `contrasts-`(`*tmp*`, value = contr.treatment) : 
   Kontraste können nur auf Faktoren mit 2 oder mehr Stufen angewendet
werden

   Error in `contrasts-`(`*tmp*`, value = contr.treatment) :
   contrasts can only be used for factors with two or more levels

There are no variables with less than two levels in my data.frame but here
are missing values (NA).
I could imagine that some observations are deleted due to missingness and
perhaps after that, some of the variables contain only one level.

I would be happy if somebody could tell me if my speculation could be true
and perhaps also how I could find out which variables I have to delete to
avoid this problem.

Many thanks in advance.

B.


-
The art of living is more like wrestling than dancing.
(Marcus Aurelius)
-- 
View this message in context: 
http://www.nabble.com/glm-error%3A-factor-levels-tp18730487p18730487.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] function to transform response of a formula

2008-07-30 Thread email

Its ok.

I've just read about update.formula in another message.

Paul

Paul Emberson wrote:

Hi,

I am trying to write a function which takes a formula as input and 
outputs a new formula with a different response while keeping the rest 
of the formula the same.


I.e.

respapply : ( y ~ a+b ) - ( f(y) ~ a + b )

I have tried the following but it doesn't work.  The terms become 
invalid as shown below.


respapply - function(fm, f) {

fm[[2]] - f(eval(fm[[2]]))
fm;

}

  fm - formula(y ~ a + b)
  y - runif(5)
  newfm - respapply(fm,identity)
  newfm

c(0.552921097259969, 0.939932722365484, 0.62522904924117, 
0.899310540175065,

0.877736972644925) ~ a + b

  terms(newfm)
Error in terms.formula(fmapply(fm, identity)) :
  invalid term in model formula

Could someone put me in the right direction of how to correctly write a 
respapply function as described.


Regards,

Paul Emberson

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

2008-07-30 Thread Philipp Pagel
On Wed, Jul 30, 2008 at 12:24:22PM +0200, Philipp Pagel wrote:
 If I understand correctly, all you want to do is add another column to
 your data.frame. Unless I have overlooked something, a simple
 assignement should do:
 
 copd$trans - copd$admissions+0.25

Sorry, that should have been:

copd$trans - sqrt(copd$admissions+0.25)


cu
Philipp

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

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


[R] png() does not generate a 24 bit PNG file

2008-07-30 Thread Fán Lóng
Hi there,

When I am using the png() function as the following to generate a png
file on Mac OSX Tiger, I found that the bit depth is 32.  But I want a
24 bit depth png. What should I do?

 png(filename=/Users/usg/Desktop/new.png)
 plot(1:20)
 dev.off()


To avoid using cairo, and R-2.7.0 does not find a Xlib on my Mac, I
also tried this one:
 png(filename=/Users/usg/Desktop/new.png, type =quartz )
 plot(1:20)
 dev.off()

It does not work, either.

The manual says png will use a palette if there are less than 256
colours on the page, and record a 24-bit RGB file otherwise (or a
32-bit RGBA file if type = cairo and non-opaque colours are used).
I don't want to set palette less than 256 colours, I just want a
24-bit png file.

Could anyone help me?


Thanks in advance.
Long

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] FFT - (STATS) - is this correct?

2008-07-30 Thread renata.camargo05
Hello,

I have calculated the fourier transform of the series enclosed at the end of 
this message, by doing:
 
library(stats)
x - readLines(file1.txt)
x.num - as.numeric(x)
ft.x.num - fft(x.num)

My question is: why is the first value (Real) of ft.x.num that big? 
(954.833870) all the other values are much smaller. Am I doing something wrong?

Could you please help me to understand that?

Many thanks, Renata

2.24791
6.39824
7.43533
7.21367
11.2164
7.29183
9.72807
12.8445
12.4819
8.18952
6.38345
9.98463
6.25724
7.97327
8.9676
8.27709
14.8272
13.4908
11.876
11.4889
11.3161
9.79778
8.09873
4.43935
5.30657
9.37819
0
8.09507
10.9567
10.5478
12.6661
13.8612
14.025
13.9403
11.5847
9.50861
7.81196
5.4
5.27313
4.16159
3.83932
8.95892
11.9548
12.7598
11.6816
13.3388
13.1956
9.50887
12.4671
11.2608
12.6553
5.63253
4.18556
4.47097
9.13142
5.29101
11.3582
7.5489
13.0371
9.26487
11.6458
6.26179
10.4051
11.7282
9.36171
10.7723
4.90151
4.25747
6.95437
6.17832
11.59
13.894
10.8935
8.19078
6.27219
6.74875
10.076
6.47078
11.1408
6.48286
10.4232
9.23548
11.199
7.97828
13.1261
12.1624
7.90476
11.7495
14.0312
9.97212
11.3685
12.6093
4.68484
4.72131
5.10963
8.1693
8.21239
10.6743
5.39084
11.1944
12.4415
8.0419
5.62567
12.2756
0


-
Email sent from www.virginmedia.com/email
Virus-checked using McAfee(R) Software and scanned for spam

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


Re: [R] placing a text in the corner of a plot

2008-07-30 Thread Jim Lemon
On Wed, 2008-07-30 at 00:04 +0200, Jörg Groß wrote:
 Is there an easy way to add a text into an R-plot and place it in the  
 upper left corner?
 
 Like that:
 
 
 
 |  (a)  |
 | |
 | |
 | |
 | |
 | |
 
 
 The (a) should be at the borders of a box defined by the box()-command.
 
Hi Jorg,
Maybe the corner.label function in plotrix will do what you want.

Jim

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


Re: [R] Eclipse/Statet: How to set breakpoints

2008-07-30 Thread Duncan Murdoch

On 7/30/2008 7:15 AM, [EMAIL PROTECTED] wrote:

Hi Duncan,
thank you for your fast answering. Is there any function implemented in 
R to stop it?
(something like q() but i only want to stop a script not shutdown the 
whole R-console at a certain point)

That would be a good alternative for  breakpoints in Eclipse...


A call to browser() will pause execution, let you examine and change 
local variables, etc.


A few years ago I put together a web page of debugging tips; it's still 
online at www.stats.uwo.ca/faculty/murdoch/software/debuggingR.  I think 
most of the information is still current, though I haven't reviewed it 
in a while.


Duncan Murdoch


Best,
Eli



Duncan Murdoch schrieb:

On 30/07/2008 4:28 AM, [EMAIL PROTECTED] wrote:

Hi,
I'm using the IDE Eclipse with the Statet-Plugin to develop R-code.
Is there a possibility to set breakpoints for debugging in R-script 
files

(just like in Java-code)?


I believe the answer is no, but R does contain (some of?) the 
necessary infrastructure to add that.  It will just take some time, 
and some happy coincidences.  (I don't know StatET, so I'll need to 
learn what it needs.)


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] dens function

2008-07-30 Thread Shubha Vishwanath Karanth
Hi R,

 

Is there a function called dens in R? Is it similar to density? I
found this function in an RExcel demo... Or is it in a specific other
package? The function is used as (=rapply(dens,A11:A1010,100,D8,-5,5))

 

 

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.


[R] Connecting R to PostgreSQL on Windows.

2008-07-30 Thread Andre Cesta

Hi All,

It took me 30minutes to connect GNU R on Windows XP to a PostgreSQL database 
running on the same machine and then generate the first graphics.  

I've taken screenshots of all the steps and documented them here:
http://code.google.com/p/jwanalytics/wiki/GnuRe

Thanks for making it easy to do it.  The help files within GNU R are excellent 
quality.

Best regards, André


Andre Cesta, Eng, MSc, SCJP, SCJA
http://geocities.com/aacesta



  __
Not happy with your email address?.
Get the one you really want - millions of new email addresses avail
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Mixed effects model where nested factor is not the repeated across treatments lme???

2008-07-30 Thread M Ensbey
Hi,

 

I have searched the archives and can't quite confirm the answer to this.
I appreciate your time...

 

I have 4 treatments (fixed) and I would like to know if there is a
significant difference in metal volume (metal) between the treatments.
The experiment has 5 blocks (random) in each treatment and no block is
repeated across treatments. Within each plot there are varying numbers
of replicates (random) (some plots have 4 individuals in them some have
14 and a range in between). NOTE the plots in one treatment are not
replicated in the others.

 

So I end up with a data.frame with 4 treatments repeated down one column
(treatment=A, B, C, D), 20 plots repeated down the next (block= 1 to 20)
and records for metal volume (metal- 124 of these)

I have made treatment and block a factor. But haven't grouped them (do I
need to and how if so)

 

The main question is in 3 parts:

 

1.  is this the correct formula to use for this situation:
lme1-lme(metal~treatment,data=data,random=~1|block) (or is lme even the
right thing to use here?)

 

I get:

 summary(lme1)

Linear mixed-effects model fit by REML

 Data: data 

   AIC  BIClogLik

  365.8327 382.5576 -176.9163

 

Random effects:

 Formula: ~1 | block

(Intercept)  Residual

StdDev:   0.4306096 0.9450976

 

Fixed effects: Cu ~ Treatment 

 Value Std.Error  DF   t-value p-value

(Intercept)   5.587839 0.2632831 104 21.223688  0. ***

TreatmentB -0.970384 0.3729675  16 -2.601792  0.0193 ***

TreatmentC  -1.449250 0.3656351  16 -3.963651  0.0011 ***

TreatmentD  -1.319564 0.3633837  16 -3.631323  0.0022 ***

 Correlation: 

 (Intr) TrtmAN TrtmCH

TreatmentB -0.706  

TreatmentC  -0.720  0.508   

TreatmentD  -0.725  0.511  0.522

 

Standardized Within-Group Residuals:

Min  Q1 Med  Q3 Max 

-2.85762206 -0.68568460 -0.09004478  0.56237152  3.20650288 

 

Number of Observations: 124

Number of Groups: 20

 

2.  if so how can I get p values for comparisons between every
group... ie is A different from B, is A different from C, is A different
from D, is B different from C, is B different from D etc... is there a
way to get all of these instead of just is A different from B, is A
different from C, is A different from D which summary seems to give?
3.  last of all what is the best way to print out all the residuals
for lme... I can get qqplot(lme1) is there a pre-programmed call for
multiple diagnostic plots like in some other functions...

 

 

Thankyou so Much for your time

 

It is much appreciated

;-)

 

Miki

 


[[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] Successfully connected GNU R to PostgreSQL on windows XP.

2008-07-30 Thread Andre Cesta

Hi All,

I guess it is also important to write when you did not have any problems doing 
something.

This morning it took me 30minutes to connect GNU R on Windows XP to a 
PostgreSQL database running on the same machine and then generate the first 
graphics.  

I've taken screenshots of all the steps and documented them here:
http://code.google.com/p/jwanalytics/wiki/GnuRe

Thanks for making it easy to do it.  The help files within GNU R are excellent 
quality.

Best regards, André


Andre Cesta, Eng, MSc, SCJP, SCJA
http://geocities.com/aacesta



  __
Not happy with your email address?.
Get the one you really want - millions of new email addresses avail
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 GUI help

2008-07-30 Thread Tom.O

Hi R gurus
Im currently doing some GUI coding with the rpanel package. I have come
across a very interesting problem, how do I close a panel that I have
created. This sounds silly for I can always click the X up in the right
corner but how do I do it by code?

for example; when I create a control I know the objects name.

test = rp.control()
and test will have this format '.rpanel', but can I call the control
ID and close the object?

Regards Tom

-- 
View this message in context: 
http://www.nabble.com/R-GUI-help-tp18729462p18729462.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] adding lines to multiple plots

2008-07-30 Thread Gary W

Hi 

I am trying to add density lines to multiple histograms created using R.  I
have managed to get all 18 lines on the last histogram in the series,
however, i cannot figure out how to get each line appear on the correct
histogram plot.  I know in Matlab there is a hold function, is there
something similar in R?

the following is the code i have used to get mutiple plots and then add all
the lines to the final plot:

##find unique column names in table
variablenames-unique(names(variables))
## define number of unique names
Nvariables-length(variablenames)
##for loop required for labelling of histograms and to tell how many hist to
make
for(i in 1:Nvariables){
par(mfrow=c(1,1),ask=TRUE)
} 
##use lapply for dataframes creates hist for each variable and labels
corresponding
##important to have this outside of loop
lapply(names(variables),function(i)hist(variables[[i]],probability=T,main=paste(Histogram
of,i),
xlab=paste(i)))
for(i in 1:Nvariables){
lines(density(variables[[i]],lwd=2))
}

I am pretty sure its a simple explanation, i have just run out of ideas.

Thanks

gary Watmough
PhD Student
University of Southamton
School of Geography
-- 
View this message in context: 
http://www.nabble.com/adding-lines-to-multiple-plots-tp18730581p18730581.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] Re creating Procrustes Plot in Lattice

2008-07-30 Thread Andrewjohnclose

Hi, I have been trying to create a function to generate a Procrustes plot,
generated from package vegan
in lattice.

standard vegan code as follows
library(vegan)
pro=protest(P1, P8, permutations=4999,choices=1:4)
plot(pro) 

Now, here is the code for the function that I have failed to get to work
properly.

panel.procrustes=function(x,y)
}Pro=protest(x,y,permutations=4999,choices=1:4)
Proplot=plot(Pro)
}
xyplot(P1[1:4]~P8[1:4],panel=panel.procrustes)

I can generate an empty plot, but not much else - hope someone can help and
point out the obvious!

Kind regards

Andrew http://www.nabble.com/file/p18731653/P1.csv P1.csv 
http://www.nabble.com/file/p18731653/P8.csv P8.csv 
-- 
View this message in context: 
http://www.nabble.com/Recreating-Procrustes-Plot-in-Lattice-tp18731653p18731653.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] read XML

2008-07-30 Thread Martin Morgan
Paulo Cardoso [EMAIL PROTECTED] writes:

 I have a xml exported by Manifold GIS but I'm not being able to import it
 into R using XLM package.

I can

 library(XML)
 xml - xmlTreeParse(tmp.xml, useInternal=TRUE)
 xpathApply(xml, //component/@ymin, xmlValue)
[[1]]
[1] 0.32371064328183174

[[2]]
[1] 0.32371064328183174

[[3]]
[1] 0.84662172667648694

so I wonder what specifically your difficulty is?

Best,

Martin


  

 The file have this structure:

  

   ?xml version=1.0 encoding=UTF-8 ? 

 - layout

   nameLayout 2/name 

   pagesByX1/pagesByX 

   pagesByY1/pagesByY 

 - elements

   legend refParent=r3 xmax=0.54156171284634758
 xmin=0.020151133501259435 ymax=0.31480598161051165
 ymin=0.042461931948864044 / 

   component background=auto border=none borderDegMinSec=false
 borderEachPage=true borderFont=Tahoma, 8 borderFore=#00
 borderMargin=12 borderNoOverlaps=true borderRounding=0 borderStep=1
 borderUnit=Meter controlPoints=auto graticule=auto grid=auto
 legend=auto name=MapMnaziBayhab northArrow=auto paging=continuous
 ref=r1 scaleBar=auto scope=locked center / scale
 scopeDetail=646802.61034615175,8856311.5759953968,150
 xmax=0.35877862595419846 xmin=0.027989821882951665
 ymax=0.98902384414662947 ymin=0.32371064328183174 / 

   component background=auto border=none borderDegMinSec=false
 borderEachPage=true borderFont=Tahoma, 8 borderFore=#00
 borderMargin=12 borderNoOverlaps=true borderRounding=0 borderStep=1
 borderUnit=Meter controlPoints=auto graticule=auto grid=auto
 legend=hide name=MapMnaziBayall northArrow=auto paging=continuous
 ref=r3 scaleBar=auto scope=locked center / scale
 scopeDetail=646802.61034615175,8856311.5759953968,150
 xmax=0.707379134860051 xmin=0.37659033078880411
 ymax=0.98902384414662947 ymin=0.32371064328183174 / 

   component background=auto border=none borderDegMinSec=false
 borderEachPage=true borderFont=Tahoma, 8 borderFore=#00
 borderMargin=12 borderNoOverlaps=true borderRounding=0 borderStep=1
 borderUnit=Degree controlPoints=auto graticule=auto grid=auto
 legend=auto name=Map Africa Mnazi northArrow=auto paging=continuous
 ref=r6 scaleBar=auto scope=entire component xmax=0.93198992443324935
 xmin=0.73047858942065491 ymax=0.98902384414662947
 ymin=0.84662172667648694 / 

   /elements

   /layout

  

 Any idea?

  

 Thanks.

  

 Paulo Cardoso


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

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

Location: Arnold Building M2 B169
Phone: (206) 667-2793

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


Re: [R] function to transform response of a formula

2008-07-30 Thread Paul Emberson

Hi,

I am now trying to use update.formula from within a function but I am 
not able to get the result I want.  Here is an example


f - function(fm, n) {
update(fm, n*. ~ .);
}

If I run

 fm - formula( y ~ a + b )
 f(fm,3)
n * y ~ a + b

Now when I try to use the formula, n does not exist.  Is there a way I 
can change my function so that n is replaced by its value within the 
formula created by f?


Thanks,

Paul


[EMAIL PROTECTED] wrote:

Its ok.

I've just read about update.formula in another message.

Paul

Paul Emberson wrote:

Hi,

I am trying to write a function which takes a formula as input and 
outputs a new formula with a different response while keeping the rest 
of the formula the same.


I.e.

respapply : ( y ~ a+b ) - ( f(y) ~ a + b )

I have tried the following but it doesn't work.  The terms become 
invalid as shown below.


respapply - function(fm, f) {

fm[[2]] - f(eval(fm[[2]]))
fm;

}

  fm - formula(y ~ a + b)
  y - runif(5)
  newfm - respapply(fm,identity)
  newfm

c(0.552921097259969, 0.939932722365484, 0.62522904924117, 
0.899310540175065,

0.877736972644925) ~ a + b

  terms(newfm)
Error in terms.formula(fmapply(fm, identity)) :
  invalid term in model formula

Could someone put me in the right direction of how to correctly write 
a respapply function as described.


Regards,

Paul Emberson

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

2008-07-30 Thread Gary W

Hi 

I am trying to add density lines to multiple histograms created using R.  I
have managed to get all 18 lines on the last histogram in the series,
however, i cannot figure out how to get each line appear on the correct
histogram plot.  I know in Matlab there is a hold function, is there
something similar in R? 

the following is the code i have used to get mutiple plots and then add all
the lines to the final plot: 

##find unique column names in table 
variablenames-unique(names(variables)) 
## define number of unique names 
Nvariables-length(variablenames) 
##for loop required for labelling of histograms and to tell how many hist to
make 
for(i in 1:Nvariables){ 
par(mfrow=c(1,1),ask=TRUE) 
} 
##use lapply for dataframes creates hist for each variable and labels
corresponding 
##important to have this outside of loop 
lapply(names(variables),function(i)hist(variables[[i]],probability=T,main=paste(Histogram
of,i), 
xlab=paste(i))) 
for(i in 1:Nvariables){ 
lines(density(variables[[i]],lwd=2)) 
} 

I am pretty sure its a simple explanation, i have just run out of ideas. 

Thanks 

gary Watmough 
PhD Student 
University of Southamton 
School of Geography
-- 
View this message in context: 
http://www.nabble.com/adding-lines-to-multiple-plot-tp18732850p18732850.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] What's the best way to operate R from within Excel?

2008-07-30 Thread losemind

HI all,

Is that the best R link from within Excel currently?

Thanks!


Patrizio Frederic wrote:
 
 have a look at
 
 http://sunsite.univie.ac.at/rcom/server/doc/RExcel.html
 
 regards,
 
 PF
 
 2008/7/30 losemind [EMAIL PROTECTED]:

 Hi all,

 How do I operate R from within Excel?

 I mean, highlight a bunch of cells, and send to R, and do some statistics
 in
 R, and return back the numbers and do some plots in R.

 For example, I have some parameters for Gaussian Random variable, and I
 would find the most convenient way to send these numbers to R and do some
 plots...

 How to do that?

 Thanks a lot!

 --
 View this message in context:
 http://www.nabble.com/What%27s-the-best-way-to-operate-R-from-within-Excel--tp18722737p18722737.html
 Sent from the R help mailing list archive at Nabble.com.

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

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

-- 
View this message in context: 
http://www.nabble.com/What%27s-the-best-way-to-operate-R-from-within-Excel--tp18722737p18732845.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] R command history -- can it be like Matlab's?

2008-07-30 Thread losemind



Prof Brian Ripley wrote:
 
 A patch to do this was posted on 2007-09-29 by Glenn Davis.  Some people 
 not addicted to Matlab find the behaviour very inconvenient and prefer the 
 getline/readline behaviour (triggered by ^R/^S) of Rterm and R on Unixen.
 
 On Tue, 29 Jul 2008, losemind wrote:
 

 Hi all,

 In R GUI window, if you use up and down key, you will be able to
 recall
 the previous and next command that has been used and stored in the
 command
 history cache.

 But there is one inconvenience:
 
 Or an inconvenience of Matlab not shared by R, depending on your 
 preferences.
 
 In Matlab, you can type the first a few characters of the command that
 you
 previously used,

 and then press “up key, you will be able to get to that previous command
 very fast,

 no matter how long ago it has been used...

 In R GUI, there is no such functionality.

 Any thoughts on making R work my productivity?

 --

 Also where do I find good debugger for R?

 Thanks!
 -- 
 View this message in context:
 http://www.nabble.com/R-command-historycan-it-be-like-Matlab%27s--tp18719530p18719530.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.

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

HI I am using Windows RGUI... where do I find that patch?

Thanks
-- 
View this message in context: 
http://www.nabble.com/R-command-historycan-it-be-like-Matlab%27s--tp18719530p18732866.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] R -Legality Question about R's Open Source GNU GPL License

2008-07-30 Thread Ajay ohri
whats the license policy of using r as a SaaS with other apps, priced for a
fee. I am not sure which license to invoke.

regards,

ajay

[[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] Unexpected line type in lattice plot key on pdf device

2008-07-30 Thread G. Draisma

L.S.,
With the code below,
on the Windows screen the line types in the key show
  as solid and dashed as in the graph,
and in the pdf file they show
  as solid in the key and solid and dashed in the graph.
I would not expect that,
but may be I get something wrong.
Gerrit.

---
library(lattice)
# pdf(pietje.pdf)
x-0:10
xyplot((x^0.5)+(x^0.75)~x,type=o,lty=c(1,2),
auto.key=list(points=F,lines=T,columns=2, type=o,divide=1))
# dev.off()
---

--
Gerrit Draisma
Department of Public Health
Erasmus MC, University Medical Center Rotterdam
Room AE-103
P.O. Box 2040 3000 CA  Rotterdam The Netherlands
Phone: +31 10 7043124 Fax: +31 10 7038474
http://mgzlx4.erasmusmc.nl/pwp/?gdraisma

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


Re: [R] read XML

2008-07-30 Thread Paulo Cardoso
Ok,

I reach this with
setwd(E:/MBayRNP/output)
xml.mfd-xmlTreeParse(myfile.xml)
str(xml.mfd$doc$children$layout)

and get this:

layout
 nameLayout 2/name
 pagesByX1/pagesByX
 pagesByY1/pagesByY
 elements
  legend refParent=r3 xmax=0.54156171284634758
xmin=0.020151133501259435 ymax=0.31480598161051165
ymin=0.042461931948864044/
  component background=auto border=none borderDegMinSec=false
borderEachPage=true borderFont=Tahoma, 8 borderFore=#00
borderMargin=12 borderNoOverlaps=true borderRounding=0 borderStep=1
borderUnit=Meter controlPoints=auto graticule=auto grid=auto
legend=auto name=MapMnaziBayhab northArrow=auto paging=continuous
ref=r1 scaleBar=auto scope=locked center / scale
scopeDetail=646802.61034615175,8856311.5759953968,150
xmax=0.35877862595419846 xmin=0.027989821882951665
ymax=0.98902384414662947 ymin=0.32371064328183174/
  component background=auto border=none borderDegMinSec=false
borderEachPage=true borderFont=Tahoma, 8 borderFore=#00
borderMargin=12 borderNoOverlaps=true borderRounding=0 borderStep=1
borderUnit=Meter controlPoints=auto graticule=auto grid=auto
legend=hide name=MapMnaziBayall northArrow=auto paging=continuous
ref=r3 scaleBar=auto scope=locked center / scale
scopeDetail=646802.61034615175,8856311.5759953968,150
xmax=0.707379134860051 xmin=0.37659033078880411
ymax=0.98902384414662947 ymin=0.32371064328183174/
  component background=auto border=none borderDegMinSec=false
borderEachPage=true borderFont=Tahoma, 8 borderFore=#00
borderMargin=12 borderNoOverlaps=true borderRounding=0 borderStep=1
borderUnit=Degree controlPoints=auto graticule=auto grid=auto
legend=auto name=Map Africa Mnazi northArrow=auto paging=continuous
ref=r6 scaleBar=auto scope=entire component xmax=0.93198992443324935
xmin=0.73047858942065491 ymax=0.98902384414662947
ymin=0.84662172667648694/
 /elements
/layout

I don't know how to go further and extract elements listed with
str(xml.mfd$doc$children$layout)

List of 4
 $ name:List of 1
  ..$ text: list()
  .. ..- attr(*, class)= chr [1:2] XMLTextNode XMLNode
  ..- attr(*, class)= chr XMLNode
 $ pagesByX:List of 1
  ..$ text: list()
  .. ..- attr(*, class)= chr [1:2] XMLTextNode XMLNode
  ..- attr(*, class)= chr XMLNode
 $ pagesByY:List of 1
  ..$ text: list()
  .. ..- attr(*, class)= chr [1:2] XMLTextNode XMLNode
  ..- attr(*, class)= chr XMLNode
 $ elements:List of 4
  ..$ legend   : list()
  .. ..- attr(*, class)= chr XMLNode
  ..$ component: list()
  .. ..- attr(*, class)= chr XMLNode
  ..$ component: list()
  .. ..- attr(*, class)= chr XMLNode
  ..$ component: list()
  .. ..- attr(*, class)= chr XMLNode
  ..- attr(*, class)= chr XMLNode
 - attr(*, class)= chr XMLNode

And I need the first two components of elements:List of 4.
From those components I need to manipulate xmax and xmin and write a new xml
with these parameters changed only.


 -Original Message-
 From: Martin Morgan [mailto:[EMAIL PROTECTED]
 Sent: quarta-feira, 30 de Julho de 2008 13:49
 To: Paulo Cardoso
 Cc: r
 Subject: Re: [R] read XML
 
 Paulo Cardoso [EMAIL PROTECTED] writes:
 
  I have a xml exported by Manifold GIS but I'm not being able to
 import it
  into R using XLM package.
 
 I can
 
  library(XML)
  xml - xmlTreeParse(tmp.xml, useInternal=TRUE)
  xpathApply(xml, //component/@ymin, xmlValue)
 [[1]]
 [1] 0.32371064328183174
 
 [[2]]
 [1] 0.32371064328183174
 
 [[3]]
 [1] 0.84662172667648694
 
 so I wonder what specifically your difficulty is?
 
 Best,
 
 Martin
 
 
 
 
  The file have this structure:
 
 
 
?xml version=1.0 encoding=UTF-8 ?
 
  - layout
 
nameLayout 2/name
 
pagesByX1/pagesByX
 
pagesByY1/pagesByY
 
  - elements
 
legend refParent=r3 xmax=0.54156171284634758
  xmin=0.020151133501259435 ymax=0.31480598161051165
  ymin=0.042461931948864044 /
 
component background=auto border=none borderDegMinSec=false
  borderEachPage=true borderFont=Tahoma, 8 borderFore=#00
  borderMargin=12 borderNoOverlaps=true borderRounding=0
 borderStep=1
  borderUnit=Meter controlPoints=auto graticule=auto grid=auto
  legend=auto name=MapMnaziBayhab northArrow=auto
 paging=continuous
  ref=r1 scaleBar=auto scope=locked center / scale
  scopeDetail=646802.61034615175,8856311.5759953968,150
  xmax=0.35877862595419846 xmin=0.027989821882951665
  ymax=0.98902384414662947 ymin=0.32371064328183174 /
 
component background=auto border=none borderDegMinSec=false
  borderEachPage=true borderFont=Tahoma, 8 borderFore=#00
  borderMargin=12 borderNoOverlaps=true borderRounding=0
 borderStep=1
  borderUnit=Meter controlPoints=auto graticule=auto grid=auto
  legend=hide name=MapMnaziBayall northArrow=auto
 paging=continuous
  ref=r3 scaleBar=auto scope=locked center / scale
  scopeDetail=646802.61034615175,8856311.5759953968,150
  xmax=0.707379134860051 xmin=0.37659033078880411
  ymax=0.98902384414662947 ymin=0.32371064328183174 /
 
component background=auto border=none borderDegMinSec=false
  borderEachPage=true borderFont=Tahoma, 8 

[R] odds ratios in multiway tables (stratified)

2008-07-30 Thread Wim Bertels
Hi,

does anyone know of a function to calculate odds ratios in multiway
tables (stratified) (+ the other usual statistics involved)

i mean:
say we have a table r*c*d,
For every d (depth) we have a r*c table,
and in this table the odds ratio's are calculated for every 2*2 subtable
in it.

logically this function would look like):
ORs(multiwaytable)
or
ORs(data$var1r,data$var2c,data$var3d)

(eg. not taking the lot together, keeping the paradox of simpson in
mind)

mvg,
Wim

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] FFT - (STATS) - is this correct?

2008-07-30 Thread stephen sefick
#ts with a freq=1
d - ts(x)
#it seems that this is an oscillating signal of ~ a day
plot(d)
#spectrogram which shows that the main frequency component is ~ 0.7.  this
translates to about a day (1.3 or so)
sec.pgram(d)

On Wed, Jul 30, 2008 at 7:14 AM, [EMAIL PROTECTED] wrote:

 Hello,

 I have calculated the fourier transform of the series enclosed at the end
 of this message, by doing:

 library(stats)
 x - readLines(file1.txt)
 x.num - as.numeric(x)
 ft.x.num - fft(x.num)

 My question is: why is the first value (Real) of ft.x.num that big?
 (954.833870) all the other values are much smaller. Am I doing something
 wrong?

 Could you please help me to understand that?

 Many thanks, Renata

 2.24791
 6.39824
 7.43533
 7.21367
 11.2164
 7.29183
 9.72807
 12.8445
 12.4819
 8.18952
 6.38345
 9.98463
 6.25724
 7.97327
 8.9676
 8.27709
 14.8272
 13.4908
 11.876
 11.4889
 11.3161
 9.79778
 8.09873
 4.43935
 5.30657
 9.37819
 0
 8.09507
 10.9567
 10.5478
 12.6661
 13.8612
 14.025
 13.9403
 11.5847
 9.50861
 7.81196
 5.4
 5.27313
 4.16159
 3.83932
 8.95892
 11.9548
 12.7598
 11.6816
 13.3388
 13.1956
 9.50887
 12.4671
 11.2608
 12.6553
 5.63253
 4.18556
 4.47097
 9.13142
 5.29101
 11.3582
 7.5489
 13.0371
 9.26487
 11.6458
 6.26179
 10.4051
 11.7282
 9.36171
 10.7723
 4.90151
 4.25747
 6.95437
 6.17832
 11.59
 13.894
 10.8935
 8.19078
 6.27219
 6.74875
 10.076
 6.47078
 11.1408
 6.48286
 10.4232
 9.23548
 11.199
 7.97828
 13.1261
 12.1624
 7.90476
 11.7495
 14.0312
 9.97212
 11.3685
 12.6093
 4.68484
 4.72131
 5.10963
 8.1693
 8.21239
 10.6743
 5.39084
 11.1944
 12.4415
 8.0419
 5.62567
 12.2756
 0


 -
 Email sent from www.virginmedia.com/email
 Virus-checked http://www.virginmedia.com/emailVirus-checked using
 McAfee(R) Software and scanned for 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.




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

[[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] adding lines to multiple plot

2008-07-30 Thread Ben Bolker
Gary W g.watmough at gmail.com writes:

 
 
 Hi 
 
 I am trying to add density lines to multiple histograms created using R.  I
 have managed to get all 18 lines on the last histogram in the series,
 however, i cannot figure out how to get each line appear on the correct
 histogram plot.  I know in Matlab there is a hold function, is there
 something similar in R? 
 
 ##find unique column names in table 
 variablenames-unique(names(variables)) 
 ## define number of unique names 
 Nvariables-length(variablenames) 
 for(i in 1:Nvariables){ 
 par(mfrow=c(1,1),ask=TRUE) 
 } 

  previous loop is a little weird -- it has exactly the
same result as just running the command inside once.

Labeling with the numeric values is a bit of a pain.
If you don't need them you can just do

lapply(variables,
   function(v) {
  hist(v,prob=TRUE)
  lines(density(v),lwd=2)
   })

If you need the labels you can either do

mapply(function(v,i) {
   hist(v,prob=TRUE,main=paste(Histogram of,i),xlab=i)
  lines(density(v),lwd=2)
 },
 variables,
 1:Nvariables)

Or it might be easier to just do the whole thing with 
a for loop:

for (i in 1:Nvariables) {
  hist(variables[[i]],prob=TRUE,main=paste(Histogram of,i),xlab=i)
  lines(density(variables[[i]]),lwd=2)
}

  Ben Bolker

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


Re: [R] R -Legality Question about R's Open Source GNU GPL License

2008-07-30 Thread Marc Schwartz

on 07/30/2008 08:39 AM Ajay ohri wrote:

whats the license policy of using r as a SaaS with other apps, priced for a
fee. I am not sure which license to invoke.

regards,

ajay


See this post:

https://stat.ethz.ch/pipermail/r-help/2008-June/165906.html

HTH,

Marc Schwartz

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


[R] model mix problem. FALSE CONVERGENCE

2008-07-30 Thread mergullo

Hi R users
I try to use the lme but I can´t!
My script is (some words in french, sorry!!): 


rm(list=ls(all=TRUE)) #Efface tous les objets en mémoire pour éviter des
erreurs

library(MASS)  #Chargement des Librairies
library(car)
library(Hmisc)
library(tkWidgets)
library(svDialogs)
library(multtest)
library(nlme)

#Rep - C:/Documents and Settings/U3M/Bureau/steph/Scripts R/
Rep - C:/Documents and Settings/rafa/Mis documentos/metabolomics/Scripts
R/Modèles Mixtes/

# Choix du fichier à traiter
source(sprintf(%sinfile2bis.q,Rep))
para-infile2bis() # Ouvre une petite interface permettant de sélectionner
le fichier
# que l'on veut traiter
Fic - para$fichier # fic est le fichier à traiter
pat - para$pat # Répertoire de résultats
CLASSE - noquote(para$classe[1:2]) # Facteurs à étudier
.method-which(para$checks2!=F)  #Méthode d'ajustement des p-values

# Vérification qu'on est bien ds le bon répertoire de travail
if ( getwd()!=dirname(Fic[1]) ) setwd(dirname(Fic[1]))

## Quelques conditions à vérifier
if (sum(CLASSE==)=1) {
guiDlgMessage(Il faut spécificier deux variables catégorielles.,
   title = ERROR, type = ok, icon = c(error), parent =
0)
stop(Il faut spécificier deux variables catégorielles) }

if (sum(para$checks1==c(T,T))==2) {
guiDlgMessage(Il ne faut cocher qu'une seule case pour la ligne
Transformation des données.,
   title = ERROR, type = ok, icon = c(error), parent =
0)
stop(Il ne faut cocher qu'une seule case pour la ligne Transformation
des données)  }

if (length(which(para$checks2)==T)1) {
guiDlgMessage(Vous ne pouvez choisir qu'une seule méthode de correction
des p-values, ne cochez qu'une seule case.,
   title = ERROR, type = ok, icon = c(error), parent =
0)
stop(Error : vous ne pouvez choisir qu'une seule méthode de correction
des p-values )}


##Manipulation sur le fichier de
données
titi - read.table(Fic[2],header=T,sep=\t)   # Lecture du fichier
Protocole
indiv - as.character(titi[,1])#Identifiant des
individus
Subject - as.factor(titi[,1])
n - dim(titi)[1]  #Nb individus

toto1 - read.table(Fic[1],header=T,sep=\t) # Lecture du fichier de
données
ions - as.character(toto1[,1])  #Identifiant des ions

## La matrice des Intensités
if (sum(para$checks1==c(T,F))==2) {
  toto - log2(t(toto1[,-c(1:(dim(toto1)[2]-n))])+1) }

if (sum(para$checks1==c(F,T))==2) {
  toto - t(toto1[,-c(1:(dim(toto1)[2]-n))]) }

if (sum(para$checks1==c(F,F))==2) {
  toto - t(toto1[,-c(1:(dim(toto1)[2]-n))]) }

nvar - dim(toto)[2]   #Nb variables = Nb ions

if (is.numeric(toto)==F) { 
guiDlgMessage(Problème de fichier :\r\n vérifier vos données.,
   title = ERROR, type = ok, icon = c(error), parent =
0)
stop(Nombre d'individus différents dans les deux fichiers : vérifier
vos données)}

Facteurs - titi[,-1]  #Les facteurs

#Création d'un répertoire où enregistrer les résultats
if (any(dir(getwd())==strsplit(pat,/))==F) {
  if (pat!=)  { dir.create(file.path(getwd(),pat)) }
}


#ANOVA 2 voies

v1 - Facteurs[[CLASSE[1]]]
v2 - Facteurs[[CLASSE[2]]]

if (is.null(v1) | is.null(v2)) {
guiDlgMessage(Vous n'avez pas spécifier un facteur catégoriel
correct.\r\n\r\nAttention, il faut que le nom du facteur que vous entrez
\r\ndans l'interface et celui du fichier protocole soient \r\nexactement les
mêmes.\r\n\r\nR est sensible à la case.,
   title = ERROR, type = ok, icon = c(error),
parent = 0)
}

## ANOVA 2 facteurs

  Resultats=NULL
  Res=NULL
  i=0
  while(i!=length(ions)) {
  i=i+1
  myion=toto[,i]
  mixed=lme(myion ~ v1*v2, random= ~ 1 | Subject/v1,method=REML)
## effet aléatoire sujet(v1)
  #summary(mixed)
  #anova(mixed)
  zz=anova(mixed)
  Res -
data.frame(ions[i],toto1[i,2:(dim(toto1)[2]-n)],t(zz[-1,4]),toto1[i,c((dim(toto1)[2]-n+1):dim(toto1)[2])])
  Resultats - rbind(Resultats,Res)
  }
  if (i!=length(ions)) {
  while(i!=length(ions)) {
  i=i+1
  myion=toto[,i]
  mixed=lme(myion ~ v1*v2, random= ~ 1 | Subject/v1,method=REML)
## effet aléatoire sujet(v1)
  zz=anova(mixed)
  Res -
data.frame(ions[i],toto1[i,2:(dim(toto1)[2]-n)],t(zz[-1,4]),toto1[i,c((dim(toto1)[2]-n+1):dim(toto1)[2])])
  Resultats - rbind(Resultats,Res)
  }}
  if (i!=length(ions)) {
  while(i!=length(ions)) {
  i=i+1
  myion=toto[,i]
  mixed=lme(myion ~ v1*v2, random= ~ 1 | Subject/v1,method=REML)
## effet aléatoire sujet(v1)
  zz=anova(mixed)
  Res -

Re: [R] adding lines to multiple plot

2008-07-30 Thread Gary W

Hi ben

Thanks for that, the density lines have now worked, however i was hoping
that the labels would be the names of the columns in my original data set
not numeric.  any advice how to do this?

gary w



Ben Bolker wrote:
 
 
 ##find unique column names in table 
 variablenames-unique(names(variables)) 
 ## define number of unique names 
 Nvariables-length(variablenames) 
 for(i in 1:Nvariables){ 
 par(mfrow=c(1,1),ask=TRUE) 
 } 
 
   previous loop is a little weird -- it has exactly the
 same result as just running the command inside once.
 
 Labeling with the numeric values is a bit of a pain.
 If you don't need them you can just do
 
 lapply(variables,
function(v) {
   hist(v,prob=TRUE)
   lines(density(v),lwd=2)
})
 
 If you need the labels you can either do
 
 mapply(function(v,i) {
hist(v,prob=TRUE,main=paste(Histogram of,i),xlab=i)
   lines(density(v),lwd=2)
  },
  variables,
  1:Nvariables)
 
 Or it might be easier to just do the whole thing with 
 a for loop:
 
 for (i in 1:Nvariables) {
   hist(variables[[i]],prob=TRUE,main=paste(Histogram of,i),xlab=i)
   lines(density(variables[[i]]),lwd=2)
 }
 
   Ben Bolker
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/adding-lines-to-multiple-plot-tp18732850p18734458.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] Most often pairs of chars across grouping variable

2008-07-30 Thread svga
Hi Marc,

many thanks, that is exactly  what I was looking for.

Best, Sven


- Original Nachricht 
Von: Marc Schwartz [EMAIL PROTECTED]
An:  [EMAIL PROTECTED]
Datum:   29.07.2008 17:15
Betreff: Re: [R] Most often pairs of chars across grouping variable

 on 07/29/2008 09:51 AM [EMAIL PROTECTED] wrote:
  Hi list,
  
  is there a package or function to compute the frequencies of pairs of
  chars in a variable across a grouping variable? Eg:
  
  
  d - data.frame(ID=gl(2,3), F=c(A,B,C,A,C,D))
  d
  ID F 1  1 A 2  1 B 3  1 C 4  2 A 5  2 C 6  2 D
  
  
  Now I want to summarize the frequencies of all pairs A-B, A-C, A-D,
  B-C, B-D, C-D across ID:
  
  A B C D A  - 1 2 1 B  - - 1 0 C  - - - 1
  
  
  here, the combination A-C is most frequent. The real problem behind
  that is that 'F' codes diagnoses and I search for the most often
  pairs of diagnoses.
  
  Thanks, Sven
 
 I suspect that there might be something over in Bioconductor, but here 
 is one approach:
 
   table(data.frame(t(do.call(cbind,
   tapply(d$F, d$ID,
  function(x) combn(as.character(x), 2))
 X2
 X1  B C D
A 1 2 1
B 0 1 0
C 0 0 1
 
 
 See ?combn to create the initial pairs from the data. This is done on a 
 per ID basis using tapply. The result is transposed into a data frame 
 and then table() is used to create the cross tabulation of the results.
 
 HTH,
 
 Marc Schwartz
 


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


Re: [R] R -Legality Question about R's Open Source GNU GPL License

2008-07-30 Thread Stevens, Martin Henry H. Dr.
The limit of use is that you cannot profit from it. It is Open Source.

From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Ajay ohri [EMAIL 
PROTECTED]
Sent: Wednesday, July 30, 2008 9:39 AM
To: r-help@r-project.org
Subject: [R] R -Legality Question about R's Open Source GNU GPL License

whats the license policy of using r as a SaaS with other apps, priced for a
fee. I am not sure which license to invoke.

regards,

ajay

[[alternative HTML version deleted]]

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

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


Re: [R] R -Legality Question about R's Open Source GNU GPL License

2008-07-30 Thread Marc Schwartz

Absolutely FALSE.

Read this FAQ and the following 3:

http://www.fsf.org/licensing/licenses/gpl-faq.html#DoesTheGPLAllowMoney

Let's not spread FUD.

Marc Schwartz

on 07/30/2008 08:50 AM Stevens, Martin Henry H. Dr. wrote:

The limit of use is that you cannot profit from it. It is Open Source.

From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Ajay ohri [EMAIL 
PROTECTED]
Sent: Wednesday, July 30, 2008 9:39 AM
To: r-help@r-project.org
Subject: [R] R -Legality Question about R's Open Source GNU GPL License

whats the license policy of using r as a SaaS with other apps, priced for a
fee. I am not sure which license to invoke.

regards,

ajay


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 -Legality Question about R's Open Source GNU GPL License

2008-07-30 Thread Roland Rau

Hi,

Stevens, Martin Henry H. Dr. wrote:

The limit of use is that you cannot profit from it. It is Open Source.


I am not sure what you mean exactly. If you mean that you can not earn 
any money selling free software (in terms of the GPL2, which is R's 
licence), this seems to be not the case:

http://www.fsf.org/licensing/essays/selling.html

Best,
Roland

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

2008-07-30 Thread Jia Ying Mei

Hi,

I have a data set (attached, and which I've asked about before) 
containing countries, prices and dates. I am trying to find the mean and 
median (by country) percentage change of each price change. For example:


Date  Australia
6/30/07 2
3/31/07 2
11/30/06   2
5/2/06   2
1/11/06 2
8/5/05   2
7/31/05 2
4/30/05   1.5
1/31/05   1.5
1/3/05 1.5
1/2/054

So for this period for Australia, there are 2 price changes. The first 
change is a 25% change, and the second is 266.66%. If this were all the 
data there was, the mean percentage change is ~146% and the median would 
be the same.


I was wondering if anyone knew a way that would collect the percentage 
change at each price change and then calculate the mean and median of 
those percentages, and could do this for a data set with a lot of 
countries (so the output would be broken up by country).


Any help would be appreciated! Thanks!

Jia Ying Mei
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 -Legality Question about R's Open Source GNU GPL License

2008-07-30 Thread ohri2007
now which license to use?

it is bad enough explaining SaaS (software as a service), and open
source and data mining to lawyers, without the experts fighting it as
well.

and who pays for the cloud computing expenses  for me then if there is
no money in it. cloud computing doesnt exist in India right now from
where I am writing this?

regards,

ajay
decisionstats.com

On 7/30/08, Roland Rau [EMAIL PROTECTED] wrote:
 Hi,

 Stevens, Martin Henry H. Dr. wrote:
 The limit of use is that you cannot profit from it. It is Open Source.

 I am not sure what you mean exactly. If you mean that you can not earn
 any money selling free software (in terms of the GPL2, which is R's
 licence), this seems to be not the case:
 http://www.fsf.org/licensing/essays/selling.html

 Best,
 Roland


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Mixed effects model where nested factor is not the repeated across treatments lme???

2008-07-30 Thread ctu

Hi Miki,
I just got the same problem with you couple hours ago.
Rusers (Anna, and Mark {thank you guys}) provide me a vary valuable  
information.

link to following address.

http://www.nabble.com/Tukey-HSD-(or-other-post-hoc-tests)-following-repeated-measures-ANOVA-td17508294.html#a17559307
for the A vs. B, A vs. C
You could install and download the multcomp package and perform the  
post hoc test

such as
summary(glht(lmel,linfct=mcp(treatment=Tukey)))

hopefully it helps
Chunhao


Quoting M Ensbey [EMAIL PROTECTED]:


Hi,



I have searched the archives and can't quite confirm the answer to this.
I appreciate your time...



I have 4 treatments (fixed) and I would like to know if there is a
significant difference in metal volume (metal) between the treatments.
The experiment has 5 blocks (random) in each treatment and no block is
repeated across treatments. Within each plot there are varying numbers
of replicates (random) (some plots have 4 individuals in them some have
14 and a range in between). NOTE the plots in one treatment are not
replicated in the others.



So I end up with a data.frame with 4 treatments repeated down one column
(treatment=A, B, C, D), 20 plots repeated down the next (block= 1 to 20)
and records for metal volume (metal- 124 of these)

I have made treatment and block a factor. But haven't grouped them (do I
need to and how if so)



The main question is in 3 parts:



1.  is this the correct formula to use for this situation:
lme1-lme(metal~treatment,data=data,random=~1|block) (or is lme even the
right thing to use here?)



I get:


summary(lme1)


Linear mixed-effects model fit by REML

 Data: data

   AIC  BIClogLik

  365.8327 382.5576 -176.9163



Random effects:

 Formula: ~1 | block

(Intercept)  Residual

StdDev:   0.4306096 0.9450976



Fixed effects: Cu ~ Treatment

 Value Std.Error  DF   t-value p-value

(Intercept)   5.587839 0.2632831 104 21.223688  0. ***

TreatmentB -0.970384 0.3729675  16 -2.601792  0.0193 ***

TreatmentC  -1.449250 0.3656351  16 -3.963651  0.0011 ***

TreatmentD  -1.319564 0.3633837  16 -3.631323  0.0022 ***

 Correlation:

 (Intr) TrtmAN TrtmCH

TreatmentB -0.706

TreatmentC  -0.720  0.508

TreatmentD  -0.725  0.511  0.522



Standardized Within-Group Residuals:

Min  Q1 Med  Q3 Max

-2.85762206 -0.68568460 -0.09004478  0.56237152  3.20650288



Number of Observations: 124

Number of Groups: 20



2.  if so how can I get p values for comparisons between every
group... ie is A different from B, is A different from C, is A different
from D, is B different from C, is B different from D etc... is there a
way to get all of these instead of just is A different from B, is A
different from C, is A different from D which summary seems to give?
3.  last of all what is the best way to print out all the residuals
for lme... I can get qqplot(lme1) is there a pre-programmed call for
multiple diagnostic plots like in some other functions...





Thankyou so Much for your time



It is much appreciated

;-)



Miki




[[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] Rprintf will not build in my C++ compiler

2008-07-30 Thread nmarti

I have searched through the threads and Rprintf causing a build error
dosen't seem to be a problem for anyone else.  And I've read through R
Extensions and An Introduction to the .C Interface to R and there doesn't
seem to be any troubleshooting for my problem.

My code is straight from An Introduction to the .C Interface to R pg. 3.
And my compiler is VC++ 2005 Express
--
#include R.h

void hello( int *n ) {
int i ;
for( i = 0 ; i  *n ; i++ ) {
Rprintf( Hello, world!\n ) ;
}
}
--
When I try to build this code, I recieve 2 error massages,
error LNK2019: unresolved external symbol _Rprintf referenced in function
void _cdecl hello(int *n) (?hello@@[EMAIL PROTECTED])
fatal error LNK1120: 1 unresolved externals

To be honest, I'm not exactly sure what these errors mean, I'm still
learning C++.
Any thoughts would be appreciated.
-- 
View this message in context: 
http://www.nabble.com/Rprintf-will-not-build-in-my-C%2B%2B-compiler-tp18735205p18735205.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] R -Legality Question about R's Open Source GNU GPL License

2008-07-30 Thread Marc Schwartz

on 07/30/2008 10:35 AM [EMAIL PROTECTED] wrote:

now which license to use?

it is bad enough explaining SaaS (software as a service), and open
source and data mining to lawyers, without the experts fighting it as
well.

and who pays for the cloud computing expenses  for me then if there is
no money in it. cloud computing doesnt exist in India right now from
where I am writing this?



As I noted in my reply, there is nothing preventing you using FOSS to 
create a value added service, from which you can generate profitable 
income.


If there was, Red Hat would not be a public company with shareholders, 
Canonical (Ubuntu's commercial sponsor) would not exist and Dell would 
not be selling computers with Ubuntu pre-installed.


Whether anyone will actually pay you for your service is another 
question and a business risk that you have to evaluate.


That being said, if you are planning to start up a company based upon 
the use of FOSS as your foundation, get yourself a lawyer familiar with 
it and fire any lawyer that you are currently using who is not. There 
are lawyers with the requisite experience in both FOSS and IP.


This is not the proper forum to seek business development advice.

Marc Schwartz

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


[R] Axes in perspective plot - persp()

2008-07-30 Thread David Afshartous


All,

I'm making some plots with the persp() function and am having trouble
sorting out the following:

- How does one avoid the axes label overlapping the tick values?

- Is doesn't seem possible to independently control the number of ticks of
the x,y, and z-axes, e.g., I'd like say only 4 ticks on the y axes but 10 on
the other two.

- for my function (although it doens't happen for the reproducible example
below unfortunately) the origin of the x and y tick values seem to overlap,
is there any way to avoid this?

Example below.

theta - seq(.1, 10, length = 30)
rho - seq(0, .99, length = 30)
f - function(theta, rho) { theta + rho^2 }
Z - outer(theta, rho, f)
persp(theta, rho, Z,  expand = 0.5, col = lightblue, ticktype =
detailed,  nticks = 10)

Thanks,
David

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Rprintf will not build in my C++ compiler

2008-07-30 Thread Prof Brian Ripley
That is a linker (not compiler) message, and you apparently forgot to link 
against R.dll.  See README.packages in the R distribution for how to use 
VC++ with R under Windows (which is neither recommended nor supported).


Three other comments.

1) See the posting guide.  R-devel is the list for non-R programming 
questions.


2) See the posting guide.  You didn't show how you compiled your code nor 
what exact command gave that error message.


3) See 'Writing R Extensions'.  For that code to be any use with R, it has 
to have a C and not C++ entry point 'hello'.


On Wed, 30 Jul 2008, nmarti wrote:



I have searched through the threads and Rprintf causing a build error
dosen't seem to be a problem for anyone else.  And I've read through R
Extensions and An Introduction to the .C Interface to R and there doesn't
seem to be any troubleshooting for my problem.


Well, you _are_ using an unsupported compiler/linker.


My code is straight from An Introduction to the .C Interface to R pg. 3.


Which is what?  (Not an official manual.)


And my compiler is VC++ 2005 Express
--
#include R.h

void hello( int *n ) {
   int i ;
   for( i = 0 ; i  *n ; i++ ) {
   Rprintf( Hello, world!\n ) ;
   }
}
--
When I try to build this code, I recieve 2 error massages,
error LNK2019: unresolved external symbol _Rprintf referenced in function
void _cdecl hello(int *n) (?hello@@[EMAIL PROTECTED])
fatal error LNK1120: 1 unresolved externals

To be honest, I'm not exactly sure what these errors mean, I'm still
learning C++.
Any thoughts would be appreciated.
--
View this message in context: 
http://www.nabble.com/Rprintf-will-not-build-in-my-C%2B%2B-compiler-tp18735205p18735205.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.



--
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] R -Legality Question about R's Open Source GNU GPL Licen

2008-07-30 Thread Ted Harding
In this midst of all this debate, can I try a simple question?

Have the enforceability and/or interpretation of the GPL ever been
tested in court?

If so, then are there any references to where one can read about
the case (or cases)?

With thanks,
Ted.


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 30-Jul-08   Time: 17:19:20
-- XFMail --

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


Re: [R] R -Legality Question about R's Open Source GNU GPL License

2008-07-30 Thread ohri2007
well, i am planning to test rattle (r gui) or even R on a cloud computer.

IMO SAS (software ) scores over R because it handles bigger files more
efficiently on SAME local hardware. but prices a huge premium on
licenses.

with R and a cloud, you pay for time spent (1+profit P).
cloud ramps up processing power as needed.

data mining to the masses.
got 400 million rows and no money to work as a stats consultant. pay per use.

and i am ready to give it away to greenpeace , whatever..
.just not to any big corp who patents it first.

the question was which license to use, and i got two answers . so that
was the clarification.

is this a business development plan maybe. but is also a r development
plan which is much better algols than any other software.but still
lacks acceptance .

and now for finding someone enough to sponser the cloud development
time, without hoping for lazy royalty assets)

thanks for your help and support.

regards,

ajay.

the framework is on decisionstats dot com

On 7/30/08, Marc Schwartz [EMAIL PROTECTED] wrote:
 on 07/30/2008 10:35 AM [EMAIL PROTECTED] wrote:
 now which license to use?

 it is bad enough explaining SaaS (software as a service), and open
 source and data mining to lawyers, without the experts fighting it as
 well.

 and who pays for the cloud computing expenses  for me then if there is
 no money in it. cloud computing doesnt exist in India right now from
 where I am writing this?


 As I noted in my reply, there is nothing preventing you using FOSS to
 create a value added service, from which you can generate profitable
 income.

 If there was, Red Hat would not be a public company with shareholders,
 Canonical (Ubuntu's commercial sponsor) would not exist and Dell would
 not be selling computers with Ubuntu pre-installed.

 Whether anyone will actually pay you for your service is another
 question and a business risk that you have to evaluate.

 That being said, if you are planning to start up a company based upon
 the use of FOSS as your foundation, get yourself a lawyer familiar with
 it and fire any lawyer that you are currently using who is not. There
 are lawyers with the requisite experience in both FOSS and IP.

 This is not the proper forum to seek business development advice.

 Marc Schwartz



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


[R] FOURIER TRANSFORM HELP

2008-07-30 Thread renata.camargo05
Hello,

I have a series and I need to run a Fourier Transform for that series.

I have done that using the function fft from stats package.
However I am not sure whether the result I am getting is correct or not. Seems 
that the first value of the Fourier Transform list is the sum of all elements 
of the given series and all the following numbers represent a palindromic 
series for some how. 

I have never used a Fourier Transform before and I don't know whether that is 
how it should work or not.
Could anyone help me with that or give me some suggestions, please?
Thank you ever so much, Renata


-
Email sent from www.virginmedia.com/email
Virus-checked using McAfee(R) Software and scanned for spam

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


Re: [R] ~ . help

2008-07-30 Thread Michael Dewey

At 08:44 30/07/2008, [EMAIL PROTECTED] wrote:

Hello,

What the tilde and dot means? I believe is something to do with 
formula, but how do they work?


You are already half way there
?formula
should help you find out what ~ means
?update.formula
should help you find out what . means in the context of formulae



An example:
(fk5 ~ ., size = 10)

Do you know what the fk5 ~ . means?

Thank you!
Renata


-
Email sent from www.virginmedia.com/email
Virus-checked using McAfee(R) Software and scanned for spam


Michael Dewey
http://www.aghmed.fsnet.co.uk

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 -Legality Question about R's Open Source GNU GPL Licen

2008-07-30 Thread Csardi Gabor
Ted, yes, there were a couple of cases, both in Europe and 
in the US. See more here:

http://www.softwarefreedom.org/

As far as I can remember, all lawsuits ended with an agreement, 
and the publication of the source code, of course.

Best,
Gabor

On Wed, Jul 30, 2008 at 05:19:31PM +0100, Ted Harding wrote:
 In this midst of all this debate, can I try a simple question?
 
 Have the enforceability and/or interpretation of the GPL ever been
 tested in court?
 
 If so, then are there any references to where one can read about
 the case (or cases)?
 
 With thanks,
 Ted.
 
 
 E-Mail: (Ted Harding) [EMAIL PROTECTED]
 Fax-to-email: +44 (0)870 094 0861
 Date: 30-Jul-08   Time: 17:19:20
 -- XFMail --
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

-- 
Csardi Gabor [EMAIL PROTECTED]MTA RMKI, ELTE TTK

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

2008-07-30 Thread Gavin Simpson
On Wed, 2008-07-30 at 04:59 -0700, Andrewjohnclose wrote:
 Hi, I have been trying to create a function to generate a Procrustes plot,
 generated from package vegan
 in lattice.
 
 standard vegan code as follows
 library(vegan)
 pro=protest(P1, P8, permutations=4999,choices=1:4)
 plot(pro) 
 
 Now, here is the code for the function that I have failed to get to work
 properly.
 
 panel.procrustes=function(x,y)
 }Pro=protest(x,y,permutations=4999,choices=1:4)
 Proplot=plot(Pro)
 }
 xyplot(P1[1:4]~P8[1:4],panel=panel.procrustes)
 
 I can generate an empty plot, but not much else - hope someone can help and
 point out the obvious!
 
 Kind regards
 
 Andrew

The obvious thing is that whole thing is wrong! ;-)

What's wrong with the standard plot?

You are trying to mix base (standard) graphics functions with
grid/lattice graphics and this is not possible (well Ok there is package
gridBase).

You'll have to start doing the plotting from scratch in
panel.procrustes. You might get some ideas of how to do this by looking
at the ordixyplot functions and panel functions in current vegan that
implement lattice graphics plots for ordiplot objects. I'm not
sufficiently familiar with Lattice yet to advise how to go about
producing a panel function, but the basic elements are:

  * draw the points from x$Yrot[, 1:2]
  * draw the arrows from x$Yrot[, 1:2] to x$X[, 1:2]
  * draw the origin - equivalent  of abline(h = 0) and abline(v = 0)
  * draw the rotation involved in the Procrustes analysis: abline(0,
tan(acos(x$rotation[1, 1])) and abline(0, 1/tan(acos(-x
$rotation[1, 1]))

So you'll need the Lattice equivalents of abline and then work out how
to pass the X, Yrot and rotation components to your panel function. This
is the bit I'm not clear on but look at ordixyplot and panel.ordi for
inspiration.

Give it a go, but if you get stuck then mail me back privately (note I
am moving house at the weekend so I'm not going to get back to you any
time real soon!) or post a message on the vegan development website:

https://r-forge.r-project.org/forum/forum.php?forum_id=194

and Jari may be able to help you - I might also chip in there once I
unpack my belongings and get my head round how to pass this stuff around
in lattice...

G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] OT: Data mining on demand .Using cloud computers.

2008-07-30 Thread Ajay ohri
Dear Lists,

There are many softwares (with many passionate adherents). Some of them are
very good upto say 2 million rows but lose steam after that despite having
very good focus in innovating algorithms.
Some of them are very good on same PC for much more data but become
comfortable with the copyrights to innovate on algorithms.

I am taing the risk of proposing the Ohri framework for creating R Rattle
GUI (can be placed by any analytical software) in a cloud computer . With
pay per usage of processing power.And very user friendly to analysts who did
not pay for masters degree.or to small consultants.

If you are a small academic or a consultant who has dreamt of lot more
processing power, here is a framework. It may be totally crap, but the
intention is to take data mining to the common masses.

Its only fair to pay per usage.Why pay for software , when on your coffee
break.
Even if you are poor.Especially so.

Thanks for reading this.

Ajay Ohri
http://decisionstats.com/wp-content/uploads/2008/07/ohri-framework.gif

Please zoom to view details. Please comment using the comments section.

[[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] bug in 'margins' behavior in reshape - cast

2008-07-30 Thread mfrumin

according to the documentation of the cast function in the reshape function,
I would expect this bit of code from the examples to calculate marginal
means over only the 'diet' variable.  

#Chick weight example
names(ChickWeight) - tolower(names(ChickWeight))
chick_m - melt(ChickWeight, id=2:4, na.rm=TRUE)
cast(chick_m, diet + chick ~ time, mean, margins=diet)

But, 
summary(cast(subset(chick_m, time == 0), diet + chick ~ time, mean,
margins=diet)) returns:

dietchick  0
 1:21   (all)  : 4   Min.   :39.00  
 2:11   18 : 1   1st Qu.:40.85  
 3:11   16 : 1   Median :41.00  
 4:11   15 : 1   Mean   :41.05  
 (all): 0   13 : 1   3rd Qu.:42.00  
9  : 1   Max.   :43.00  
(Other):45  

which shows that it calculated margins on the 'chick' column as well.  this
behavior causes great problems for me when in my data one of the columns is
a non-factor column, eg a Date, but the unrequested margining behavior turns
that column into a factor.

am I missing something?

Thanks,
Mike
-- 
View this message in context: 
http://www.nabble.com/bug-in-%27margins%27-behavior-in-reshape---cast-tp18737649p18737649.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] R -Legality Question about R's Open Source GNU GPL License

2008-07-30 Thread Gavin Simpson
On Wed, 2008-07-30 at 09:50 -0400, Stevens, Martin Henry H. Dr. wrote:
 The limit of use is that you cannot profit from it. It is Open Source.

I think you mean you are unlikely to profit from it if you base your
business model on selling the product and the product is the code;
because it is GPL you have to make the source available and so anyone
could take your source and implement a rival product and probably
undercut you as they don't have to employ any developers...

There is absolutely nothing against profiting from Open Source. Novel is
doing rather nicely these days (albeit somewhat to do with the Microsoft
pact), as is RedHat and a whole plethora of other open source ventures.
But these guys tend to sell support and services for the code they give
away free (as in beer and speech) and don't make money of the code
itself.

G

 
 From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Ajay ohri [EMAIL 
 PROTECTED]
 Sent: Wednesday, July 30, 2008 9:39 AM
 To: r-help@r-project.org
 Subject: [R] R -Legality Question about R's Open Source GNU GPL License
 
 whats the license policy of using r as a SaaS with other apps, priced for a
 fee. I am not sure which license to invoke.
 
 regards,
 
 ajay
 
 [[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.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

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

2008-07-30 Thread Kiran Annaiah
Hello,

A newbie to R. I am trying to use the exonmap package in R. 
According to the docs, the xmapDatabase() command should read the
config file with all the connection parameters and connect to the DB.
But i get the error shown below

 xmapDatabase(Human)
Error in mysqlNewConnection(dbDriver(drv), ...) : 
  RS-DBI driver: (could not connect [EMAIL PROTECTED] on
dbname NA
Error:Access denied for user 'cagadmin'@'cdev.cag.chop.edu' to database
'NA'
)



when i connect to db using dbConnect() it works fine.
conn-dbConnect(drv=MySQL,username=cagadmin )


Anybody who can shed some light on whats going on here?

thank you all

kiran



Kiran Annaiah
Center for Applied Genomics Informatics
Children's Hospital of Philadelphia
267-426-9355

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 -Legality Question about R's Open Source GNU GPL License

2008-07-30 Thread Gavin Simpson
On Wed, 2008-07-30 at 21:05 +0530, [EMAIL PROTECTED] wrote:
 now which license to use?

Use whatever you or your company want to use. As long as it is in
compliance with GPL2 (as that is the licence R currently uses) then you
are fine. As to whether what you intend to do is in compliance with the
GPL2, then you'll find only lay-person comments on this list (as far as
I know there are know lawyers lurking on the list that have raised their
heads...), some informed because they have gone through similar
procedures in their work place/business and others less well informed.

If this is really important to you/your business, then consult a lawyer.

R Core are not lawyers and as such you won't see them contributing to
threads like this, other than to answer the basics (e.g. the what
licence is R released under type question).

 
 it is bad enough explaining SaaS (software as a service), and open
 source and data mining to lawyers, without the experts fighting it as
 well.

I doubt anyone contributing to this thread would call themselves an
expect in this field, and they are not fighting, just offering opinions
- but I wouldn't base my business model on these opinions on GPL,
licensing etc. You need a lawyer for that, preferably one that is
familiar with the computing industry and software licences. This list is
not the place to solicit such advice, as you have found out.

G

 
 and who pays for the cloud computing expenses  for me then if there is
 no money in it. cloud computing doesnt exist in India right now from
 where I am writing this?
 
 regards,
 
 ajay
 decisionstats.com
 
 On 7/30/08, Roland Rau [EMAIL PROTECTED] wrote:
  Hi,
 
  Stevens, Martin Henry H. Dr. wrote:
  The limit of use is that you cannot profit from it. It is Open Source.
 
  I am not sure what you mean exactly. If you mean that you can not earn
  any money selling free software (in terms of the GPL2, which is R's
  licence), this seems to be not the case:
  http://www.fsf.org/licensing/essays/selling.html
 
  Best,
  Roland
 
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

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


Re: [R] bug in 'margins' behavior in reshape - cast

2008-07-30 Thread hadley wickham
On Wed, Jul 30, 2008 at 11:47 AM, mfrumin [EMAIL PROTECTED] wrote:

 according to the documentation of the cast function in the reshape function,
 I would expect this bit of code from the examples to calculate marginal
 means over only the 'diet' variable.

 #Chick weight example
 names(ChickWeight) - tolower(names(ChickWeight))
 chick_m - melt(ChickWeight, id=2:4, na.rm=TRUE)
 cast(chick_m, diet + chick ~ time, mean, margins=diet)

 But,
 summary(cast(subset(chick_m, time == 0), diet + chick ~ time, mean,
 margins=diet)) returns:

dietchick  0
  1:21   (all)  : 4   Min.   :39.00
  2:11   18 : 1   1st Qu.:40.85
  3:11   16 : 1   Median :41.00
  4:11   15 : 1   Mean   :41.05
  (all): 0   13 : 1   3rd Qu.:42.00
9  : 1   Max.   :43.00
(Other):45

 which shows that it calculated margins on the 'chick' column as well.  this
 behavior causes great problems for me when in my data one of the columns is
 a non-factor column, eg a Date, but the unrequested margining behavior turns
 that column into a factor.

 am I missing something?

Hi Mike,

I'm not sure what you want - if you want margins at the diet level,
then you have to margin over all of the chicks at that level, which is
then displayed as (all).  Maybe you want margin  = grand_row ?

Hadley


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

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


Re: [R] odds ratios in multiway tables (stratified)

2008-07-30 Thread Marc Schwartz

on 07/30/2008 08:48 AM Wim Bertels wrote:

Hi,

does anyone know of a function to calculate odds ratios in multiway
tables (stratified) (+ the other usual statistics involved)

i mean:
say we have a table r*c*d,
For every d (depth) we have a r*c table,
and in this table the odds ratio's are calculated for every 2*2 subtable
in it.

logically this function would look like):
ORs(multiwaytable)
or
ORs(data$var1r,data$var2c,data$var3d)

(eg. not taking the lot together, keeping the paradox of simpson in
mind)

mvg,
Wim


In ?mantelhaen.test, there is some code in the examples using the
UCBAdmissions data set. There is also code for the Woolf test in the 
same example.


In addition, there is similar code in the 'vcd' and 'rmeta' CRAN packages.

HTH,

Marc Schwartz

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


[R] best quad core configuration?

2008-07-30 Thread Alan Swanson
I am purchasing a quad-core 64-bit system.  My proposed configuration is an
intel core duo quad with 8Gb memory and an ubuntu OS.  I'm choosing ubunto
because I have good local support, but it doesn't seem as well supported as
debian for R.  Will ubuntu limit me in any significant way?   I have noticed
a bias towards AMD machines among R users - are there compelling reasons to
go with an equivalent AMD system instead?  Will I be able to use amd64
binaries on this system, or would I have to compile everything myself?
Would it difficult to install Intel MKL 10.0 BLAS and LAPACK libraries on
this machine?  Would it be difficult to run both 32-bit and 64-bit versions
of R on this machine?  The most computationally-intensive thing I will be
using the machine for is large MCMC simulations, probably using multiple
instances of LinBUGS.  Any advice on configuring by machine for maximum
speed for these simulations?

Thanks,

Alan Swanson

 


[[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 creating Procrustes Plot in Lattice

2008-07-30 Thread Dylan Beaudette
On Wednesday 30 July 2008, Gavin Simpson wrote:
 On Wed, 2008-07-30 at 04:59 -0700, Andrewjohnclose wrote:
  Hi, I have been trying to create a function to generate a Procrustes
  plot, generated from package vegan
  in lattice.
 
  standard vegan code as follows
  library(vegan)
  pro=protest(P1, P8, permutations=4999,choices=1:4)
  plot(pro)
 
  Now, here is the code for the function that I have failed to get to work
  properly.
 
  panel.procrustes=function(x,y)
  }Pro=protest(x,y,permutations=4999,choices=1:4)
  Proplot=plot(Pro)
  }
  xyplot(P1[1:4]~P8[1:4],panel=panel.procrustes)
 
  I can generate an empty plot, but not much else - hope someone can help
  and point out the obvious!
 
  Kind regards
 
  Andrew

 The obvious thing is that whole thing is wrong! ;-)

 What's wrong with the standard plot?

 You are trying to mix base (standard) graphics functions with
 grid/lattice graphics and this is not possible (well Ok there is package
 gridBase).

 You'll have to start doing the plotting from scratch in
 panel.procrustes. You might get some ideas of how to do this by looking
 at the ordixyplot functions and panel functions in current vegan that
 implement lattice graphics plots for ordiplot objects. I'm not
 sufficiently familiar with Lattice yet to advise how to go about
 producing a panel function, but the basic elements are:

   * draw the points from x$Yrot[, 1:2]
   * draw the arrows from x$Yrot[, 1:2] to x$X[, 1:2]
   * draw the origin - equivalent  of abline(h = 0) and abline(v = 0)
   * draw the rotation involved in the Procrustes analysis: abline(0,
 tan(acos(x$rotation[1, 1])) and abline(0, 1/tan(acos(-x
 $rotation[1, 1]))

 So you'll need the Lattice equivalents of abline and then work out how
 to pass the X, Yrot and rotation components to your panel function. This
 is the bit I'm not clear on but look at ordixyplot and panel.ordi for
 inspiration.


Here is a relatively simple demonstration of creating a custom panel function:

http://casoilresource.lawr.ucdavis.edu/drupal/node/630

Cheers,

Dylan



-- 
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Mixed effects model where nested factor is not the repeated across treatments lme???

2008-07-30 Thread Mark Difford

Hi Miki and Chunhao,

 Rusers (Anna, and Mark {thank you guys}) provide me a vary valuable  
 information.

Also see Gavin Simpson's posting earlier today: apparently multcomp does now
work with lmer objects (it's gone through phases of not working, then
working: it's still being developed). Beware, though, that random effects
are specified differently, so it's not as easy to recast an aov(... +
Error(...)) term structure as an equivalent random effect's structure.

HTH, Mark.


ctu wrote:
 
 Hi Miki,
 I just got the same problem with you couple hours ago.
 Rusers (Anna, and Mark {thank you guys}) provide me a vary valuable  
 information.
 link to following address.
 
 http://www.nabble.com/Tukey-HSD-(or-other-post-hoc-tests)-following-repeated-measures-ANOVA-td17508294.html#a17559307
 for the A vs. B, A vs. C
 You could install and download the multcomp package and perform the  
 post hoc test
 such as
 summary(glht(lmel,linfct=mcp(treatment=Tukey)))
 
 hopefully it helps
 Chunhao
 
 
 Quoting M Ensbey [EMAIL PROTECTED]:
 
 Hi,



 I have searched the archives and can't quite confirm the answer to this.
 I appreciate your time...



 I have 4 treatments (fixed) and I would like to know if there is a
 significant difference in metal volume (metal) between the treatments.
 The experiment has 5 blocks (random) in each treatment and no block is
 repeated across treatments. Within each plot there are varying numbers
 of replicates (random) (some plots have 4 individuals in them some have
 14 and a range in between). NOTE the plots in one treatment are not
 replicated in the others.



 So I end up with a data.frame with 4 treatments repeated down one column
 (treatment=A, B, C, D), 20 plots repeated down the next (block= 1 to 20)
 and records for metal volume (metal- 124 of these)

 I have made treatment and block a factor. But haven't grouped them (do I
 need to and how if so)



 The main question is in 3 parts:



 1.   is this the correct formula to use for this situation:
 lme1-lme(metal~treatment,data=data,random=~1|block) (or is lme even the
 right thing to use here?)



 I get:

 summary(lme1)

 Linear mixed-effects model fit by REML

  Data: data

AIC  BIClogLik

   365.8327 382.5576 -176.9163



 Random effects:

  Formula: ~1 | block

 (Intercept)  Residual

 StdDev:   0.4306096 0.9450976



 Fixed effects: Cu ~ Treatment

  Value Std.Error  DF   t-value p-value

 (Intercept)   5.587839 0.2632831 104 21.223688  0. ***

 TreatmentB -0.970384 0.3729675  16 -2.601792  0.0193 ***

 TreatmentC  -1.449250 0.3656351  16 -3.963651  0.0011 ***

 TreatmentD  -1.319564 0.3633837  16 -3.631323  0.0022 ***

  Correlation:

  (Intr) TrtmAN TrtmCH

 TreatmentB -0.706

 TreatmentC  -0.720  0.508

 TreatmentD  -0.725  0.511  0.522



 Standardized Within-Group Residuals:

 Min  Q1 Med  Q3 Max

 -2.85762206 -0.68568460 -0.09004478  0.56237152  3.20650288



 Number of Observations: 124

 Number of Groups: 20



 2.   if so how can I get p values for comparisons between every
 group... ie is A different from B, is A different from C, is A different
 from D, is B different from C, is B different from D etc... is there a
 way to get all of these instead of just is A different from B, is A
 different from C, is A different from D which summary seems to give?
 3.   last of all what is the best way to print out all the residuals
 for lme... I can get qqplot(lme1) is there a pre-programmed call for
 multiple diagnostic plots like in some other functions...





 Thankyou so Much for your time



 It is much appreciated

 ;-)



 Miki




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

-- 
View this message in context: 
http://www.nabble.com/Mixed-effects-model-where-nested-factor-is-not-the-repeated-across-treatments-lmetp18732327p18738202.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] bug in 'margins' behavior in reshape - cast

2008-07-30 Thread mfrumin

I want the column that is never going to actually have the '(all)' level to
not become of type factor.  continuing the example:

chick_m$diet = as.integer(as.character(chick_m$diet))
is.factor(chick_m$diet) #returns FALSE
is.factor(cast(subset(chick_m, time == 0), diet + chick ~ time, mean,
margins=diet)$diet) #returns TRUE

does that make sense?  the way it works now, it totally screws things up
when the column for which you get margins is not a factor.  in my case, a
date column.

thanks,
Mike



hadley wrote:
 
 On Wed, Jul 30, 2008 at 11:47 AM, mfrumin [EMAIL PROTECTED] wrote:

 according to the documentation of the cast function in the reshape
 function,
 I would expect this bit of code from the examples to calculate marginal
 means over only the 'diet' variable.

 #Chick weight example
 names(ChickWeight) - tolower(names(ChickWeight))
 chick_m - melt(ChickWeight, id=2:4, na.rm=TRUE)
 cast(chick_m, diet + chick ~ time, mean, margins=diet)

 But,
 summary(cast(subset(chick_m, time == 0), diet + chick ~ time, mean,
 margins=diet)) returns:

dietchick  0
  1:21   (all)  : 4   Min.   :39.00
  2:11   18 : 1   1st Qu.:40.85
  3:11   16 : 1   Median :41.00
  4:11   15 : 1   Mean   :41.05
  (all): 0   13 : 1   3rd Qu.:42.00
9  : 1   Max.   :43.00
(Other):45

 which shows that it calculated margins on the 'chick' column as well. 
 this
 behavior causes great problems for me when in my data one of the columns
 is
 a non-factor column, eg a Date, but the unrequested margining behavior
 turns
 that column into a factor.

 am I missing something?
 
 Hi Mike,
 
 I'm not sure what you want - if you want margins at the diet level,
 then you have to margin over all of the chicks at that level, which is
 then displayed as (all).  Maybe you want margin  = grand_row ?
 
 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.
 
 

-- 
View this message in context: 
http://www.nabble.com/bug-in-%27margins%27-behavior-in-reshape---cast-tp18737649p18738699.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] best quad core configuration?

2008-07-30 Thread Vincent Goulet

Le mer. 30 juil. à 13:04, Alan Swanson a écrit :

I am purchasing a quad-core 64-bit system.  My proposed  
configuration is an
intel core duo quad with 8Gb memory and an ubuntu OS.  I'm choosing  
ubunto
because I have good local support, but it doesn't seem as well  
supported as

debian for R.


And what makes you think that? First off, Ubuntu is Debian based, so  
every Debian package (well, the R ones at least) is also in Ubuntu.  
Second, we also provide backports of R for Ubuntu releases down to  
Dapper. I consider this is rather good support; see


http://cran.r-project.org/bin/linux/ubuntu/


 Will ubuntu limit me in any significant way?   I have noticed
a bias towards AMD machines among R users - are there compelling  
reasons to

go with an equivalent AMD system instead?  Will I be able to use amd64
binaries on this system, or would I have to compile everything myself?


As the README file linked above mentions, we provide up-to-date R  
binaries for i386 and amd64.


For your other points, I will let more competent people answer.

---
  Vincent Goulet, Associate Professor
  École d'actuariat
  Université Laval, Québec
  [EMAIL PROTECTED]   http://vgoulet.act.ulaval.ca



Would it difficult to install Intel MKL 10.0 BLAS and LAPACK  
libraries on
this machine?  Would it be difficult to run both 32-bit and 64-bit  
versions
of R on this machine?  The most computationally-intensive thing I  
will be
using the machine for is large MCMC simulations, probably using  
multiple
instances of LinBUGS.  Any advice on configuring by machine for  
maximum

speed for these simulations?

Thanks,

Alan Swanson




[[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] About clustering techniques

2008-07-30 Thread pacomet
Hi Christian

I've been reading about daisy and think I need to do something like..

 mydaisydata - daisy(mydata,metric=c(euclidean),stand=FALSE)
Error en vector(double, length) :
  tamaño del vector especificado es muy grande(which means, specified
vector size is too big)


mydata is an anual file with 14 columns by 124716 rows. Is it possible that
daisy can't handle this data? maybe I'm missing something when using daisy.

Another question, if I get daisy running I can use kmeans like this?

mykmeansdata - kmeans(mydaisydata, 5)

or pamk that I've read it gives the optimal number of clusters.

Thanks again

-- 
_
El ponent la mou, el llevant la plou
Usuari Linux registrat: 363952
---
Fotos: http://picasaweb.google.es/pacomet

[[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] setting editor environment variable EDITOR either when configuring R for installation or in .Rprofile

2008-07-30 Thread Marc Schwartz

on 07/30/2008 12:54 PM Mark Kimpel wrote:

I'm running R on Linux and use emacs as my editor. When doing
edit(vignette(foo.vignette)) I would like to invoke emacs rather than the
default vi. I am able to manually set this by editing $R_HOME/etc/Renviron
but would like to avoid doing this with each install. I assume this can be
accomplished with a flag to .configure or in .Rprofile but I can't find the
syntax in R-admin. Editor is not listed as an environment variable in
appendix B of that manual.

So, help is appreciated as I've probably missed something.
Mark



Mark,

See ?options for 'editor'. This is also referenced in ?edit, where the 
default value for the 'editor' argument is getOption(editor).


Thus, in your .Rprofile, put:

  options(editor=emacs)

HTH,

Marc Schwartz

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


[R] Random subset

2008-07-30 Thread Alessandro
Hi all,

 

I wish to do a random subset (i.e. 200 or 300 points) from a dataset, but I
don't find the right code in R.

 

Thanks for help

 

alessandro


[[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] john chambers R book

2008-07-30 Thread markleeds
Just to let everyone know: John Chambers R book is no longer at 
pre-order status on Amazon which is a good thing. The only problem
is that now it is temporarily out of stock. There must have been many 
pre-orders so now I'm kicking myself for not having done that.



Mark

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


Re: [R] Random subset

2008-07-30 Thread John Kane
?sample


--- On Wed, 7/30/08, Alessandro [EMAIL PROTECTED] wrote:

 From: Alessandro [EMAIL PROTECTED]
 Subject: [R] Random subset
 To: r-help@r-project.org
 Received: Wednesday, July 30, 2008, 2:18 PM
 Hi all,
 
  
 
 I wish to do a random subset (i.e. 200 or 300 points) from
 a dataset, but I
 don't find the right code in R.
 
  
 
 Thanks for help
 
  
 
 alessandro
 
 
   [[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]]

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


[R] Re gression between columns in matrix - with some/full NAs

2008-07-30 Thread rcoder

Hi Anna,

Thanks for your reply and suggestions. I'm trying something different, based
on regression this time, albeit giving similar problems. I want to regress a
single column in a matrix with each other column in the same matrix, and o/p
the intercept and slope coefficients to a results matrix. 

The loop below works, even when I have columns with partial NAs, but exits
with an error when a column with only NAs is encountered. So, the
'na.action=NULL' statement (see last line of code below) doesn't seem to
work in this case, or perhaps I am applying it incorrectly. I would be very
grateful for any pointers in the right direction:

tt-time(SourceMat)
ResultMat-matrix(NA, ncol=colnum, nrow=rownum) #creates an o/p
template matrix

#loop through each column in the source matrix:
for (i in 1:5000)
{
sel_col-[col(SourceMat)==i]#selecting the correct column in the 
matrix in
turn
SourceMat[,i]-coef(lm(tt~sel_col), na.action=NULL)
}


Thanks,

rcoder



rcoder wrote:
 
 Hi everyone,
 
 I'm having trouble applying the Cor() function to two matrices, both of
 which contain NAs. I am doing the following:
 
 a-cor(m1, m2, use=complete.obs)
 
 ... and I get the following error message:
 
 Error in cor(m1, m2, use = complete.obs) : 
   no complete element pairs
 
 Does anyone know how I can apply a correlation, ignoring any NAs?
 
 Thanks,
 
 rcoder
 

-- 
View this message in context: 
http://www.nabble.com/correlation-between-matrices---both-with-some-NAs-tp18721853p18739148.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] Random subset

2008-07-30 Thread Roland Rau

Hi,

check
?sample

n - 200
mydata.set - rnorm(10)
my.random.subset - sample(x=mydata.set, size=n, replace=TRUE)

my.random.subset


I hope this helps,
Roland



Alessandro wrote:

Hi all,

 


I wish to do a random subset (i.e. 200 or 300 points) from a dataset, but I
don't find the right code in R.

 


Thanks for help

 


alessandro


[[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] History pruning

2008-07-30 Thread Ken Williams
Hi,

I find that a typical workflow for me looks something like this:

1) import some data from files
2) mess around with the data for a while
3) mess around with plotting for a while
4) get a plot or analysis that looks good
5) go back through my history to make a list of the shortest command
sequence to recreate the plot or analysis
6) send out that sequence to colleagues, along with the generated plots
or analysis output

I wonder if there are any tools people have developed to help with step
5.  Typically I do something like this:

5a) save my entire history to a text file
5b) open it up in Emacs
5c) prune any lines that don't have assignment operators
5d) prune any plotting commands that were superseded by later plots

and then start on other more subtle stuff like pruning assignments that
were later overwritten, unless the later assignments have variable
overlap between the LHS and the RHS.  Then I just start eyeballing it.

Would any deeper introspection of the history expressions be feasible,
e.g. detecting statements that have no side effects, dead ends, etc.

The holy grail would be something like show me all the statements that
contributed to the current plot or the like.

Thanks.

-- 
Ken Williams
Research Scientist
The Thomson Reuters Corporation
Eagan, MN

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

2008-07-30 Thread R_Learner

Hi all,
  I have this string year and integer 2008 (both are inputs from the
user), and I would like to make a variable called year2008 that will store
a vector of numbers. Does anyone know how to do this? 

  Also, if the user later input year and 2008, how do I treat this as a
variable; how can I access the variable year2008 using the string
paste(year,2008,sep=)?

Thanks so much!
-- 
View this message in context: 
http://www.nabble.com/Variable-name-in-a-String-tp18738356p18738356.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] rolling regression between adjacent columns

2008-07-30 Thread rcoder

Well, in this case I don't think my original code would have helped much...

So, I've rewritten as below. I want to perform regression between one column
in a matrix and all other columns in the same matrix. I have a for loop to
achieve this, which succeeds in exporting intercept and slope coefficients
to a results matrix, except when a column that contains only NAs is reached.
Columns partially filled with NAs are handled, but the code exits with
errors when a single column is filled with NAs. I inserted the
'na.action=NULL' statement within the lm() construct, but to no avail. I
would be very grateful for any advice.

tt-time(SourceMat) 
ResultMat-matrix(NA, ncol=colnum, nrow=rownum) #creates an o/p
template matrix 

#loop through each column in the source matrix: 
for (i in 1:5000) 
{ 
sel_col-[col(SourceMat)==i] #selecting the correct column in the
matrix in turn 
SourceMat[,i]-coef(lm(tt~sel_col), na.action=NULL) 
}

Thanks,

rcoder


Gabor Grothendieck wrote:
 
 Read the last line of every message to r-help.
 
 On Tue, Jul 29, 2008 at 6:15 PM, rcoder [EMAIL PROTECTED] wrote:

 Hi everyone,

 I am trying to apply linear regression to adjacent columns in a matrix
 (i.e.
 col1~col2; col3~col4; etc.). The columns in my matrix come with
 identifiers
 at the top of each column, but when I try to use these identifiers to
 reference the columns in the regression function using rollapply(), the
 columns are not recognised and the regression breaks down. Is there a
 more
 robust way to reference the columns I need, so that I can apply the
 regression across the matrix; 'by.column', but every other column?

 Thanks,

 rcoder
 --
 View this message in context:
 http://www.nabble.com/rolling-regression-between-adjacent-columns-tp18722392p18722392.html
 Sent from the R help mailing list archive at Nabble.com.

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

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

-- 
View this message in context: 
http://www.nabble.com/rolling-regression-between-adjacent-columns-tp18722392p18739292.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] Random subset

2008-07-30 Thread Roland Rau
But probably you will need to set replace=FALSE if you want to sample 
from your original data set without replacement.


Sorry for the possible confusion,
Roland


Roland Rau wrote:

Hi,

check
?sample

n - 200
mydata.set - rnorm(10)
my.random.subset - sample(x=mydata.set, size=n, replace=TRUE)

my.random.subset


I hope this helps,
Roland



Alessandro wrote:

Hi all,

 

I wish to do a random subset (i.e. 200 or 300 points) from a dataset, 
but I

don't find the right code in R.

 


Thanks for help

 


alessandro


[[alternative HTML version deleted]]

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

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



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

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



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


[R] System exit codes

2008-07-30 Thread Ranjan Bagchi

Hi --

Is there a way of detecting the exit code while calling system or pipe?
eg (on Unix)


system(perl -e 'print \foo\\\n\;exit(-1);')

foo

Any help appreciated,

Ranjan

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