Re: [R] Multiple lag.plots per page

2006-06-13 Thread Prof Brian Ripley
On Tue, 13 Jun 2006, Gad Abraham wrote:

> Hi,
>
> I'm trying to plot several lag.plots on a page, however the second plot
> replaces the first one (although it only takes up the upper half as it
> should):
>
> par(mfrow=c(2,1))
> a<-sin(1:100)
> b<-cos(1:100)
> lag.plot(a)
> lag.plot(b)
>
> What's the trick to this?

lag.plot itself calls par(mfrow).  The trick is to get one call to do the 
plots you want:

lag.plot(cbind(a,b))


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


Re: [R] Multiple lag.plots per page

2006-06-13 Thread Gad Abraham
Prof Brian Ripley wrote:
> On Tue, 13 Jun 2006, Gad Abraham wrote:
> 
>> Hi,
>>
>> I'm trying to plot several lag.plots on a page, however the second plot
>> replaces the first one (although it only takes up the upper half as it
>> should):
>>
>> par(mfrow=c(2,1))
>> a<-sin(1:100)
>> b<-cos(1:100)
>> lag.plot(a)
>> lag.plot(b)
>>
>> What's the trick to this?
> 
> lag.plot itself calls par(mfrow).  The trick is to get one call to do 
> the plots you want:
> 
> lag.plot(cbind(a,b))
> 
> 

Thanks, that works great for multiple lag.plots. Is it possible to have 
a lag.plot and another type of plot on the same page? The second plot() 
always replaces the lag.plot for me.

Cheers,
Gad

-- 
Gad Abraham
Department of Mathematics and Statistics
University of Melbourne
Victoria 3010, Australia
email: [EMAIL PROTECTED]
web: http://www.ms.unimelb.edu.au/~gabraham

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


Re: [R] Multiple lag.plots per page

2006-06-13 Thread Prof Brian Ripley
On Tue, 13 Jun 2006, Gad Abraham wrote:

> Prof Brian Ripley wrote:
>> On Tue, 13 Jun 2006, Gad Abraham wrote:
>> 
>>> Hi,
>>> 
>>> I'm trying to plot several lag.plots on a page, however the second plot
>>> replaces the first one (although it only takes up the upper half as it
>>> should):
>>> 
>>> par(mfrow=c(2,1))
>>> a<-sin(1:100)
>>> b<-cos(1:100)
>>> lag.plot(a)
>>> lag.plot(b)
>>> 
>>> What's the trick to this?
>> 
>> lag.plot itself calls par(mfrow).  The trick is to get one call to do the 
>> plots you want:
>> 
>> lag.plot(cbind(a,b))
>> 
>> 
>
> Thanks, that works great for multiple lag.plots. Is it possible to have a 
> lag.plot and another type of plot on the same page? The second plot() always 
> replaces the lag.plot for me.

Yes, if the other plot is second, e.g

par(mfrow=c(2,1))
a<-sin(1:100)
lag.plot(a)
par(mfg=c(2,1)) # move to second plot
plot(1:10)


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


Re: [R] R usage for log analysis

2006-06-13 Thread Gabriel Diaz
Hello

thanks for the point, probably i saw DBMS as a need due to my ignorance about R.

If i can process all files like you said, i would not use DBMS as i
prefer to keep it simple and easy to manage and run, less software
dependencies the better.

thanks

gabi


On 6/12/06, bogdan romocea <[EMAIL PROTECTED]> wrote:
> I wouldn't use a DBMS at all -- it is not necessary and I don't see
> what you would get in return. Instead I would split very large log
> files into a number of pieces so that each piece fits in memory (see
> below for an example), then process them in a loop. See the list and
> the documentation if you have questions about how to read text files,
> count strings etc.
>
> #---split big files in two---
> for F in `ls *log`
> do
>   fn=`echo $F | awk -F\. '{print $1}'`
>   ln=`wc -l $F | awk '{print $1}'`  #number of lines in the file
>   forsplit=`expr $ln / 2 + 50`  #no. of lines in each chunk, tweak as needed
>   echo Splitting $F into pieces of $forsplit lines each
>   split -l $forsplit $F $fn
> done
>
>
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Gabriel Diaz
> > Sent: Monday, June 12, 2006 9:52 AM
> > To: Jean-Luc Fontaine
> > Cc: r-help@stat.math.ethz.ch
> > Subject: Re: [R] R usage for log analysis
> >
> > Hello
> >
> > Thanks all for the answers.
> >
> > I'm taking an overview to the project documentation, and seems the
> > database is the way to go to handle log files of GB order (normally
> > between 2 and 4 GB each 15 day dump).
> >
> > In this document http://cran.r-project.org/doc/manuals/R-data.html,
> > says R will load all data into memory to process it when using
> > read.table and such. Using a database will do the same? Well,
> > currently i have no machine with > 2 GB of memory.
> >
> > The moodss thing looks nice, thanks for the link. But what i have to
> > do now is an offline analysis of big log files :-). I will try to go
> > with the mysql -> R way.
> >
> > gabi
> >
> >
> >
> > On 6/12/06, Jean-Luc Fontaine <[EMAIL PROTECTED]> wrote:
> > > -BEGIN PGP SIGNED MESSAGE-
> > > Hash: SHA1
> > >
> > > Allen S. Rout wrote:
> > > >
> > > >
> > > > Don't expect a warm welcome.  This community is like all
> > open-source
> > > > communities, sharply focused on its' own concerns and
> > expertise.  And,
> > > > in an unusual experience for computer types, our core competencies
> > > > hold little or no sway here; they don't even give us much
> > of a leg up.
> > > > Just wait 'till you want to do something nutso like
> > produce a business
> > > > graphic. :)
> > > >
> > > > I'm working on understanding enough of R packaging and
> > documentation
> > > > to begin a 'task view' focused on systems administration,
> > for humble
> > > > submission. That might end up being mostly "log
> > analysis"; the term
> > > > can describe much of what we do, if it's stretched a bit.
> >  I'm hoping
> > > > the task view will attract the teeming masses of
> > sysadmins trapped in
> > > > the mire of Gnuplot and friends.
> > > Although not specifically solving the problem at hand, you
> > might want
> > > to take a look at moodss and moomps
> > (http://moodss.sourceforge.net/),
> > > modular monitoring applications, which uses R
> > > (http://jfontain.free.fr/statistics.htm) and its log module
> > > (http://jfontain.free.fr/log/log.htm).
> > >
> > > - --
> > > Jean-Luc Fontaine  http://jfontain.free.fr/
> > > -BEGIN PGP SIGNATURE-
> > > Version: GnuPG v1.4.3 (GNU/Linux)
> > > Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
> > >
> > > iD8DBQFEjT2ykG/MMvcT1qQRAuF6AJ9nf5phV/GMmCHPuc5bVyA+SoXqGACgnLuZ
> > > u1tZpFOTCHNKOfFLZOC9uXI=
> > > =V8yo
> > > -END PGP SIGNATURE-
> > >
> > > __
> > > R-help@stat.math.ethz.ch mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html
> > >
> >
> > __
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html
> >
>

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


Re: [R] plot two graphs with different length of data

2006-06-13 Thread Joerg van den Hoff
Eric Hu wrote:
> Hi I am trying to plot two data set in the same picture window without
> overlapping with each other. I am using the format plot(x1,y1,x2,y2)
> but get the following error message:
> 
>> plot(as.numeric(r0[,4]),as.numeric(r0[,7]),as.numeric(r0[,4]),as.numeric(r0[,7][ind[,1]]))
> Error in plot.window(xlim, ylim, log, asp, ...) :
> invalid 'ylim' value
> 
> Can anyone tell me what went wrong? Thanks.
> 
> Eric
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


matplot(cbind(x1,x2), cbind(y1,y2)) might be what you want.

(if x1, x2 and y1,y2 are of equal length. otherwise pad the short  ones 
with NAs or use  `matplot' with type =n (to get the scaling of the plot 
right), followed by `plot(x1,y1), lines(x2,y2)')

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


[R] Predict with loess

2006-06-13 Thread Jouanin Celine
I want to do a  nonparametric regression. I’m using the function loess.
  The variable are  the year from 1968 to 1977 and the dependant variable 
is  a proportion P. The dependant variable have  missing value (NA). 
  The script is :
   
  year <- 1969:2002
  length(year) 
  [1] 34
   
  P <- c(NA,0.1,0.56,NA,NA,0.5,0.4,0.75,0.9,
  0.98,0.2,0.56,0.7,0.89,0.3,0.1,0.45,0.46,0.49,0.78,
  0.25,0.79,0.23,0.26,0.46,0.12,0.56,0.8,0.55,0.41,
  0.36,0.9,0.22,0.1)
  length(P)
  [1] 34
   
  lo1 <- loess(P~year,span=0.3,degree=1)
  summary(lo1)
   
  yearCo <- 1969:2002
  year_lo <- data.frame(year = yearCo )
  length(year_lo)
  [1] 34
   
  mlo <- predict(loess(P~year,span=0.3,degree=1),new.data=year_lo,se=T)
  mlo$fit
  mlo$se.fit
   
  plot(year,P,type='o')
  lines(year,predict(loess(P~year,span=0.15,degree=1),new.data=year_lo,
  se=T,na.action=na.omit)$fit,col='blue',type='l')
   
  The message error  indicates that x and y don’t have the same length.
   
  In fact in m$fit  and m$se.fit there are 3 values who don’t   have a 
fitted value. 
   
  There is no predicted value when the dependant variable have  a NA. The 
synthase na.action=na.omit don’t seem to ignore the missing value, generating  
an error.
  What is the source, the solution to my problem?
  Thanks for the help
  CélineI want to do a  nonparametric regression. I’m using the 
function loess.
  The variable are  the year from 1968 to 1977 and the dependant variable 
is  a proportion P. The dependant variable have  missing value (NA). 
  The script is :
   
  year <- 1969:2002
  length(year) 
  [1] 34
   
  P <- c(NA,0.1,0.56,NA,NA,0.5,0.4,0.75,0.9,
  0.98,0.2,0.56,0.7,0.89,0.3,0.1,0.45,0.46,0.49,0.78,
  0.25,0.79,0.23,0.26,0.46,0.12,0.56,0.8,0.55,0.41,
  0.36,0.9,0.22,0.1)
  length(P)
  [1] 34
   
  lo1 <- loess(P~year,span=0.3,degree=1)
  summary(lo1)
   
  yearCo <- 1969:2002
  year_lo <- data.frame(year = yearCo )
  length(year_lo)
  [1] 34
   
  mlo <- predict(loess(P~year,span=0.3,degree=1),new.data=year_lo,se=T)
  mlo$fit
  mlo$se.fit
   
  plot(year,P,type='o')
  lines(year,predict(loess(P~year,span=0.15,degree=1),new.data=year_lo,
  se=T,na.action=na.omit)$fit,col='blue',type='l')
   
  The message error  indicates that x and y don’t have the same length.
   
  In fact in m$fit  and m$se.fit there are 3 values who don’t   have a 
fitted value. 
   
  There is no predicted value when the dependant variable have  a NA. The 
synthase na.action=na.omit don’t seem to ignore the missing value, generating  
an error.
  What is the source, the solution to my problem?
  Thanks for the help
  Céline
 __



[[alternative HTML version deleted]]

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

Re: [R] plotting gaussian data

2006-06-13 Thread Jacques VESLOT
curve(coef$A * dnorm(x, coef$mu, coef$sig), -4, 4)

---
Jacques VESLOT

CNRS UMR 8090
I.B.L (2ème étage)
1 rue du Professeur Calmette
B.P. 245
59019 Lille Cedex

Tel : 33 (0)3.20.87.10.44
Fax : 33 (0)3.20.87.10.31

http://www-good.ibl.fr
---


H. Paul Benton a écrit :
> Ok I guess it's time to ask. 
> So I want to plot my data. It's my data from a frequency table, "temp". My
> formula is just a Gaussian eq. I have done the nls function to get my
> parameters and now I want to do the whole plot (...) and then lines(..)
> This is what I have done. 
> 
> 
>>temp
> 
> bin   x
> 1  -4.0   0
> 2  -3.9   0
> 3  -3.8   0
> 4  -3.7   0
> 5  -3.6   0
> 6  -3.5   0  and so on
> 
>>fo
> 
> x ~ (A/(sig * sqrt(2 * pi))) * exp(-1 * ((bin - mu)^2/(2 * sig^2)))
> 
>>fo.v
> 
> x ~ (335.48/(0.174 * sqrt(2 * pi))) * exp(-1 * ((bin - (-0.0786))^2/(2 * 
> 0.174^2)))
> 
>>coef
> 
> $A
> [1] 335.4812
> 
> $mu
> [1] -0.07863746
> 
> $sig
> [1] 0.1746473
> 
> plot(fo, temp, coef)
> Error in eval(expr, envir, enclos) : object "sig" not found
> 
>>plot(fo, coef, temp)
> 
> Error in eval(expr, envir, enclos) : object "x" not found
> 
>>plot(fo, temp, list=coef)
>>
> 
> 
> If someone could point me in the right direction I would be very grateful. 
> 
> Cheers,
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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


Re: [R] Predict with loess

2006-06-13 Thread Prof Brian Ripley

On Tue, 13 Jun 2006, Jouanin Celine wrote:


   I want to do a  nonparametric regression. I’m using the function loess.
 The variable are  the year from 1968 to 1977 and the dependant variable is 
 a proportion P. The dependant variable have  missing value (NA).
 The script is :

 year <- 1969:2002
 length(year)
 [1] 34

 P <- c(NA,0.1,0.56,NA,NA,0.5,0.4,0.75,0.9,
 0.98,0.2,0.56,0.7,0.89,0.3,0.1,0.45,0.46,0.49,0.78,
 0.25,0.79,0.23,0.26,0.46,0.12,0.56,0.8,0.55,0.41,
 0.36,0.9,0.22,0.1)
 length(P)
 [1] 34

 lo1 <- loess(P~year,span=0.3,degree=1)
 summary(lo1)
 yearCo <- 1969:2002
 year_lo <- data.frame(year = yearCo )
 length(year_lo)
 [1] 34


I get 1 here, and so should you.


 mlo <- predict(loess(P~year,span=0.3,degree=1),new.data=year_lo,se=T)


It should be newdata, not new.data


 mlo$fit
 mlo$se.fit


Notice that these are of length 31, not 34

You are trying to predict at the values used for fitting (possibly not 
what you intended), so you don't actually need this.  Try


lo1 <- loess(P~year,span=0.3,degree=1, na.action=na.exclude)
fitted(lo1)
plot(year,P,type='o')
lines(year, fitted(lo1))

Or if you want to try interpolation

lines(year, predict(lo1, newdata=year_lo))

This will not extrapolate to 1969, and as far as I recall the version of 
loess in R does not allow extrapolation.



 plot(year,P,type='o')
 lines(year,predict(loess(P~year,span=0.15,degree=1),new.data=year_lo,
 se=T,na.action=na.omit)$fit,col='blue',type='l')

 The message error  indicates that x and y don’t have the same length.


 In fact in m$fit and m$se.fit there are 3 values who don’t have a 
fitted value.


Correct, and that's because you used na.action=na.omit and did not specify 
newdata.


[...]

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

[R] Garch Warning

2006-06-13 Thread Arun Kumar Saha
Dear all R-users,

I wanted to fit a Garch(1,1) model to a dataset by:

>garch1 = garch(na.omit(dat))

But I got a warning message while executing, which is:

>Warning message:
>NaNs produced in: sqrt(pred$e)

The garch parameters that I got are:


> garch1

Call:
garch(x = na.omit(dat))

Coefficient(s):
   a0 a1 b1
1.212e-04  1.001e+00  1.111e-14

Can any one please tell me that why got this message? What is the remedy?

Thanks and Regards

[[alternative HTML version deleted]]

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


[R] bubbleplot for matrix

2006-06-13 Thread Albert Vilella
Hi all,

I would like to ask if it is possible to use bubbleplot for a 20x20
matrix, instead of a dataframe with factors in columns.

The idea would be to get a tabular representation with bubbles like in
Rnews_2006_2 article, which look very nice.

Thanks in advance,

Albert.

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


[R] Slight fault in error messages

2006-06-13 Thread Yan Wong
Just a quick point which may be easy to correct. Whilst typing the  
wrong thing into R 2.2.1, I noticed the following error messages,  
which seem to have some stray quotation marks and commas in the list  
of available families. Perhaps they have been corrected in the latest  
version (sorry, I don't want to upgrade yet, but it should be easy to  
check)?

 > glm(1 ~ 2, family=quasibinomial(link=foo))
Error in quasibinomial(link = foo) : ‘foo’ link not available for  
quasibinomial family, available links are "logit", ", ""probit" and  
"cloglog"

 > glm(1 ~ 2, family=binomial(link=foo))
Error in binomial(link = foo) : link "foo" not available for binomial  
family, available links are "logit", ""probit", "cloglog", "cauchit"  
and "log"

I hope this is helpful,

Yan

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


[R] sorting matrix elements by given rownames and colnames

2006-06-13 Thread Albert Vilella
Hi all,

I would like to know if it is possible to sort the columns and rows in
a matrix given a specified order of their colnames and rownames. For
example:

I would like the original matrix:
  
 RNO  FRU   ANG  CEL  DAR  PTR
RNO 3.45 1.35  2.16 2.25 1.43 1.20
FRU 1.31  Inf  2.22 2.36 1.34 1.40
ANG 1.30 1.30 11.61 1.37 1.33 1.35
CEL 1.34 1.35  1.37  Inf 1.37 1.40
DAR 1.40 1.29  2.29 2.39 9.62 1.48
PTR 1.08 1.30  2.06 2.17 1.39 8.17

To be sorted in a top/down and left/right way in this order
instead: "FRU","ANG","CEL","PTR","RNO","DAR".

Thanks in advance,

Albert.

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


[R] COX FRAILTY

2006-06-13 Thread denis lalountas
Dear R users,
   
  Suppose that I generate the following :

  library(survival)
set.seed(123)
n=200 
x=rbinom(n,size=1,prob=0.5)
v=rep(rgamma(n/2,shape=1,scale=1),2)
w=rweibull(n,shape=1,scale=1)
b=-log(2)
t=exp(-x*b-log(v)+log(w))
c=rep(1,n)
id=rep(seq(1:(n/2)),2)
group=rep(1:(n/10),10)
fit2=coxph(Surv(t,c)~x+frailty(id,dist="gamma",sparce=T,method="em"))
   
  Using the command "fit2$frail" 
  I get the id level frailty terms ,
Some of the frailty terms are negative ,
 so Survival package gives not v but log(v)
Am I wrong ?

  best regards,
  D.Lalountas
University of Patras


 __



[[alternative HTML version deleted]]

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


Re: [R] sorting matrix elements by given rownames and colnames

2006-06-13 Thread Chuck Cleland
Albert Vilella wrote:
> Hi all,
> 
> I would like to know if it is possible to sort the columns and rows in
> a matrix given a specified order of their colnames and rownames. For
> example:
> 
> I would like the original matrix:
>   
>  RNO  FRU   ANG  CEL  DAR  PTR
> RNO 3.45 1.35  2.16 2.25 1.43 1.20
> FRU 1.31  Inf  2.22 2.36 1.34 1.40
> ANG 1.30 1.30 11.61 1.37 1.33 1.35
> CEL 1.34 1.35  1.37  Inf 1.37 1.40
> DAR 1.40 1.29  2.29 2.39 9.62 1.48
> PTR 1.08 1.30  2.06 2.17 1.39 8.17
> 
> To be sorted in a top/down and left/right way in this order
> instead: "FRU","ANG","CEL","PTR","RNO","DAR".

X <- round(matrix(rnorm(36), ncol=6), 2)

colnames(X) <- c("RNO", "FRU", "ANG", "CEL", "DAR", "PTR")

rownames(X) <- c("RNO", "FRU", "ANG", "CEL", "DAR", "PTR")

myord <- c("FRU", "ANG", "CEL", "PTR", "RNO", "DAR")

X
   RNO   FRU   ANG   CEL   DAR   PTR
RNO -0.99  0.03 -0.78 -0.55  0.01 -0.64
FRU -0.50 -0.67  2.05  0.28  0.86  0.20
ANG -0.87  0.48 -0.26  0.00 -0.39 -0.18
CEL -0.71  0.55  1.32  0.36 -0.53 -0.53
DAR  0.92 -1.28  0.92 -0.19  0.56 -0.86
PTR -0.60 -0.95 -0.17 -1.23  0.41 -0.36

X[myord,myord]
   FRU   ANG   CEL   PTR   RNO   DAR
FRU -0.67  2.05  0.28  0.20 -0.50  0.86
ANG  0.48 -0.26  0.00 -0.18 -0.87 -0.39
CEL  0.55  1.32  0.36 -0.53 -0.71 -0.53
PTR -0.95 -0.17 -1.23 -0.36 -0.60  0.41
RNO  0.03 -0.78 -0.55 -0.64 -0.99  0.01
DAR -1.28  0.92 -0.19 -0.86  0.92  0.56

> Thanks in advance,
> 
> Albert.
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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

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


[R] levelplot and source() problems

2006-06-13 Thread Niels Vestergaard Jensen
I have been using levelplot but have had trouble calling it inside
functions - something seems to go wrong when it's not called directly from
the R command prompt. Simplest reproducible example:

$ R --vanilla
> library(lattice)
> levelplot(matrix(1:4,2,2))

- This gives a nice plot in soothing pastel colors.

Now, with a file lptest.r containing 2 lines:

library(lattice)
levelplot(matrix(11:14,2,2))

> source("lptest.r")

Gives nothing.

I've tried closing all devices and setting it with X11() and pdf().

Am I missing something here or should I file a bug report? I'm running R
Version 2.2.1 (2005-12-20 r36812) on Red Hat, lattice library v. 0.12-11

With the (more complex) example where I ran into this barrier I also
debugged the function calling levelplot. I could call levelplot from the
browser with nice results, but when the function executed the exact same
command in the next moment nothing happened.

I've pasted the output of debug(levelplot) when sourcing lptest.r below,
it's very much like what went on in the more complex example.

best

Niels


Debugging levelplot:


> library(lattice)
> debug(levelplot)
> source("lptest.r")
[1] "test"
debugging in: levelplot(matrix(11:14, 2, 2))
debug: {
ocall <- match.call()
formula <- ocall$formula
if (!is.null(formula)) {
warning("The 'formula' argument has been renamed to 'x'. See
?xyplot")
ocall$formula <- NULL
if (!("x" %in% names(ocall)))
ocall$x <- formula
else warning("'formula' overridden by 'x'")
eval(ocall, parent.frame())
}
else UseMethod("levelplot")
}
Browse[1]>
debug: ocall <- match.call()
Browse[1]>
debug: formula <- ocall$formula
Browse[1]>
debug: if (!is.null(formula)) {
warning("The 'formula' argument has been renamed to 'x'. See ?xyplot")
ocall$formula <- NULL
if (!("x" %in% names(ocall)))
ocall$x <- formula
else warning("'formula' overridden by 'x'")
eval(ocall, parent.frame())
} else UseMethod("levelplot")
Browse[1]>
debugging in: levelplot(form, data, aspect = aspect, ...)
debug: {
ocall <- match.call()
formula <- ocall$formula
if (!is.null(formula)) {
warning("The 'formula' argument has been renamed to 'x'. See
?xyplot")
ocall$formula <- NULL
if (!("x" %in% names(ocall)))
ocall$x <- formula
else warning("'formula' overridden by 'x'")
eval(ocall, parent.frame())
}
else UseMethod("levelplot")
}
Browse[1]>
debug: ocall <- match.call()
Browse[1]>
debug: formula <- ocall$formula
Browse[1]>
debug: if (!is.null(formula)) {
warning("The 'formula' argument has been renamed to 'x'. See ?xyplot")
ocall$formula <- NULL
if (!("x" %in% names(ocall)))
ocall$x <- formula
else warning("'formula' overridden by 'x'")
eval(ocall, parent.frame())
} else UseMethod("levelplot")
Browse[1]>
exiting from: levelplot(form, data, aspect = aspect, ...)
exiting from: levelplot(matrix(11:14, 2, 2))
>

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


Re: [R] levelplot and source() problems

2006-06-13 Thread Gabor Grothendieck
This is 7.22 of the R FAQ:

http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f

On 6/13/06, Niels Vestergaard Jensen <[EMAIL PROTECTED]> wrote:
> I have been using levelplot but have had trouble calling it inside
> functions - something seems to go wrong when it's not called directly from
> the R command prompt. Simplest reproducible example:
>
> $ R --vanilla
> > library(lattice)
> > levelplot(matrix(1:4,2,2))
>
> - This gives a nice plot in soothing pastel colors.
>
> Now, with a file lptest.r containing 2 lines:
>
> library(lattice)
> levelplot(matrix(11:14,2,2))
>
> > source("lptest.r")
>
> Gives nothing.
>
> I've tried closing all devices and setting it with X11() and pdf().
>
> Am I missing something here or should I file a bug report? I'm running R
> Version 2.2.1 (2005-12-20 r36812) on Red Hat, lattice library v. 0.12-11
>
> With the (more complex) example where I ran into this barrier I also
> debugged the function calling levelplot. I could call levelplot from the
> browser with nice results, but when the function executed the exact same
> command in the next moment nothing happened.
>
> I've pasted the output of debug(levelplot) when sourcing lptest.r below,
> it's very much like what went on in the more complex example.
>
> best
>
>Niels
>
>
> Debugging levelplot:
>
>
> > library(lattice)
> > debug(levelplot)
> > source("lptest.r")
> [1] "test"
> debugging in: levelplot(matrix(11:14, 2, 2))
> debug: {
>ocall <- match.call()
>formula <- ocall$formula
>if (!is.null(formula)) {
>warning("The 'formula' argument has been renamed to 'x'. See
> ?xyplot")
>ocall$formula <- NULL
>if (!("x" %in% names(ocall)))
>ocall$x <- formula
>else warning("'formula' overridden by 'x'")
>eval(ocall, parent.frame())
>}
>else UseMethod("levelplot")
> }
> Browse[1]>
> debug: ocall <- match.call()
> Browse[1]>
> debug: formula <- ocall$formula
> Browse[1]>
> debug: if (!is.null(formula)) {
>warning("The 'formula' argument has been renamed to 'x'. See ?xyplot")
>ocall$formula <- NULL
>if (!("x" %in% names(ocall)))
>ocall$x <- formula
>else warning("'formula' overridden by 'x'")
>eval(ocall, parent.frame())
> } else UseMethod("levelplot")
> Browse[1]>
> debugging in: levelplot(form, data, aspect = aspect, ...)
> debug: {
>ocall <- match.call()
>formula <- ocall$formula
>if (!is.null(formula)) {
>warning("The 'formula' argument has been renamed to 'x'. See
> ?xyplot")
>ocall$formula <- NULL
>if (!("x" %in% names(ocall)))
>ocall$x <- formula
>else warning("'formula' overridden by 'x'")
>eval(ocall, parent.frame())
>}
>else UseMethod("levelplot")
> }
> Browse[1]>
> debug: ocall <- match.call()
> Browse[1]>
> debug: formula <- ocall$formula
> Browse[1]>
> debug: if (!is.null(formula)) {
>warning("The 'formula' argument has been renamed to 'x'. See ?xyplot")
>ocall$formula <- NULL
>if (!("x" %in% names(ocall)))
>ocall$x <- formula
>else warning("'formula' overridden by 'x'")
>eval(ocall, parent.frame())
> } else UseMethod("levelplot")
> Browse[1]>
> exiting from: levelplot(form, data, aspect = aspect, ...)
> exiting from: levelplot(matrix(11:14, 2, 2))
> >
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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


Re: [R] levelplot and source() problems

2006-06-13 Thread Prof Brian Ripley
On Tue, 13 Jun 2006, Niels Vestergaard Jensen wrote:

> I have been using levelplot but have had trouble calling it inside
> functions - something seems to go wrong when it's not called directly from
> the R command prompt. Simplest reproducible example:
>
> $ R --vanilla
>> library(lattice)
>> levelplot(matrix(1:4,2,2))
>
> - This gives a nice plot in soothing pastel colors.
>
> Now, with a file lptest.r containing 2 lines:
>
> library(lattice)
> levelplot(matrix(11:14,2,2))
>
>> source("lptest.r")
>
> Gives nothing.
>
> I've tried closing all devices and setting it with X11() and pdf().
>
> Am I missing something here or should I file a bug report? I'm running R
> Version 2.2.1 (2005-12-20 r36812) on Red Hat, lattice library v. 0.12-11

See R FAQ Q7.22.  (Please don't file a bug report on an FAQ using an old 
version of R: the posting guide did instruct you to upgrade before 
posting.)

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


[R] problem with write.table

2006-06-13 Thread David Hajage
Hello,

I have a data frame :

> linkptpn[1:6,]
   pedigree id fa mo sex status rs3789604 rs3811021 rs1217413 ss38346942
1 1  1  0  0   1  2
2 1  2  0  0   2  2
3 1  3  1  2   2  3   3/3   2/2   3/34/4
4 1  4  1  2   2  3   3/3   2/4   3/32/2
5 2  1  0  0   1  2
6 2  2  0  0   2  3

I would like to use write.table :

> write.table(linkptpn, "/home/biostat/david/genetique/linkptpn.csv")
Erreur dans write.table(x, file, nrow(x), p, rnames, sep, eol, na, dec,
as.integer(quote),  :
type 'list' indisponible dans 'EncodeElement'

R says that my variables are 'list'. Indeed :

> apply(linkptpn, 2, class)
  pedigree id fa mosex status  rs3789604

"list" "list" "list" "list" "list" "list" "list"

 rs3811021  rs1217413 ss38346942  rs1217388 ss38346943  rs1310182 ss38346944

"list" "list" "list"

I would like to transform everything into a pure data.frame. I tried :

> apply(linkptpn, 2, unlist)
or
> apply(linkptpn, 2, as.data.frame)
or
linkptpn2 <- data.frame(unlist(linkptpn$pedigree), unlist(linkptpn$id),
unlist(linkptpn$fa), unlist(linkptpn$mo), unlist(linkptpn$sex),
unlist(linkptpn$status), unlist(linkptpn$rs3789604),
unlist(linkptpn$rs3811021),unlist( linkptpn$rs1217413),
unlist(linkptpn$ss38346942))

But it doesn't work. The first and the second solution gives me another
list, and the third doesn't work because of missing data.

Do you have any idea to do this ?
-- 
David

[[alternative HTML version deleted]]

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


[R] DSC 2005 proceedings?

2006-06-13 Thread Kevin Wright
This page:
http://depts.washington.edu/dsc2005/
says the proceedings for DSC 2005 will be published online and that
the papers were due in final form by September 2005.

Anyone know if the proceedings have been published yet or when (if?)
they will be published?

Thanks.

Kevin Wright

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


[R] Numerical print format and loading with RMySQL

2006-06-13 Thread Nathan Johnson
Hi

I'm new to R and have been resisting posting to the list thus far,  
but I think I've exhausted my work around options.

I'm having a few problems with RMySQL and/or it's underlying packages.

I'm doing a very simple vsn transformation on large datasets, using  
RMySQL to retrieve the data for a DB.

My first problem was that I could not get the RMySQL package to write  
back to my DB using the dbWriteTable method.

I constructed a data frame with columns corresponding to the table  
fields, and tried with and without a null column for the auto- 
increment internal id column.  I also tried renaming all the column  
names to match those of the table fields.  All of my attempts  
resulted in a long wait and "TRUE" being printed to the terminal,  
which I though was quite promising, however, on inspection of the DB,  
I found nothing had been written.  So my first question are:

Is it necessary to provide field names of the table, or will correct  
column order suffice?
For tables with an internal auto-increment DBID field, is it  
necessary to provide a null column of the correct length?

To get around this I decided to use the write.table function and then  
import via my controlling perl script.  This works fine apart from  
one problem, numbers >-10 get printed as exponents, which then  
causes subsequent imports to miss these records. So my second and  
rather simple question is:

Is there a setting(options?) which will force full numerical printing?

Thanks in advance

Nath

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


Re: [R] Numerical print format and loading with RMySQL

2006-06-13 Thread Prof Brian Ripley
On Tue, 13 Jun 2006, Nathan Johnson wrote:

> I'm new to R and have been resisting posting to the list thus far,
> but I think I've exhausted my work around options.

Have you asked the package maintainer: the posting guide suggests you do 
so first?  He is by far the most likely source of help.

> I'm having a few problems with RMySQL and/or it's underlying packages.

Which is DBI by the same author.

> I'm doing a very simple vsn transformation on large datasets, using
> RMySQL to retrieve the data for a DB.
>
> My first problem was that I could not get the RMySQL package to write
> back to my DB using the dbWriteTable method.
>
> I constructed a data frame with columns corresponding to the table
> fields, and tried with and without a null column for the auto-
> increment internal id column.  I also tried renaming all the column
> names to match those of the table fields.  All of my attempts
> resulted in a long wait and "TRUE" being printed to the terminal,
> which I though was quite promising, however, on inspection of the DB,
> I found nothing had been written.  So my first question are:
>
> Is it necessary to provide field names of the table, or will correct
> column order suffice?
> For tables with an internal auto-increment DBID field, is it
> necessary to provide a null column of the correct length?
>
> To get around this I decided to use the write.table function and then
> import via my controlling perl script.  This works fine apart from
> one problem, numbers >-10 get printed as exponents, which then
> causes subsequent imports to miss these records. So my second and
> rather simple question is:
>
> Is there a setting(options?) which will force full numerical printing?

Look for options scipen.

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


[R] rqss.object

2006-06-13 Thread Julie MIKHALEVSKY-PERE
Hello,

I  am a new user and I  am looking for the description of the output of 
rqss function (Additive Quantile Regression Smoothing). It is supposed to 
be in rqss.object but I could not find any reference to rqss.object 
anywhere.

thanks a lot.

Julia
[[alternative HTML version deleted]]

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


[R] 2 Courses Near You - (1) Introduction to R/S+ programming: Microarrays Analysis and Bioconductor, (2) R/Splus Fundamentals and Programming Techniques

2006-06-13 Thread elvis
XLSolutions Corporation (www.xlsolutions-corp.com) is proud to announce:

(1) Introduction to R/S+ programming: Microarrays Analysis and Bioconductor 
 
  *** San Francisco / July 17-18, 2006 ***
  *** Chicago   / July 24-25, 2006 ***
  *** Baltimore / July 27-28, 2006 *** 
  *** Raleigh   / July 17-18, 2006 ***
  *** Boston/ July 27-28, 2006 ***
  http://www.xlsolutions-corp.com/RSmicro

(2) R/Splus Fundamentals and Programming Techniques

  *** San Francisco / July 10-11, 2006 ***
  *** Houston   / July 13-14, 2006 ***
  *** San Diego / July 17-18, 2006 ***
  *** Chicago   / July 20-21, 2006 ***
  *** New York City / July 24-25, 2006 ***
  *** Boston/ July 27-28, 2006 ***
 
  http://www.xlsolutions-corp.com/Rfund.htm  

Ask for group discount and reserve your seat Now - Earlybird Rates.
Payment due after the class! Email Sue Turner:  [EMAIL PROTECTED]
Interested in our Advanced Programming class? 

(1) Introduction to R/S+ programming: Microarrays Analysis and Bioconductor   
 
Course Outline:

- R/S System: Overview; Installation and Demonstration 
- Data Manipulation and Management 
- Graphics; Enhancing Plots, Trellis 
- Writing Functions 
- Connecting to External Software 
- R/S Packages and Libraries (e.g. BioConductor) 
- BioConductor: Overview; Installation and Demonstration 
- Array Quality Inspection 
- Correction and Normalization; Affymetrix and cDNA arrays 
- Identification of Differentially Expressed Genes 
- Visualization of Genomic Information 
- Clustering Methods in R/Splus 
- Gene Ontology (GO) and Pathway Analysis 
- Inference, Strategies for Large Data 



(2) R/Splus Fundamentals and Programming Techniques
   
Course outline.

- An Overview of R and S
- Data Manipulation and Graphics
- Using Lattice Graphics
- A Comparison of R and S-Plus
- How can R Complement SAS?
- Writing Functions
- Avoiding Loops
- Vectorization
- Statistical Modeling
- Project Management
- Techniques for Effective use of R and S
- Enhancing Plots
- Using High-level Plotting Functions
- Building and Distributing Packages (libraries)
- Connecting; ODBC, Rweb, Orca via sockets and via Rjava

Email us for group discounts.
Email Sue Turner: [EMAIL PROTECTED]
Phone: 206-686-1578
Visit us: www.xlsolutions-corp.com/training.htm
Please let us know if you and your colleagues are interested in this
class to take advantage of group discount. Register now to secure your
seat!

Cheers,
Elvis Miller, PhD
Manager Training.
XLSolutions Corporation
206 686 1578
www.xlsolutions-corp.com
[EMAIL PROTECTED]

2 Courses - (1) Introduction to R/S+ programming: Microarrays Analysis and 
Bioconductor 
(2) R/Splus Fundamentals and Programming Techniques
 Interest in our R/Splus Advanced Programming?  Email us for 
upcoming courses.

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


[R] if syntax error :(

2006-06-13 Thread H. Paul Benton
Umm sorry to bother everyone again but I'm having trouble with my if
statement. I come from a perl background so that's probably my problem! :)
So here is my code:

if (any(lgAB>4) | any(lgAB<-4)){
freq_AB<-hist(lgAB, type="o", plot=F)
else
freq_AB<-hist(lgAB, breaks=br,type ="o", plot=F)
}

And I get 
> source("E:/R/GMDA-1.1.R")
Error in parse(file, n = -1, NULL, "?") : syntax error at
11: freq_AB<-hist(lgAB, type="o", plot=F)
12: else
>

Thanks again,

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


Re: [R] if syntax error :(

2006-06-13 Thread Sarah Goslee
You need more brackets:

if(blah) {
  do something
} else {
  do something different
}

Sarah

PS Using underscores in variable names is not encouraged, and
can cause you problems in certain contexts.

On 6/13/06, H. Paul Benton <[EMAIL PROTECTED]> wrote:
>
> Umm sorry to bother everyone again but I'm having trouble with my if
> statement. I come from a perl background so that's probably my problem! :)
> So here is my code:
>
> if (any(lgAB>4) | any(lgAB<-4)){
> freq_AB<-hist(lgAB, type="o", plot=F)
> else
> freq_AB<-hist(lgAB, breaks=br,type ="o", plot=F)
> }
>


-- 
Sarah Goslee

[[alternative HTML version deleted]]

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


Re: [R] if syntax error :(

2006-06-13 Thread Gabor Csardi
replace 'else' with '} else {'

Gabor

On Tue, Jun 13, 2006 at 11:18:00AM -0700, H. Paul Benton wrote:
> Umm sorry to bother everyone again but I'm having trouble with my if
> statement. I come from a perl background so that's probably my problem! :)
> So here is my code:
> 
> if (any(lgAB>4) | any(lgAB<-4)){
>   freq_AB<-hist(lgAB, type="o", plot=F)
>   else
>   freq_AB<-hist(lgAB, breaks=br,type ="o", plot=F)
> }
> 
> And I get 
> > source("E:/R/GMDA-1.1.R")
> Error in parse(file, n = -1, NULL, "?") : syntax error at
> 11: freq_AB<-hist(lgAB, type="o", plot=F)
> 12: else
> >
> 
> Thanks again,
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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

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


Re: [R] if syntax error :(

2006-06-13 Thread Gabor Grothendieck
On 6/13/06, Sarah Goslee <[EMAIL PROTECTED]> wrote:
> You need more brackets:
>
> if(blah) {
>  do something
> } else {
>  do something different
> }
>
> Sarah
>
> PS Using underscores in variable names is not encouraged, and
> can cause you problems in certain contexts.

The only context I can think of is very old versions of R that used
underscore as a synonym for <- so in any sufficiently recent
version of R I don't think it can cause problems.  Whether its
good style or not is another question.

>
> On 6/13/06, H. Paul Benton <[EMAIL PROTECTED]> wrote:
> >
> > Umm sorry to bother everyone again but I'm having trouble with my if
> > statement. I come from a perl background so that's probably my problem! :)
> > So here is my code:
> >
> > if (any(lgAB>4) | any(lgAB<-4)){
> > freq_AB<-hist(lgAB, type="o", plot=F)
> > else
> > freq_AB<-hist(lgAB, breaks=br,type ="o", plot=F)
> > }
> >
>
>
> --
> Sarah Goslee
>
>[[alternative HTML version deleted]]
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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


Re: [R] underscores

2006-06-13 Thread Sarah Goslee
Since several people have commented to me, on and off list:

On 6/13/06, Sarah Goslee <[EMAIL PROTECTED]> wrote:
> >
> > PS Using underscores in variable names is not encouraged, and
> > can cause you problems in certain contexts.


I realize that it is now legal in R to use underscores, since they no longer
represent the same thing as "->". But I don't consider "legal" the same as
"encouraged", do you?


Probably the context most important is if you need to be able to share code
with S-Plus. I work exclusively in R, but have academic colleagues who use
S-Plus. As far as I know, S-Plus still restricts the use of "_", and for me,
that possibility is enough to justify suggesting that people not use "_". I
personally find that syntax hard to read, as well.

I don't consider it all that important an issue, especially as I know that
many people disagree with me, and never use S-Plus, and don't care about
appearance as long as it works. I would never have brought it up as an issue
on its own, but did feel inclined to tack it on as a postscript to a
question I did answer appropriately.

I shan't mention it again!

Sarah

-- 
Sarah Goslee

[[alternative HTML version deleted]]

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


Re: [R] if syntax error :(

2006-06-13 Thread Sundar Dorai-Raj


Sarah Goslee wrote:
> You need more brackets:
> 
> if(blah) {
>   do something
> } else {
>   do something different
> }
> 
> Sarah
> 
> PS Using underscores in variable names is not encouraged, and
> can cause you problems in certain contexts.
> 

Hi, Sarah,

Why do you say this? And in what situations will R have problems? The 
only problem I can see is using current code (with underscores in 
variable names) on extremely old versions of R. I've been using R for 6 
years now and applauded the day R-core decided to do away with 
underscore as assignment (a relic of S) and allow it in variable names. 
The one minor difficulty of using underscores of which I am aware is 
having to press `_' twice in ESS.

Thanks,

--sundar

> On 6/13/06, H. Paul Benton <[EMAIL PROTECTED]> wrote:
> 
>>Umm sorry to bother everyone again but I'm having trouble with my if
>>statement. I come from a perl background so that's probably my problem! :)
>>So here is my code:
>>
>>if (any(lgAB>4) | any(lgAB<-4)){
>>freq_AB<-hist(lgAB, type="o", plot=F)
>>else
>>freq_AB<-hist(lgAB, breaks=br,type ="o", plot=F)
>>}
>>
> 
> 
>

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


[R] missing value where TRUE/FALSE needed

2006-06-13 Thread Peter Lauren
I am using R 2.3.0 and trying to run the following
code.

BinCnt=round(ShorterVectorLength/10)
BinMatrix=matrix(nrow=BinCnt, ncol=2)
Increment=(VectorRange[2]-VectorRange[1])/BinCnt
BinMatrix[1,1]=VectorRange[1]
BinMatrix[1,2]=VectorRange[1]+Increment
for (i in 2:BinCnt)
{
BinMatrix[i,1]=BinMatrix[i-1,2]
BinMatrix[i,2]=BinMatrix[i,2]+Increment
}

# Count entries in each bin
Histogram=vector(length=BinCnt, mode="numeric")
for (i in 1:BinCnt) Histogram[i]=0
VectorLength=length(FormerVector)
for (i in 1:VectorLength)
{
Value=FormerVector[i]
for (j in 1:BinCnt) if (Value>=BinMatrix[j,1] &&
Value<=BinMatrix[j,2])
{
Histogram[j]=Histogram[j]+1
break;
}
}

Unfotunately, at 
if (Value>=BinMatrix[j,1] && Value<=BinMatrix[j,2])
I get the following error message
Error in if (Value >= BinMatrix[j, 1] && Value <=
BinMatrix[j, 2]) { : 
missing value where TRUE/FALSE needed
I inserted browser() just before the call and 
(Value>=BinMatrix[j,1] && Value<=BinMatrix[j,2])
returned FALSE.

Is there a bug in my code or a bug in my version of R?

Many thanks in advance,
Peter.

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


[R] Cramer-von Mises normality test

2006-06-13 Thread Robert Powell
Hi, this is my first help request so please bear with me.

I've been running some normality tests using the nortest package. For  
some of my datasets the Cramer-von Mises normality test generates an  
extremely high probability (e.g., 1.637e+31) and indicates normality  
when the other tests do not. Is there something I'm misunderstanding  
or potentially a bug in the code?

Below are the results of the tests and then, below that, I've  
provided that column of the datafile.

Thank you in advance for your help.

Bob Powell

 > shapiro.test(Mn.Total..ug.kg)

Shapiro-Wilk normality test

data:  Mn.Total..ug.kg
W = 0.5269, p-value < 2.2e-16

 > shapiro.test(ln.Mn.Total..ug/kg)
Error in inherits(x, "factor") : object "ln.Mn.Total..ug" not found
 > shapiro.test(ln.Mn.Total..ug.kg)

Shapiro-Wilk normality test

data:  ln.Mn.Total..ug.kg
W = 0.943, p-value = 1.301e-06

 > sf.test(Mn.Total..ug.kg)

Shapiro-Francia normality test

data:  Mn.Total..ug.kg
W = 0.5173, p-value < 2.2e-16

 > sf.test(ln.Mn.Total..ug.kg)

Shapiro-Francia normality test

data:  ln.Mn.Total..ug.kg
W = 0.9403, p-value = 3.461e-06

 > cvm.test(Mn.Total..ug.kg)

Cramer-von Mises normality test

data:  Mn.Total..ug.kg
W = 4.024, p-value = 1.637e+31

 > cvm.test(ln.Mn.Total..ug.kg)

Cramer-von Mises normality test

data:  ln.Mn.Total..ug.kg
W = 0.356, p-value = 7.647e-05

 > lillie.test(Mn.Total..ug.kg)

Lilliefors (Kolmogorov-Smirnov) normality test

data:  Mn.Total..ug.kg
D = 0.2325, p-value < 2.2e-16

 > lillie.test(ln.Mn.Total..ug.kg)

Lilliefors (Kolmogorov-Smirnov) normality test

data:  ln.Mn.Total..ug.kg
D = 0.0869, p-value = 0.002011


OK, next the data column:

Mn-Total, ug/kg
46
40
51
60
77
18
21
100
260
49
26
76
84
40
43
23
66
120
37
23
29
32
40
66
62
110
35
45
88
96
57
87
82
97
110
45
73
39
64
38
34
140
87
26
43
29
29
55
54
24
47
65
39
38
41
22
40
38
50
100
52
69
50
52
26
63
63
41
29
130
86
60
45
33
39
58
27
46
36
30
360
54
37
46
15
56
63
81
130
47
62
52
54
44
190
76
75
44
55
330
78
360
140
84
45
97
61
49
28
96
35
110
77
51
46
59
76
61
55
46
47
65
37
17
63
53
72
85
57
86
600
170
140
47
120
36
37
110
31
43
48
67
35
53
38
49
49
38
63
37
71
150
38
55
56
56
35
34
25
39
67
72
44
38
24
34
35
31
25
32
36
36
49
49
49
71
67
120
53
50
49

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


Re: [R] 2 Courses Near You - (1) Introduction to R/S+ programming: Microarrays Analysis and Bioconductor, (2) R/Splus Fundamentals and Programming Techniques

2006-06-13 Thread Uwe Ligges
... and again I wonder which courses are "near". This leads at once to 
the question: "which metric is in use?". Probably some football related 
metric: FIFA WM takes place in Dortmund and commercials say something 
like "the world is our guest" ...
Now, let's escape from football to Austria and Vienna's useR!2006 
conference!

Uwe Ligges



[EMAIL PROTECTED] wrote:
> XLSolutions Corporation (www.xlsolutions-corp.com) is proud to announce:
> 
> (1) Introduction to R/S+ programming: Microarrays Analysis and Bioconductor 
>  
>   *** San Francisco / July 17-18, 2006 ***
> *** Chicago   / July 24-25, 2006 ***
>   *** Baltimore / July 27-28, 2006 *** 
>   *** Raleigh   / July 17-18, 2006 ***
>   *** Boston/ July 27-28, 2006 ***
>   http://www.xlsolutions-corp.com/RSmicro
> 
> (2) R/Splus Fundamentals and Programming Techniques
> 
>   *** San Francisco / July 10-11, 2006 ***
>   *** Houston   / July 13-14, 2006 ***
>   *** San Diego / July 17-18, 2006 ***
>   *** Chicago   / July 20-21, 2006 ***
>   *** New York City / July 24-25, 2006 ***
>   *** Boston/ July 27-28, 2006 ***
>  
>   http://www.xlsolutions-corp.com/Rfund.htm  
> 
> Ask for group discount and reserve your seat Now - Earlybird Rates.
> Payment due after the class! Email Sue Turner:  [EMAIL PROTECTED]
> Interested in our Advanced Programming class? 
> 
> (1) Introduction to R/S+ programming: Microarrays Analysis and Bioconductor   
>  
> Course Outline:
> 
> - R/S System: Overview; Installation and Demonstration 
> - Data Manipulation and Management 
> - Graphics; Enhancing Plots, Trellis 
> - Writing Functions 
> - Connecting to External Software 
> - R/S Packages and Libraries (e.g. BioConductor) 
> - BioConductor: Overview; Installation and Demonstration 
> - Array Quality Inspection 
> - Correction and Normalization; Affymetrix and cDNA arrays 
> - Identification of Differentially Expressed Genes 
> - Visualization of Genomic Information 
> - Clustering Methods in R/Splus 
> - Gene Ontology (GO) and Pathway Analysis 
> - Inference, Strategies for Large Data 
> 
> 
> 
> (2) R/Splus Fundamentals and Programming Techniques
>
> Course outline.
> 
> - An Overview of R and S
> - Data Manipulation and Graphics
> - Using Lattice Graphics
> - A Comparison of R and S-Plus
> - How can R Complement SAS?
> - Writing Functions
> - Avoiding Loops
> - Vectorization
> - Statistical Modeling
> - Project Management
> - Techniques for Effective use of R and S
> - Enhancing Plots
> - Using High-level Plotting Functions
> - Building and Distributing Packages (libraries)
> - Connecting; ODBC, Rweb, Orca via sockets and via Rjava
> 
> Email us for group discounts.
> Email Sue Turner: [EMAIL PROTECTED]
> Phone: 206-686-1578
> Visit us: www.xlsolutions-corp.com/training.htm
> Please let us know if you and your colleagues are interested in this
> class to take advantage of group discount. Register now to secure your
> seat!
> 
> Cheers,
> Elvis Miller, PhD
> Manager Training.
> XLSolutions Corporation
> 206 686 1578
> www.xlsolutions-corp.com
> [EMAIL PROTECTED]
> 
> 2 Courses - (1) Introduction to R/S+ programming: Microarrays Analysis and 
> Bioconductor 
> (2) R/Splus Fundamentals and Programming Techniques
>  Interest in our R/Splus Advanced Programming?  Email us for 
> upcoming courses.
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


[R] automated data processing

2006-06-13 Thread mw-u2
I have many files (0.4.dat, 0.5.dat, ...) of which I would like to calculate 
mean value and variance and save the output in a new file where each line 
shouldlook like: "0.4 mean(0.4.dat) var(0.4.dat)" and so on. Right now I got a 
a simple script that makes me unhappy:

1. I run it by "R --no-save < script.r > out.dat" unfortunately out.dat has all 
the original commands in it and a "[1]" infront of every output

2. I would love to have a variable running through 0.4, 0.5, ... naming the
datafile to process and the first column in the output.

My script looks like:

data <- read.table("0.4.dat"); E <- data$V1[1000:length(data$V1)];
c(0.4, mean(E), var(E));
data <- read.table("0.5.dat"); E <- data$V1[1000:length(data$V1)];
c(0.5, mean(E), var(E));

And that would be its output:
#[1] 0.400 -1134.402  5700.966
#> data <- read.table("0.5.dat"); E <- data$V1[1000:length(data$V1)];
#> c(0.5, mean(E), var(E));
#[1] 0.500 -1787.232  2973.692

Thanks
-- 


Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

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


[R] R kicking us out

2006-06-13 Thread Erin Hodgess
Dear R People:

I am using R for teaching purposes in a large classroom.

Each computer has its own copy of R.

However, every once in a while, about half of us will get 
thrown out of R, for no apparent reason.

By the way, it has happened in other classrooms as well.


Has anyone else run into this, please?

If so, how have you solved this problem, please?

Thanks in advance!

R for Windows

Sincerely,
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: [EMAIL PROTECTED]

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


[R] Failed library(ncdf)

2006-06-13 Thread Waichler, Scott R

I am trying to use the ncdf package on a Mac OS X machine (10.4.6), but
I get the following error message:

> library(ncdf)
Error in dyn.load(x, as.logical(local), as.logical(now)) :
unable to load shared library
'/Library/Frameworks/R.framework/Resources/library/ncdf/libs/ppc/ncdf.so
':
 
dlopen(/Library/Frameworks/R.framework/Resources/library/ncdf/libs/ppc/n
cdf.so, 6): Symbol not found: _nc_inq
  Referenced from:
/Library/Frameworks/R.framework/Resources/library/ncdf/libs/ppc/ncdf.so
  Expected in: flat namespace
Error in library(ncdf) : .First.lib failed for 'ncdf'

In the past I have received similar messages in Linux and was able to
fix the problem by copying netCDF library and header files to
directories under /usr/local/.  But in the Mac I'm stumped and can't
figure out what to do to fix this.  I have downloaded source from netCDF
and installed it without problems, but I guess I haven't been able to
get R to see it.

Thanks for your help,  

Scott Waichler
Pacific Northwest National Laboratory
scott.waichler _at_ pnl.gov

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


Re: [R] if syntax error :(

2006-06-13 Thread Rolf Turner
H. Paul Benton wrote:

> Umm sorry to bother everyone again but I'm having trouble with my if
> statement. I come from a perl background so that's probably my problem! :)
> So here is my code:
> 
> if (any(lgAB>4) | any(lgAB<-4)){
>   freq_AB<-hist(lgAB, type="o", plot=F)
>   else
>   freq_AB<-hist(lgAB, breaks=br,type ="o", plot=F)
> }
> 
> And I get 
> > source("E:/R/GMDA-1.1.R")
> Error in parse(file, n = -1, NULL, "?") : syntax error at
> 11: freq_AB<-hist(lgAB, type="o", plot=F)
> 12: else
> >

No-one yet has pointed out the following problem, which, while not be
a syntax error as such, will cause you headaches:

if (any(lgAB>4) | any(lgAB<-4)){
  ^^^

This assigns the value 4 to lgAB (which is presumably NOT what
you want to do).  You want ``any(lgAB < -4)''.

General rule:  Put in spaces around operators --- it makes the
code (much) more readable and avoids unintended consequences.

Another infelicity in your code: ``plot=F''.  Use ``plot=FALSE''.
(Note that the symbols ``F'' and ``T'' are assignable, *unlike*
``TRUE'' and ``FALSE''.)

cheers,

Rolf Turner
[EMAIL PROTECTED]

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


Re: [R] if syntax error :(

2006-06-13 Thread Gabor Grothendieck
On 6/13/06, Rolf Turner <[EMAIL PROTECTED]> wrote:
> H. Paul Benton wrote:
>
> > Umm sorry to bother everyone again but I'm having trouble with my if
> > statement. I come from a perl background so that's probably my problem! :)
> > So here is my code:
> >
> > if (any(lgAB>4) | any(lgAB<-4)){
> >   freq_AB<-hist(lgAB, type="o", plot=F)
> >   else
> >   freq_AB<-hist(lgAB, breaks=br,type ="o", plot=F)
> > }
> >
> > And I get
> > > source("E:/R/GMDA-1.1.R")
> > Error in parse(file, n = -1, NULL, "?") : syntax error at
> > 11: freq_AB<-hist(lgAB, type="o", plot=F)
> > 12: else
> > >
>
> No-one yet has pointed out the following problem, which, while not be
> a syntax error as such, will cause you headaches:
>
>if (any(lgAB>4) | any(lgAB<-4)){
>  ^^^
>
> This assigns the value 4 to lgAB (which is presumably NOT what
> you want to do).  You want ``any(lgAB < -4)''.
>
> General rule:  Put in spaces around operators --- it makes the
> code (much) more readable and avoids unintended consequences.
>
> Another infelicity in your code: ``plot=F''.  Use ``plot=FALSE''.
> (Note that the symbols ``F'' and ``T'' are assignable, *unlike*
> ``TRUE'' and ``FALSE''.)
>

In fact if we are going to improve the code we could write it more
compactly and in a way which shows more clearly that the if
is only involved in setting breaks like this:

freq_AB <-  hist(lgAB,  type = "o", plot = FALSE,
  breaks = if (any(abs(lgAB) > 4)) "Sturges" else br)

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


Re: [R] R kicking us out

2006-06-13 Thread Ted Harding
On 13-Jun-06 Erin Hodgess wrote:
> Dear R People:
> 
> I am using R for teaching purposes in a large classroom.
> 
> Each computer has its own copy of R.
> 
> However, every once in a while, about half of us will get 
> thrown out of R, for no apparent reason.
> 
> By the way, it has happened in other classrooms as well.
> 
> 
> Has anyone else run into this, please?
> 
> If so, how have you solved this problem, please?
> 
> Thanks in advance!
> 
> R for Windows

Hmmm ... you're asking statisticans here!

When it happens, is it at about the same moment for all
the machines it happens on?

Is the set of machines it happens on different every time,
or do some seem to be systematically vulnerable?

(As you can tell, I've not experienced this, but am groping
for a mechanism. I find "once in a while, about half of us
will get thrown out of R" puzzling as a phenomenon -- strongly
suggestive of non-independence of machines, despite each
machine having its own copy of R).

Presumably they're networked. Might it be possible that (e.g.)
a central server is re-profiling some of the machines from
time to time (or similar)?

If it's a group phenomenon, I'd be tempted to look either in
the hardware direction (e.g. power fluctuation to which some
machines are sensitive and get e.g. corrupt bytes in RAM
leading to segfault or the like), or the software direction
(e.g. interference from external server as above, or maybe
one machine making a request to others over the net).

Though each machine "has its own copy of R", does each one
have its own copy of the full set of packages that you use?
Or is there some sort of central repository for packages
from which machines can pull down extras as they need them?

Is there a central "monitoring" machine in the classrom for
the instructor to use to collaborate with [groups of] students?

Just random thoughts, really! But hoping that they may help.

Best wishes,
Ted.


E-Mail: (Ted Harding) <[EMAIL PROTECTED]>
Fax-to-email: +44 (0)870 094 0861
Date: 13-Jun-06   Time: 21:29:59
-- XFMail --

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


[R] Rosner's test

2006-06-13 Thread Robert Powell
My second request of the day, sorry to be such a bother.

Can you tell me whether Rosner's test for outliers is available in  
any of the R packages and, if so, which one? I've tried but I can't  
find it.

Thank you very much,

Bob Powell

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


Re: [R] automated data processing

2006-06-13 Thread jim holtman
Not sure what your increments are, but something like this might work:

result <- NULL
for (i in 4:5){
   x <- read.table(paste('0.', i, '.dat', sep=''))
   E <- data$V1[1000:length(data$V1)]
   result <- rbind(result, c(paste('0.', i, sep=''), mean(E), var(E)
}
# you can then output 'result' to a file


On 6/13/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I have many files (0.4.dat, 0.5.dat, ...) of which I would like to
> calculate mean value and variance and save the output in a new file where
> each line shouldlook like: "0.4 mean(0.4.dat) var(0.4.dat)" and so on.
> Right now I got a a simple script that makes me unhappy:
>
> 1. I run it by "R --no-save < script.r > out.dat" unfortunately out.dathas 
> all the original commands in it and a "[1]" infront of every output
>
> 2. I would love to have a variable running through 0.4, 0.5, ... naming
> the
> datafile to process and the first column in the output.
>
> My script looks like:
>
> data <- read.table("0.4.dat"); E <- data$V1[1000:length(data$V1)];
> c(0.4, mean(E), var(E));
> data <- read.table("0.5.dat"); E <- data$V1[1000:length(data$V1)];
> c(0.5, mean(E), var(E));
>
> And that would be its output:
> #[1] 0.400 -1134.402  5700.966
> #> data <- read.table("0.5.dat"); E <- data$V1[1000:length(data$V1)];
> #> c(0.5, mean(E), var(E));
> #[1] 0.500 -1787.232  2973.692
>
> Thanks
> --
>
>
> Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
> Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390 (Cell)
+1 513 247 0281 (Home)

What is the problem you are trying to solve?

[[alternative HTML version deleted]]

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

Re: [R] automated data processing

2006-06-13 Thread Neuro LeSuperHéros
Hi,
Put all you .dat files in one directory ('c:/data' for example) and do this:

finaltable <-NULL

folder <-dir('c:/data')

for (i in folder){
table1 <-read.table(i)
mean1 <-mean(table1$V1)
var1 <-var(table1$V1)
rowname <-paste(i)
finaltable <-rbind(finaltable,c(rowname,mean1,var1))
}

Neuro

>From: [EMAIL PROTECTED]
>To: r-help@stat.math.ethz.ch
>Subject: [R] automated data processing
>Date: Tue, 13 Jun 2006 21:34:40 +0200
>
>I have many files (0.4.dat, 0.5.dat, ...) of which I would like to 
>calculate mean value and variance and save the output in a new file where 
>each line shouldlook like: "0.4 mean(0.4.dat) var(0.4.dat)" and so on. 
>Right now I got a a simple script that makes me unhappy:
>
>1. I run it by "R --no-save < script.r > out.dat" unfortunately out.dat has 
>all the original commands in it and a "[1]" infront of every output
>
>2. I would love to have a variable running through 0.4, 0.5, ... naming the
>datafile to process and the first column in the output.
>
>My script looks like:
>
>data <- read.table("0.4.dat"); E <- data$V1[1000:length(data$V1)];
>c(0.4, mean(E), var(E));
>data <- read.table("0.5.dat"); E <- data$V1[1000:length(data$V1)];
>c(0.5, mean(E), var(E));
>
>And that would be its output:
>#[1] 0.400 -1134.402  5700.966
>#> data <- read.table("0.5.dat"); E <- data$V1[1000:length(data$V1)];
>#> c(0.5, mean(E), var(E));
>#[1] 0.500 -1787.232  2973.692
>
>Thanks
>--
>
>
>Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
>Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
>
>__
>R-help@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! 
>http://www.R-project.org/posting-guide.html

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


Re: [R] Rosner's test

2006-06-13 Thread Berton Gunter
RSiteSearch('Rosner')

?RSiteSearch  
 or search directly from CRAN.

Incidentally, I'll repeat what I've said before. Don't do outlier tests.
They're dangerous. Use robust methods instead.

-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
"The business of the statistician is to catalyze the scientific learning
process."  - George E. P. Box
 
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Robert Powell
> Sent: Tuesday, June 13, 2006 1:47 PM
> To: r-help@stat.math.ethz.ch
> Subject: [R] Rosner's test
> 
> My second request of the day, sorry to be such a bother.
> 
> Can you tell me whether Rosner's test for outliers is available in  
> any of the R packages and, if so, which one? I've tried but I can't  
> find it.
> 
> Thank you very much,
> 
> Bob Powell
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
>

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


Re: [R] if syntax error :(

2006-06-13 Thread H. Paul Benton
Thank you,
That was the problem. I know about using the extra brackets but in the R
help manual it doesn't use brackets so I thought maybe R is different. 
However, yes indeed, it was assigning the 'lgAB to 4'. I'm just starting to
really learn R. 
Cheers,

Paul

PS thanks to the Patrick Burns who gave me the link to S poetry.
PPS What is the "sturges" doing in the code ? is it like a goto?
<
freq_AB <-  hist(lgAB,  type = "o", plot = FALSE,
breaks = if (any(abs(lgAB) > 4)) "Sturges" else br)
>
Research Techinician
Mass Spectrometry
  o The
 /
o Scripps
 \
  o Research
 /
o Institute


-Original Message-
From: Rolf Turner [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 13, 2006 1:14 PM
To: [EMAIL PROTECTED]; r-help@stat.math.ethz.ch
Subject: Re: [R] if syntax error :(

H. Paul Benton wrote:

> Umm sorry to bother everyone again but I'm having trouble with my if
> statement. I come from a perl background so that's probably my problem! :)
> So here is my code:
> 
> if (any(lgAB>4) | any(lgAB<-4)){
>   freq_AB<-hist(lgAB, type="o", plot=F)
>   else
>   freq_AB<-hist(lgAB, breaks=br,type ="o", plot=F)
> }
> 
> And I get 
> > source("E:/R/GMDA-1.1.R")
> Error in parse(file, n = -1, NULL, "?") : syntax error at
> 11: freq_AB<-hist(lgAB, type="o", plot=F)
> 12: else
> >

No-one yet has pointed out the following problem, which, while not be
a syntax error as such, will cause you headaches:

if (any(lgAB>4) | any(lgAB<-4)){
  ^^^

This assigns the value 4 to lgAB (which is presumably NOT what
you want to do).  You want ``any(lgAB < -4)''.

General rule:  Put in spaces around operators --- it makes the
code (much) more readable and avoids unintended consequences.

Another infelicity in your code: ``plot=F''.  Use ``plot=FALSE''.
(Note that the symbols ``F'' and ``T'' are assignable, *unlike*
``TRUE'' and ``FALSE''.)

cheers,

Rolf Turner
[EMAIL PROTECTED]

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


Re: [R] if syntax error :(

2006-06-13 Thread Gabor Grothendieck
On 6/13/06, H. Paul Benton <[EMAIL PROTECTED]> wrote:
> Thank you,
> That was the problem. I know about using the extra brackets but in the R
> help manual it doesn't use brackets so I thought maybe R is different.

The problem is not that you must use brackets -- you don't.  The problem is that
you put the else INSIDE the brackets.

> However, yes indeed, it was assigning the 'lgAB to 4'. I'm just starting to
> really learn R.
> Cheers,
>
> Paul
>
> PS thanks to the Patrick Burns who gave me the link to S poetry.
> PPS What is the "sturges" doing in the code ? is it like a goto?

Look at ?hist.default to see that "Sturges" is the default value for breaks.


> <
> freq_AB <-  hist(lgAB,  type = "o", plot = FALSE,
> breaks = if (any(abs(lgAB) > 4)) "Sturges" else br)
> >
> Research Techinician
> Mass Spectrometry
>  o The
>  /
> o Scripps
>  \
>  o Research
>  /
> o Institute
>
>
> -Original Message-
> From: Rolf Turner [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 13, 2006 1:14 PM
> To: [EMAIL PROTECTED]; r-help@stat.math.ethz.ch
> Subject: Re: [R] if syntax error :(
>
> H. Paul Benton wrote:
>
> > Umm sorry to bother everyone again but I'm having trouble with my if
> > statement. I come from a perl background so that's probably my problem! :)
> > So here is my code:
> >
> > if (any(lgAB>4) | any(lgAB<-4)){
> >   freq_AB<-hist(lgAB, type="o", plot=F)
> >   else
> >   freq_AB<-hist(lgAB, breaks=br,type ="o", plot=F)
> > }
> >
> > And I get
> > > source("E:/R/GMDA-1.1.R")
> > Error in parse(file, n = -1, NULL, "?") : syntax error at
> > 11: freq_AB<-hist(lgAB, type="o", plot=F)
> > 12: else
> > >
>
> No-one yet has pointed out the following problem, which, while not be
> a syntax error as such, will cause you headaches:
>
>if (any(lgAB>4) | any(lgAB<-4)){
>  ^^^
>
> This assigns the value 4 to lgAB (which is presumably NOT what
> you want to do).  You want ``any(lgAB < -4)''.
>
> General rule:  Put in spaces around operators --- it makes the
> code (much) more readable and avoids unintended consequences.
>
> Another infelicity in your code: ``plot=F''.  Use ``plot=FALSE''.
> (Note that the symbols ``F'' and ``T'' are assignable, *unlike*
> ``TRUE'' and ``FALSE''.)
>
>cheers,
>
>Rolf Turner
>[EMAIL PROTECTED]
>
>
>
>

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


Re: [R] Numerical print format and loading with RMySQL

2006-06-13 Thread dhinds
Nathan Johnson <[EMAIL PROTECTED]> wrote:

> I constructed a data frame with columns corresponding to the table  
> fields, and tried with and without a null column for the auto- 
> increment internal id column.  I also tried renaming all the column  
> names to match those of the table fields.  All of my attempts  
> resulted in a long wait and "TRUE" being printed to the terminal,  
> which I though was quite promising, however, on inspection of the DB,  
> I found nothing had been written.

Is it possible you needed a call to dbCommit()?

-- Dave

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


Re: [R] Multiple lag.plots per page

2006-06-13 Thread Gad Abraham
Prof Brian Ripley wrote:
> On Tue, 13 Jun 2006, Gad Abraham wrote:
> 
>> Prof Brian Ripley wrote:
>>> On Tue, 13 Jun 2006, Gad Abraham wrote:
>>>
 Hi,

 I'm trying to plot several lag.plots on a page, however the second plot
 replaces the first one (although it only takes up the upper half as it
 should):

 par(mfrow=c(2,1))
 a<-sin(1:100)
 b<-cos(1:100)
 lag.plot(a)
 lag.plot(b)

 What's the trick to this?
>>>
>>> lag.plot itself calls par(mfrow).  The trick is to get one call to do 
>>> the plots you want:
>>>
>>> lag.plot(cbind(a,b))
>>>
>>>
>>
>> Thanks, that works great for multiple lag.plots. Is it possible to 
>> have a lag.plot and another type of plot on the same page? The second 
>> plot() always replaces the lag.plot for me.
> 
> Yes, if the other plot is second, e.g
> 
> par(mfrow=c(2,1))
> a<-sin(1:100)
> lag.plot(a)
> par(mfg=c(2,1)) # move to second plot
> plot(1:10)
> 
> 

Thanks, works great.

Cheers,
Gad

-- 
Gad Abraham
Department of Mathematics and Statistics
University of Melbourne
Victoria 3010, Australia
email: [EMAIL PROTECTED]
web: http://www.ms.unimelb.edu.au/~gabraham

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


Re: [R] cumulative time durations of specified periods (chron)

2006-06-13 Thread Spencer Graves
  Did you try the following:

 > xto-xfrom
Time in days:
[1] 1.50 1.75 2.00 2.25

  Also, have you seen Gabor Grothendieck and Thomas Petzoldt. "R help 
desk: Date and time classes in R". R News, 4(1):29-32, June 2004., 
downloadable from www.r-project.org -> "Documentation:  Newsletter" as 
well as the "zoo" vignette (see 
"http://finzi.psych.upenn.edu/R/Rhelp02a/archive/67006.html";)?

  hope this helps.
  Spencer Graves

Sebastian Luque wrote:
> Hi,
> 
> Say we have two chron vectors representing start and end date/times of an
> event, respectively:
> 
> 
> R> (xfrom <- chron(seq(1.25, 11, 3.25)))
> [1] (01/02/70 06:00:00) (01/05/70 12:00:00) (01/08/70 18:00:00)
> [4] (01/12/70 00:00:00)
> R> (xto <- chron(as.numeric(xfrom) + seq(1.5, 2.25, 0.25)))
> [1] (01/03/70 18:00:00) (01/07/70 06:00:00) (01/10/70 18:00:00)
> [4] (01/14/70 06:00:00)
> 
> 
> and we would like to know how much time is included in a number of
> intervals within each event.  We can define the intervals with two chron
> vectors:
> 
> 
> R> (xt0 <- times(c(0.50, 0)))
> [1] 12:00:00 00:00:00
> R> (xt1 <- times(c(1 - (1 / 86400), 0.25)))
> [1] 23:59:59 06:00:00
> 
> 
> So for the first event, 01/02/70 06:00:00 to 01/03/70 18:00:00, the
> interest is to find how much time corresponds to periods 12:00:00 -
> 23:59:59 and 00:00:00 - 06:00:00.
> 
> I began writing a function to accomplish this task, but am at an impasse.
> The archives may have something on this, but I haven't found a good search
> query for it, so I'd appreciate some pointers.  Thanks in advance.
> 
> 
> Cheers,
>

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


Re: [R] cumulative time durations of specified periods (chron)

2006-06-13 Thread Sebastian Luque
On Tue, 13 Jun 2006 18:49:09 -0700,
Spencer Graves <[EMAIL PROTECTED]> wrote:

  > Did you try the following:
>
>> xto-xfrom
> Time in days:
> [1] 1.50 1.75 2.00 2.25
>
  Also, have you seen Gabor Grothendieck and Thomas Petzoldt. "R
help desk: Date and time classes in R". R News, 4(1):29-32, June 2004.,
downloadable from www.r-project.org -> "Documentation:  Newsletter" as
well as the "zoo" vignette (see
"http://finzi.psych.upenn.edu/R/Rhelp02a/archive/67006.html";)?
>
> hope this helps.
> Spencer Graves
>
> Sebastian Luque wrote:
>> Hi,
>> Say we have two chron vectors representing start and end date/times of
>> an
>> event, respectively:
>> R> (xfrom <- chron(seq(1.25, 11, 3.25)))
>> [1] (01/02/70 06:00:00) (01/05/70 12:00:00) (01/08/70 18:00:00)
>> [4] (01/12/70 00:00:00)
>> R> (xto <- chron(as.numeric(xfrom) + seq(1.5, 2.25, 0.25)))
>> [1] (01/03/70 18:00:00) (01/07/70 06:00:00) (01/10/70 18:00:00)
>> [4] (01/14/70 06:00:00)
>> and we would like to know how much time is included in a number of
>> intervals within each event.  We can define the intervals with two chron
>> vectors:
>> R> (xt0 <- times(c(0.50, 0)))
>> [1] 12:00:00 00:00:00
>> R> (xt1 <- times(c(1 - (1 / 86400), 0.25)))
>> [1] 23:59:59 06:00:00
>> So for the first event, 01/02/70 06:00:00 to 01/03/70 18:00:00, the
>> interest is to find how much time corresponds to periods 12:00:00 -
>> 23:59:59 and 00:00:00 - 06:00:00.
>> I began writing a function to accomplish this task, but am at an
>> impasse.
>> The archives may have something on this, but I haven't found a good search
>> query for it, so I'd appreciate some pointers.  Thanks in advance.
>> Cheers,
>>

-- 
Sebastian P. LuqueCurrent address:
Department of Biology Fisheries and Oceans Canada
Memorial University of Newfoundland   501 University Crescent
[EMAIL PROTECTED] Winnipeg, MB R3T 2N6, Canada
http://sebmags.homelinux.org/~sluque  Tel +1 204 586-8170, Fax ... 984-2403

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


Re: [R] cumulative time durations of specified periods (chron)

2006-06-13 Thread Sebastian Luque
[sorry for my previous empty follow-up -- my fingers got messed up.]


Spencer Graves <[EMAIL PROTECTED]> wrote:

> Did you try the following:
>
>> xto-xfrom
> Time in days:
> [1] 1.50 1.75 2.00 2.25

I wanted to find the total amount of time between a series of date/time's
corresponding to particular times of the day, not how much time there is
between the two series.  I ended my coding it as:


"subTime" <- function(from, to, t0, t1)
{
stopifnot(length(from) == length(to), length(t0) == length(t1))
startFrom <- chron(sapply(t0, "+", as.numeric(dates(from
endFrom <- chron(sapply(t1, "+", as.numeric(dates(from
startTo <- chron(sapply(t0, "+", as.numeric(dates(to
endTo <- chron(sapply(t1, "+", as.numeric(dates(to
fromSeq <- mapply(seq, startFrom, startTo)
toSeq <- mapply(seq, endFrom, endTo)
diffs <- mapply(function(x0, x1, y0, y1) {
bad <- x1 < y0 | x0 > y1
full <- x0 >= y0 & x1 <= y1
fullDiff <- sum(x1[full] - x0[full], na.rm=TRUE)
r <- x0 >= y0 & x1 > y1 & !bad
x1[r] <- y1
truncR <- sum(pmax(x1[r], x0[r]) - x0[r], na.rm=TRUE)
l <- x0 < y0 & x1 <= y1 & !bad
x0[l] <- y0
truncL <- sum(x1[l] - pmax(x0[l], x1[l]), na.rm=TRUE)
sum(fullDiff, truncR, truncL)
}, fromSeq, toSeq, from, to)
diffDims <- list(phases=paste(from, to, sep="-"),
 periods=paste(t0, t1, sep="-"))
matrix(diffs, ncol=length(t0), dimnames=diffDims)
}


The logicals seemed to be needed to account for truncated periods.  It's
working as I needed it to, but it looks too convoluted so if somebody
finds an easier way to do this, I'd be happy to learn about it.  The
function returns a matrix:


R> xfrom <- chron(seq(1.25, 11, 3.25))
R> xto <- chron(as.numeric(xfrom) + seq(1.5, 2.25, 0.25))
R> xt0 <- times(c("04:00:00", "11:00:00"))
R> xt1 <- times(c("10:00:00", "16:00:00"))
R> subTime(xfrom, xto, xt0, xt1)
 periods
phases04:00:00-10:00:00 11:00:00-16:00:00
  (01/02/70 06:00:00)-(01/03/70 18:00:00)0.25000.4167
  (01/05/70 12:00:00)-(01/07/70 06:00:00)0.0.2083
  (01/08/70 18:00:00)-(01/10/70 18:00:00)0.50000.4167
  (01/12/70 00:00:00)-(01/14/70 06:00:00)0.58330.4167



> Also, have you seen Gabor Grothendieck and Thomas Petzoldt. "R help
> desk: Date and time classes in R". R News, 4(1):29-32, June 2004.,
> downloadable from www.r-project.org -> "Documentation: Newsletter" as
> well as the "zoo" vignette (see
> "http://finzi.psych.upenn.edu/R/Rhelp02a/archive/67006.html";)?

I haven't read the "zoo" vignette yet, but the R News article is one I
come back to often.


Thank you,

-- 
Seb

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


[R] data set size question

2006-06-13 Thread Carl Hauser
Hi there,

I'm very new to R and am only in the beginning stages of investigating
it for possible use. A document by John Maindonald at the r-project
website entitled "Using R for Data Analysis and Graphics: Introduction,
Code and Commentary" contains the following paragraph, "The R system may
struggle to handle very large data sets. Depending on available computer
memory, the processing of a data set containing one hundred thousand
observations and perhaps twenty variables may press the limits of what R
can easily handle". This document was written in 2004.

My questions are:

Is this still the case? If so, has anyone come up with creative
solutions to mitigate these limitations? If you work with large data
sets in R, what have your experiences been?

>From what I've seen so far, R seems to have enormous potential and
capabilities. I routinely work with data sets of several hundred
thousand to several million. It would be unfortunate if such potential
and capabilities were not realized because of (effective) data set size
limitations.

Please tell me it ain't so.

Thanks for any help or suggestions.

Carl

 

[[alternative HTML version deleted]]

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


Re: [R] data set size question

2006-06-13 Thread Gabor Grothendieck
The restriction is that objects are kept in memory
so if you have sufficient memory and your OS lets you
access it then you should be ok.  S-Plus is a commercial
package similar to R but stores its objects in files and can handle
larger data sets if you run into trouble.

Given that R is free and once downloaded can be
installed on Windows in a minute or so (I assume its
just as easy on other OSes) just install it and generate
some test data and see if you have any problems,
e.g.  I had no trouble running the following on my PC:

n <- 10
p <- 20
x <- matrix(rnorm(n * p), n)
colnames(x) <- letters[1:p]
# regress column a against the rest
x.lm <- lm(a ~., as.data.frame(x))
plot(x.lm)  # click mouse to advance to successive plots
summary(x.lm)

On 6/13/06, Carl Hauser <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I'm very new to R and am only in the beginning stages of investigating
> it for possible use. A document by John Maindonald at the r-project
> website entitled "Using R for Data Analysis and Graphics: Introduction,
> Code and Commentary" contains the following paragraph, "The R system may
> struggle to handle very large data sets. Depending on available computer
> memory, the processing of a data set containing one hundred thousand
> observations and perhaps twenty variables may press the limits of what R
> can easily handle". This document was written in 2004.
>
> My questions are:
>
> Is this still the case? If so, has anyone come up with creative
> solutions to mitigate these limitations? If you work with large data
> sets in R, what have your experiences been?
>
> >From what I've seen so far, R seems to have enormous potential and
> capabilities. I routinely work with data sets of several hundred
> thousand to several million. It would be unfortunate if such potential
> and capabilities were not realized because of (effective) data set size
> limitations.
>
> Please tell me it ain't so.
>
> Thanks for any help or suggestions.
>
> Carl
>
>
>
>[[alternative HTML version deleted]]
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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


Re: [R] Multiple lag.plots per page

2006-06-13 Thread Gad Abraham
Prof Brian Ripley wrote:
> On Tue, 13 Jun 2006, Gad Abraham wrote:
> 
>> Prof Brian Ripley wrote:
>>> On Tue, 13 Jun 2006, Gad Abraham wrote:
>>>
 Hi,

 I'm trying to plot several lag.plots on a page, however the second plot
 replaces the first one (although it only takes up the upper half as it
 should):

 par(mfrow=c(2,1))
 a<-sin(1:100)
 b<-cos(1:100)
 lag.plot(a)
 lag.plot(b)

 What's the trick to this?
>>>
>>> lag.plot itself calls par(mfrow).  The trick is to get one call to do 
>>> the plots you want:
>>>
>>> lag.plot(cbind(a,b))
>>>
>>>
>>
>> Thanks, that works great for multiple lag.plots. Is it possible to 
>> have a lag.plot and another type of plot on the same page? The second 
>> plot() always replaces the lag.plot for me.
> 
> Yes, if the other plot is second, e.g
> 
> par(mfrow=c(2,1))
> a<-sin(1:100)
> lag.plot(a)
> par(mfg=c(2,1)) # move to second plot
> plot(1:10)
> 
> 

Following from my previous questions, lag.plot doesn't recognise some of 
the standard plot variables, e.g. xaxt="n" doesn't remove the x-axis, 
and setting xlab causes an error:

 > lag.plot(sin(1:100), xlab="foo")
Error in plotts(x = x, y = y, plot.type = plot.type, xy.labels = 
xy.labels,  :
 formal argument "xlab" matched by multiple actual arguments

Is this a bug or a feature?

Also, how can I make lag.plot behave nicely when plotted with other 
plots on the same page? it takes up more room than it's allocated by 
par(mfrow).


Thanks for your help,
Gad

-- 
Gad Abraham
Department of Mathematics and Statistics
University of Melbourne
Victoria 3010, Australia
email: [EMAIL PROTECTED]
web: http://www.ms.unimelb.edu.au/~gabraham

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


Re: [R] Multiple lag.plots per page

2006-06-13 Thread Prof Brian Ripley
On Wed, 14 Jun 2006, Gad Abraham wrote:

> Prof Brian Ripley wrote:
>> On Tue, 13 Jun 2006, Gad Abraham wrote:
>> 
>>> Prof Brian Ripley wrote:
 On Tue, 13 Jun 2006, Gad Abraham wrote:
 
> Hi,
> 
> I'm trying to plot several lag.plots on a page, however the second plot
> replaces the first one (although it only takes up the upper half as it
> should):
> 
> par(mfrow=c(2,1))
> a<-sin(1:100)
> b<-cos(1:100)
> lag.plot(a)
> lag.plot(b)
> 
> What's the trick to this?
 
 lag.plot itself calls par(mfrow).  The trick is to get one call to do the 
 plots you want:
 
 lag.plot(cbind(a,b))
 
 
>>> 
>>> Thanks, that works great for multiple lag.plots. Is it possible to have a 
>>> lag.plot and another type of plot on the same page? The second plot() 
>>> always replaces the lag.plot for me.
>> 
>> Yes, if the other plot is second, e.g
>> 
>> par(mfrow=c(2,1))
>> a<-sin(1:100)
>> lag.plot(a)
>> par(mfg=c(2,1)) # move to second plot
>> plot(1:10)
>> 
>> 
>
> Following from my previous questions, lag.plot doesn't recognise some of the 
> standard plot variables, e.g. xaxt="n" doesn't remove the x-axis, and setting 
> xlab causes an error:
>
>> lag.plot(sin(1:100), xlab="foo")
> Error in plotts(x = x, y = y, plot.type = plot.type, xy.labels = xy.labels, 
> :
>formal argument "xlab" matched by multiple actual arguments
>
> Is this a bug or a feature?

feature.  Note that the help page says

  ...: Further arguments to 'plot.ts'.

and not `graphical parameters'.


> Also, how can I make lag.plot behave nicely when plotted with other plots on 
> the same page? it takes up more room than it's allocated by par(mfrow).

Really you are not using it for its intended purpose, multiple plots at 
different lags.  (Notice the plurals in the title and the description 
on the help page.)  Why not use plot.ts directly?

If you want to pursue lag.plot, try the version in R-devel which works 
better for single-plot displays.

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


Re: [R] R kicking us out

2006-06-13 Thread J Dougherty
On Tuesday 13 June 2006 13:00, Erin Hodgess wrote:
> Dear R People:
>
> I am using R for teaching purposes in a large classroom.
>
> Each computer has its own copy of R.
>
> However, every once in a while, about half of us will get
> thrown out of R, for no apparent reason.
>
> By the way, it has happened in other classrooms as well.
>
>
> Has anyone else run into this, please?
>
> If so, how have you solved this problem, please?
>
> Thanks in advance!
>
> R for Windows
>
You will need to provide a good deal more information before a useful answer 
is likely.  For instance, what operating system do these computers use?  If 
the computers are all running networked in a lab, is there some automatic 
maintenance being run?  What hardware specifications (CPU, memory, harddisk 
storage, etc.)?  What size data sets are being used?  And, more importantly, 
what does "kicking you out" actually mean in terms of computer behaviour?  
Does R simply crash?  When you "about half of us"  is it always the same 
half?  Does it occur at the same time of day?  There are far too many 
unknowns for a diagnosis.

JD

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


[R] Decimal series how to make.........

2006-06-13 Thread anil kumar rohilla
  Hi List,
  I am new to this Rsoftware, i want to make a sereis for example which is 
having values like this, s<- 0,0.1,0.2,0.3,0.4,1 

i tryed this statement
s<-0:0.1:1
but this giving an error megssage.
but by default increment 1 it is taking ,so what to do ,,

i want to use this varible in for loop..

like for(j in s)

thanks in advance


ANIL KUMAR( METEOROLOGIST)
LRF SECTION 
NATIONAL CLIMATE CENTER 
ADGM(RESEARCH)
INDIA METEOROLOGICAL DEPARTMENT
SHIVIJI NAGAR
PUNE-411005 INDIA
MOBILE +919422023277
[EMAIL PROTECTED]

[[alternative HTML version deleted]]

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


Re: [R] Decimal series how to make.........

2006-06-13 Thread Niels Vestergaard Jensen
On 14 Jun 2006, anil kumar rohilla wrote:

>   Hi List,
>   I am new to this Rsoftware, i want to make a sereis for example which 
> is having values like this, s<- 0,0.1,0.2,0.3,0.4,1
>
> i tryed this statement
> s<-0:0.1:1
> but this giving an error megssage.
> but by default increment 1 it is taking ,so what to do ,,

You want the seq() function. Look it up by typing ?seq

About the ":" - watch out for the difference between 1:4-1 and 1:(4-1)
(Go ahead and try)

best

Niels








>
> i want to use this varible in for loop..
>
> like for(j in s)
>
> thanks in advance
>
>
> ANIL KUMAR( METEOROLOGIST)
> LRF SECTION
> NATIONAL CLIMATE CENTER
> ADGM(RESEARCH)
> INDIA METEOROLOGICAL DEPARTMENT
> SHIVIJI NAGAR
> PUNE-411005 INDIA
> MOBILE +919422023277
> [EMAIL PROTECTED]
>
>   [[alternative HTML version deleted]]
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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


Re: [R] Decimal series how to make.........

2006-06-13 Thread Simon Blomberg
?seq

anil kumar rohilla wrote:
>   Hi List,
>   I am new to this Rsoftware, i want to make a sereis for example which 
> is having values like this, s<- 0,0.1,0.2,0.3,0.4,1 
>
> i tryed this statement
> s<-0:0.1:1
> but this giving an error megssage.
> but by default increment 1 it is taking ,so what to do ,,
>
> i want to use this varible in for loop..
>
> like for(j in s)
>
> thanks in advance
>
>
> ANIL KUMAR( METEOROLOGIST)
> LRF SECTION 
> NATIONAL CLIMATE CENTER 
> ADGM(RESEARCH)
> INDIA METEOROLOGICAL DEPARTMENT
> SHIVIJI NAGAR
> PUNE-411005 INDIA
> MOBILE +919422023277
> [EMAIL PROTECTED]
>
>   [[alternative HTML version deleted]]
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>   


-- 
Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat.
Centre for Resource and Environmental Studies
The Australian National University
Canberra ACT 0200
Australia
T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au
F: +61 2 6125 0757
CRICOS Provider # 00120C

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


[R] A whine and a request

2006-06-13 Thread John Vokey
guRus and useRs,

As I instruct my students: "With R what is difficult in anything  
else, is easy, usually one line of code; but, what is easy in  
anything else, is *&^%$%#$... (translation: next to impossible) in R."

I just ran into such a case that has, to put it mildly, driven me to  
use spreadsheets (if that is not a sign of complete desperation, I  
don't know what is).  It has nothing to do with particular versions  
of R or what OS I am using, but something more fundamental.  Here it  
is.  First, I have a very large data-set (the size, though, is not  
the issue) that at base has a single binary response (score 0/1) for  
each line of the data.  Different, large blocks of the data  
correspond to the responses of single participants to stimuli  
differing in feature x, where the distribution of particular  
differences in feature x is different for each participant. Table  
(and ftable) commands are great for reducing these data to isolate  
the Freqs with which particular x values occur within each  
participant, which is what I want, including how the frequency with  
which the participant responded 1 (or 0) to that level of feature x.   
So, assiduous use of table() gives me more or less what I want:  
within participant, the values of x, the associated frequencies of 0  
responses to those values of x, and the associated frequencies of 1  
responses to those values of x.  Now, what I WANT is the simple  
regression of the proportion of 1 responses (out of the sum of 0 and  
1 responses) to each value of x on the values of x.  What table()  
gives me is close, but useless, as I can't access the columns.  But,  
applying data.frame() to the results from table, gives me access to  
the columns as variables, but returns the (re)expanded data, which  
does not allow me to compute the simple proportions I want.  After  
too many hours of trying way too many desperate commands, I gave up.   
I printed the table(), copied it to the clipboard, pasted it into a  
spreadsheet, computed the proportions, fixed the header, saved it as  
a text file, and the read it back into R to do the regressions.   
There has got to be an easier way.
--
Please avoid sending me Word or PowerPoint attachments.
See 

-Dr. John R. Vokey

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