[R] How to schedule R scripts?

2008-03-27 Thread Lauri Nikkinen
useRs, Is there a way to schedule R scripts? I would like to run certain scripts three times a day. I'm running R on Windows XP. > sessionInfo() R version 2.6.0 (2007-10-03) i386-pc-mingw32 locale: LC_COLLATE=Finnish_Finland.1252;LC_CTYPE=Finnish_Finland.1252;LC_MONETARY=Finnish_Finland.1252;LC_

Re: [R] Question about legend

2008-03-27 Thread Gabor Grothendieck
For the legend= argument use this in place of what you have now: legend = expression("0.5th ES test","0.75th ES test", chi^2 ~ test, "t test") On Thu, Mar 27, 2008 at 11:54 PM, kate <[EMAIL PROTECTED]> wrote: > My original legend is > > matplot(c,cbind(ES5,ES75,chisq,t),type ='l', > col=c("bro

[R] Question about legend

2008-03-27 Thread kate
My original legend is matplot(c,cbind(ES5,ES75,chisq,t),type ='l', col=c("brown","red","blue","black"),ylab='power') legend(5,0.7,paste(c("0.5th ES test","0.75th ES test", "Chi-square test", "t test")),col=c("brown","red","blue","black"),lty=1:4,cex=1) I would like to change "Chi-square" to th

[R] Estimating variance components of groups of covariates within regression model

2008-03-27 Thread awade
I am interested in estimating the variance components from different groups of variables in a linear regression. For example, I want to model dependent variable “Y” based on six covariates as follows: (these are land use types measured at three scales for each Y, "Local", "Riparian", and "Catch

Re: [R] Converting a data frame to matrix

2008-03-27 Thread jim holtman
Do an 'str' on your data so that we see what it contains. It may appear to be numbers, but they might also be factors as a result of the read.table. On Thu, Mar 27, 2008 at 7:43 PM, Adrian Johnson <[EMAIL PROTECTED]> wrote: > Hello: > > I have a tab delim file with 100 rows and 100 columns. > > I

[R] Converting a data frame to matrix

2008-03-27 Thread Adrian Johnson
Hello: I have a tab delim file with 100 rows and 100 columns. I have numerical values in this table. What I want is to create an image color map with color gradation. my values range from -5 to 0. max value is 0. to acheive this, I need to convert my data.frame into matrix. I tried following :

Re: [R] creating a list of lists from a data frame

2008-03-27 Thread jim holtman
Is this what you want? > x titlesrc probesets 1 chr16q positional CMAR,USP10,PSORS8,WT3,SLI1 2 chr4p positional ATP5I,MHW1,STGD4 3 chr1q13 positionalSCARNA2 4 chr4q1 positional MORF4LP4 > lapply(seq(nrow(x)), function

[R] [Re: Significance of confidence intervals in the Non-Linear Least Squares Program.]

2008-03-27 Thread glenn andrews
What should I be looking for in the output of the nls() routine that alerts me to the fact that the Hessian is potentially ill-conditioned? Glenn Peter Dalgaard wrote: > glenn andrews wrote: > >> Thanks for the response. I was not very clear in my original request. >> >> What I am asking is if

Re: [R] list as object in dataframe

2008-03-27 Thread jim holtman
df$x is list so you have to use this type of assignment > df$x[[1]] <- c('a','b') > df yx 1 1 a, b 2 1 f, c 3 1a > df$x[[3]] <- letters > df yx 1 1 a, b 2 1 f, c 3 1 a, b, c, > str(df) 'data.frame': 3 obs. of 2 variables: $ y: num 1 1 1 $ x:List of

Re: [R] dreaded p-val for d^2 of a glm / gam

2008-03-27 Thread Spencer Graves
I assume you mean 'deviance', not 'squared deviance'; if the latter, then I have no idea. If the former, then a short and fairly quick answer to your question is that 2*log(likelihood ratio) for nested hypotheses is approximately chi-square with numbers of degrees of freedom = the

Re: [R] generating a paired t-test with multiple levels of a factor

2008-03-27 Thread Peter Dalgaard
Rolf Turner wrote: > > On 28/03/2008, at 11:14 AM, Peter Dalgaard wrote: > >> Michael A. Miller wrote: "James" == James Root <[EMAIL PROTECTED]> writes: >>> Is there a way to run all paired t-tests where a paired t-test is run for every possible combination? >>> >>> Soun

Re: [R] [Re: Significance of confidence intervals in the Non-Linear Least Squares Program.]

2008-03-27 Thread Peter Dalgaard
glenn andrews wrote: > Thanks for the response. I was not very clear in my original request. > > What I am asking is if in a non-linear estimation problem using nls(), > as the condition number of the Hessian matrix becomes larger, will the > t-values of one or more of the parameters being estima

Re: [R] avoiding loops

2008-03-27 Thread Bill.Venables
Ingmar Visser asks: > > Thanks for this. > I was afraid someone was going to say this ... > Does this mean the only way of getting this to run faster is by > moving to C code? Perhaps, but that's not all that difficult for this kind of operation, surely? Even portability across platforms shoul

[R] creating a list of lists from a data frame

2008-03-27 Thread Srinivas Iyyer
Dear group, I have a dataframe (x). (4 rows, 3 columns for example) I want to create a master list (my_list) from data frame. I want each row of x to be a list. I tried 3 different ways: writing a loop, using apply, and going through each row. Going through each row works for me. since I hav

Re: [R] generating a paired t-test with multiple levels of a factor

2008-03-27 Thread Rolf Turner
On 28/03/2008, at 11:14 AM, Peter Dalgaard wrote: > Michael A. Miller wrote: >>> "James" == James Root <[EMAIL PROTECTED]> writes: >>> >> >>> Is there a way to run all paired t-tests where a paired >>> t-test is run for every possible combination? >> >> Sounds like pairwise.t.test is the

Re: [R] Cannot update packages on F8

2008-03-27 Thread Paul Smith
On Thu, Mar 27, 2008 at 10:20 PM, Marc Schwartz <[EMAIL PROTECTED]> wrote: > > I have just updated R to the version 2.6.2 on F8 (with the official F8 > > rpm). However, when running as root the following command: > > > > update.packages(checkBuilt=T) > > > > I get a bunch of errors like the o

[R] [Re: Significance of confidence intervals in the Non-Linear Least Squares Program.]

2008-03-27 Thread glenn andrews
Thanks for the response. I was not very clear in my original request. What I am asking is if in a non-linear estimation problem using nls(), as the condition number of the Hessian matrix becomes larger, will the t-values of one or more of the parameters being estimated in general become smaller

Re: [R] Cannot update packages on F8

2008-03-27 Thread Marc Schwartz
Paul Smith wrote: > Dear All, > > I have just updated R to the version 2.6.2 on F8 (with the official F8 > rpm). However, when running as root the following command: > > update.packages(checkBuilt=T) > > I get a bunch of errors like the ones below. Any ideas? > > Thanks in advance, > > Paul >

Re: [R] generating a paired t-test with multiple levels of a factor

2008-03-27 Thread Peter Dalgaard
Michael A. Miller wrote: >> "James" == James Root <[EMAIL PROTECTED]> writes: >> > > > Is there a way to run all paired t-tests where a paired > > t-test is run for every possible combination? > > Sounds like pairwise.t.test is the sort of thing you are looking > for...

[R] Cannot update packages on F8

2008-03-27 Thread Paul Smith
Dear All, I have just updated R to the version 2.6.2 on F8 (with the official F8 rpm). However, when running as root the following command: update.packages(checkBuilt=T) I get a bunch of errors like the ones below. Any ideas? Thanks in advance, Paul ---

[R] competing risks regression

2008-03-27 Thread Yu, Changhong
Dear R users, I used crr function in R package 'cmprsk' to fit a competing risks model. There were no any error or warning messages during running the function, but the output was obvious not correct. I saved the model fit as an object called f.crr. I extracted bfitj from the object by doi

[R] Extracting output data into a vector or matrix

2008-03-27 Thread Ayman Oweida
I've been struggling to do the following: After a lengthy computation, I receive an output along the lines of the list below. This list has 41 values and is not the end of my computations. I have another computation to do on the list below, but in this final computation the list is supposed

[R] panel function question

2008-03-27 Thread Weidong Gu
I have two data sets with locations, X, Y of houses (df.house) and habitats(df.habitat), respectively. In each dataset, there are 3 replicates (Repeat). Because each replicate has different locations of houses and habitats, I would like to plot them in panels. I wrote something like this: mypa

[R] list as object in dataframe

2008-03-27 Thread Daniel E. Bunker
Hi All, I need to place lists or vectors within dataframes as single elements. However when I try this: df=data.frame(y=1, x=I(list(c("a","b"), c("f","c"), c("a" df df[1,'x']=I(c("a","d")) I get this error, even though I am using I(): Error in `[<-.data.frame`(`*tmp*`, 1, "x", value = c

Re: [R] Extracting single output data into a vector or matrix

2008-03-27 Thread Mike Prager
Ayman, It is difficult to say without seeing some code, but your output seems to be not a list in the R sense but a collection of vectors, each of length 1. The best way to put the values into a vector probably is to assign them to the elements of the vector during your computations. Mike Prager

Re: [R] Covariates in LME?

2008-03-27 Thread Douglas Bates
On Thu, Mar 27, 2008 at 7:01 AM, Aberg Carl <[EMAIL PROTECTED]> wrote: > Hi, > Im using lme to calculate a mixed factors ANOVA according to: > px_anova = anova(lme(dep~music*time*group, random = ~1|id, data = px_data)) > where > dep is a threshold, > time is a repeated measures variable (2

Re: [R] functions

2008-03-27 Thread Jan de Leeuw
Sorry. I mean a_{i_1i_2\cdots i_m}\approx\sum_{s=1}^p x^1_{i_1s}x^2_{i_2s}\cdots x^m_{i_ms} -- J. On Mar 27, 2008, at 12:57 , Jan de Leeuw wrote: > I wrote some functions for multiway CANDECOMP, i.e. for least > squares fitting of > > a_{i_1\cdots i_m}\approx\sum_{s=1}^p x^1_{i_1s}x^1_{i_1s}\

Re: [R] colMeans in a data.frame with numeric and character data

2008-03-27 Thread Gabor Grothendieck
summaryBy in the doBy package can do that. The builtin iris data set has 4 numeric columns and one factor column: > library(doBy) > summaryBy(.~1, iris, fun = mean, keep = TRUE) Sepal.Length Sepal.Width Petal.Length Petal.Width 1 5.843.0573333.7581.199333 On Thu, Mar 2

[R] functions

2008-03-27 Thread Jan de Leeuw
I wrote some functions for multiway CANDECOMP, i.e. for least squares fitting of a_{i_1\cdots i_m}\approx\sum_{s=1}^p x^1_{i_1s}x^1_{i_1s}\cdots x^m_{i_ms} with arrays of arbitrary dimension. Reminded me of the good old APL days. I could not find this in the archives, but if it's already there,

[R] Extracting single output data into a vector or matrix

2008-03-27 Thread Ayman Oweida
I've been struggling to do the following: After a lengthy computation, I receive an output along the lines of the list below. This list has 41 values and is not the end of my computations. I have another computation to do on the list below, but in this final computation the list is supposed

Re: [R] colMeans in a data.frame with numeric and character data

2008-03-27 Thread Douglas Bates
On Thu, Mar 27, 2008 at 3:05 PM, Dimitris Rizopoulos <[EMAIL PROTECTED]> wrote: > try this: > > dat <- data.frame(x = rnorm(10), y = rexp(10), z = letters[1:10]) > colMeans(data.matrix(dat[sapply(dat, is.numeric)])) Alternatively > sapply(dat, mean) x y z -0.5260131

Re: [R] assistance with RDAtest beta version application

2008-03-27 Thread Guillaume Blanchet
Hi !! Stanfield, Les (MNR) a écrit : > Thank you so much for coming to my rescue!: > > OK I have been able to open it (but only in the R editor. I assumed that we > had to generate our own files of XX.txt and YY.txt and bring them into R > before the program could run Is this right? >

Re: [R] colMeans in a data.frame with numeric and character data

2008-03-27 Thread Dimitris Rizopoulos
try this: dat <- data.frame(x = rnorm(10), y = rexp(10), z = letters[1:10]) colMeans(data.matrix(dat[sapply(dat, is.numeric)])) I hope it helps. Best, Dimitris Dimitris Rizopoulos Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuv

Re: [R] generating a paired t-test with multiple levels of a factor

2008-03-27 Thread Rolf Turner
On 28/03/2008, at 8:42 AM, Michael A. Miller wrote: >> "James" == James Root <[EMAIL PROTECTED]> writes: > >> Is there a way to run all paired t-tests where a paired >> t-test is run for every possible combination? > > Sounds like pairwise.t.test is the sort of thing you are looking > for...

Re: [R] histogram for integer data

2008-03-27 Thread Erwann.Rogard
Thanks! Yes, but I also want to be able to condition easily hence histogram(...), not plot -Original Message- From: Don MacQueen [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2008 3:55 PM To: Rogard, Erwann R&D/US/EXT; r-help@r-project.org Subject: Re: [R] histogram for integer da

Re: [R] histogram for integer data

2008-03-27 Thread Don MacQueen
You might consider something based on the concept of: y <- table( x) plot( as.numeric(names(y)) , y, type='h') -Don At 2:59 PM -0400 3/27/08, <[EMAIL PROTECTED]> wrote: >hi, > >library(lattice) >x<-c(-1,-1,-1,0,0,0,0,1,1,2) >rng<-range(x) >histogram(x,endpoints=c(rng[1]-0.5,rng[2]+0.5),nin

[R] colMeans in a data.frame with numeric and character data

2008-03-27 Thread Diogo André Alagador
Hi all, I would like to know if it is posible by, someway, to get colMeans from a data.frame with numeric as well as character data, dispersed all over the object. Note that I would like to get colMeans neglecting character data. I am really in need of some function proceeding in that way… Al

Re: [R] generating a paired t-test with multiple levels of a factor

2008-03-27 Thread Michael A. Miller
> "James" == James Root <[EMAIL PROTECTED]> writes: > Is there a way to run all paired t-tests where a paired > t-test is run for every possible combination? Sounds like pairwise.t.test is the sort of thing you are looking for... Mike __ R

[R] dreaded p-val for d^2 of a glm / gam

2008-03-27 Thread Monica Pisica
OK, I really dread to ask that much more that I know some discussion about p-values and if they are relevant for regressions were already on the list. I know to get p-val of regression coefficients - this is not a problem. But unfortunately one editor of a journal where i would like to pu

Re: [R] assistance with RDAtest beta version application

2008-03-27 Thread Guillaume Blanchet
Hi ! I am familiar with the rdaTest package. It works perfectly find for me. Can you give me more details on the problems you have so I can be of greater help ! Have a nice day ! Guillaume Blanchet PhD student Stanfield, Les (MNR) a écrit : > Pierre Legendre has developed a beta version of a

[R] histogram for integer data

2008-03-27 Thread Erwann.Rogard
hi, library(lattice) x<-c(-1,-1,-1,0,0,0,0,1,1,2) rng<-range(x) histogram(x,endpoints=c(rng[1]-0.5,rng[2]+0.5),nint=length(unique(x))) instead of contiguous bins, i'd like spaces between them to indicate that the data is discrete, or even better, line segments positioned at integer values. i kn

Re: [R] Recode factors

2008-03-27 Thread Abhijit Dasgupta
Another suggestion is: blah = as.character(aa) blah=gsub('[a-z]','0',blah,ignore.case=T) aa = as.factor(blah) I've found changing factors to characters rather than numeric is generally safer. Abhijit Doran, Harold wrote: > Perfect. My headache is gone. Thanks. > > >> -Original Message-

Re: [R] Execute R with *.RData argument

2008-03-27 Thread Bio7
Thanks for the nice tip. I also consider to use the clipboard to transfer a command with the file path which then can be pasted easily in the shell and executed. Gabor Grothendieck wrote: > > Not sure if this is sufficient but if you always open your RData > file in the same directory this

[R] assistance with RDAtest beta version application

2008-03-27 Thread Stanfield, Les (MNR)
Pierre Legendre has developed a beta version of a new redundancy analysis package called RdaTest that is available on his web page at the Universit® de Montréal. The test example that is included with the package is based on the example provided in his book (Numerical Ecology, Chapter 11 (Legen

Re: [R] barplot as Trellis graphic

2008-03-27 Thread Charilaos Skiadas
On Mar 27, 2008, at 1:47 PM, Agustin Lobo wrote: > Thanks, it was a matter of reshaping the data matrix as I usually have > it, ie: > datos <- > data.frame(x=abs(round(rnorm(100,10,5))),y=abs(round(rnorm > (100,2,1))),f=factor(round(runif(100,1,3 > > to become: > > datos2 <- > data.frame(V1=

Re: [R] barplot as Trellis graphic

2008-03-27 Thread Agustin Lobo
Thanks, it was a matter of reshaping the data matrix as I usually have it, ie: datos <- data.frame(x=abs(round(rnorm(100,10,5))),y=abs(round(rnorm(100,2,1))),f=factor(round(runif(100,1,3 to become: datos2 <- data.frame(V1=c(datos[,1],datos[,2]),"VAR"=c(rep("x",100),rep("y",100)),f=factor(c

Re: [R] Recode factors

2008-03-27 Thread Doran, Harold
Perfect. My headache is gone. Thanks. > -Original Message- > From: Henrique Dallazuanna [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 27, 2008 12:50 PM > To: Doran, Harold > Cc: r-help@r-project.org > Subject: Re: [R] Recode factors > > If I understand, you can try this: > > levels

Re: [R] Recode factors

2008-03-27 Thread Henrique Dallazuanna
If I understand, you can try this: levels(x)[is.na(as.numeric(levels(x)))] <- 0 On 27/03/2008, Doran, Harold <[EMAIL PROTECTED]> wrote: > I know this comes up, but I didn't see my exact issue in the archives. I > have variables in a dataframe that need to be recoded. Here is what I'm > dealing

[R] Recode factors

2008-03-27 Thread Doran, Harold
I know this comes up, but I didn't see my exact issue in the archives. I have variables in a dataframe that need to be recoded. Here is what I'm dealing with I have a factor called aa > class(aa) [1] "factor" > table(aa) aa *0123ABCDLNT 0

Re: [R] Thinking about using two y-scales on your plot?

2008-03-27 Thread Martin Rittner
Hello all, I know I'm not making friends with this, but: I absolutely see the point in dual-(or more!)-y-axis plots! I find them quite informative, and I see them often. In Earth-Sciences (and I very generously include atmospheric sciences here, as Johannes has given an example of a meteorologi

Re: [R] A faster way to compute finite-difference gradient of ascalarfunction of a large number of variables

2008-03-27 Thread Prof Brian Ripley
On Thu, 27 Mar 2008, Ravi Varadhan wrote: > Thank you, Dimitris & Christos. > > Yes, "myfunc" is a scalar function that needs to be minimized over a > high-dimensional parameter space. I was afraid that there might be no > better way, apart from coding in C. Thanks, Dimitris, for confirming my >

Re: [R] A faster way to compute finite-difference gradient of ascalarfunction of a large number of variables

2008-03-27 Thread Ravi Varadhan
Thank you, Dimitris & Christos. Yes, "myfunc" is a scalar function that needs to be minimized over a high-dimensional parameter space. I was afraid that there might be no better way, apart from coding in C. Thanks, Dimitris, for confirming my fear! Best regards, Ravi. -

[R] Dendrogram orientation

2008-03-27 Thread Lassana TOURE
I am using the two functions hclust and plot to draw a dendrogram. The result is a vertical dendrogram , but I prefer a horizontal one. Need help. This is my script: dd1=hclust(d1, method="ward") plot(dd1) [[alternative HTML version deleted]] __

Re: [R] A faster way to compute finite-difference gradient of ascalarfunction of a large number of variables

2008-03-27 Thread Dimitris Rizopoulos
If 'myfunc' is a vector function and can be vectorized in R, then it is even faster to use the following: grad.vec <- function(x, fn, ..., eps = sqrt(.Machine$double.neg.eps)){ x1 <- x + eps * pmax(abs(x), 1) x2 <- x - eps * pmax(abs(x), 1) (fn(x1, ...) - fn(x2, ...)) / (x1 - x2) } g

[R] R Code and the Pygments Python SyntaxHighlighter

2008-03-27 Thread Hans W. Borchers
Dear R Help, is someone going to write a R/S language lexer for the Pygments Python syntax highlighter ? As it is used now by Trac, Django, or the Python documentation tool Sphinx, the R community can apply it in Python-based Wikis like Moinmoin and others. Hans Werner

Re: [R] A faster way to compute finite-difference gradient of a scalarfunction of a large number of variables

2008-03-27 Thread Christos Hatzis
Here is as solution that calculates derivatives using central differences by appropriately embedding the vectors: > grad.1 function(x, fn) { x <- sort(x) x.e <- head(embed(x, 2), -1) y.e <- embed(fn(x), 3) hh <- abs(diff(x.e[1, ])) y.e <- apply(y.e, 1, function(z) (z[1] - z[3])/(2 * hh)) cbind

Re: [R] Dynamic string as element name in a list

2008-03-27 Thread Henrique Dallazuanna
But, your lapply is: lapply(x$clipno, function(c){ clipname <- x$clipname out[[clipname]] <- rnorm(5) }) So, you don't use 'c' argument. On 27/03/2008, Paul Lemmens <[EMAIL PROTECTED]> wrote: > Hi, > > Sorry yes, I forgot to give comment about th

Re: [R] inheritence in S4

2008-03-27 Thread Martin Morgan
[EMAIL PROTECTED] wrote: > Sorry to come back on callNextMethod, I am still not very confident > about it. > > Consideres the following (there is a lot of code, but very simple with > almost only some cat) : > > -- > setClass("A",representation(a="numeric")) > setValidity("A",fu

Re: [R] options in 'rnorm' to set the lower bound of normal distribution to 0 ?

2008-03-27 Thread Tom Cohen
Thanks Prof Brian for your suggestion. I should know that for right-skewed data, one should generate the samples from a lognormal. My problem is that x and y are two instruments that were thought to be measured the same thing but somehow show a wide confidence interval of the difference betwe

Re: [R] Reading in multiple files in a loop

2008-03-27 Thread Paul Lemmens
On Thu, Mar 27, 2008 at 4:40 PM, Zu Thur Yew <[EMAIL PROTECTED]> wrote: > > for (r in 1:100) { > d1 <-read.table(r.anl) read.table(paste(r,".anl", sep="")) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do rea

[R] A faster way to compute finite-difference gradient of a scalar function of a large number of variables

2008-03-27 Thread Ravi Varadhan
Hi All, I would like to compute the simple finite-difference approximation to the gradient of a scalar function of a large number of variables (on the order of 1000). Although a one-time computation using the following function grad() is fast and simple enough, the overhead for repeated evalua

Re: [R] help! - spectral analysis - spec.pgram

2008-03-27 Thread Prof Brian Ripley
On Thu, 27 Mar 2008, Nuno Prista wrote: > Can someone explain me this spec.pgram effect? > > > > Code: > > > > period.6<-c(0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10 > ,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10) > > period.5<-c(0,0,0,0,0,10,0,0,0,0,10,0

[R] Reading in multiple files in a loop

2008-03-27 Thread Zu Thur Yew
Hi, I'm new to R and want to use it to analyse a number of data files (e.g. 100). I want to read in multiple files in a loop in a specific order (e.g. 1 to 100) and was hoping to do something like: for (r in 1:100) { d1 <-read.table(r.anl) for (r2 in 1:100) { d2 <-read.table(r2.anl) cc

Re: [R] snow, stopping cluster

2008-03-27 Thread Luke Tierney
Not at present. The next release should include something along these lines. luke On Thu, 27 Mar 2008, Markus Schmidberger wrote: > Hello, > > is there any function in the package snow to check for a really running > cluster? > The function checkCluster only checks the variable cl. And the var

[R] help! - spectral analysis - spec.pgram

2008-03-27 Thread Nuno Prista
Can someone explain me this spec.pgram effect? Code: period.6<-c(0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10 ,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10,0,0,0,0,0,10) period.5<-c(0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,0,0,10,0,0,0,0,10,0,0,0,0,0,0,10 ,0,0,0,0,10,0,0,

Re: [R] strptime and plot(),lines()

2008-03-27 Thread Don MacQueen
As Gabor said, your zeit should be a POSIXct object, not a POSIXlt object. Then, for example: zeit <- Sys.time() + 150*runif(10) val <- rnorm(10) plot(zeit,val,xaxt='n') axis.POSIXct(1,zeit, format='%Y-%m-%d %H:%M') Or better (perhaps) yet: plot(zeit,val,xaxt='n') axis.POS

Re: [R] generate random numbers subject to constraints

2008-03-27 Thread Charles C. Berry
On Thu, 27 Mar 2008, Robert A LaBudde wrote: > At 05:06 PM 3/26/2008, Ted Harding wrote: >> On 26-Mar-08 21:26:59, Ala' Jaouni wrote: >>> X1,X2,X3,X4 should have independent distributions. They should be >>> between 0 and 1 and all add up to 1. Is this still possible with >>> Robert's method? >>>

Re: [R] options in 'rnorm' to set the lower bound of normal dist

2008-03-27 Thread Prof Brian Ripley
On Thu, 27 Mar 2008, [EMAIL PROTECTED] wrote: Brian Ripley's suggestions of truncated normal and log-normal are of course resources for ensuring that you get positive simulated results. I was answering the question asked! Wanting to simulate from the fitted mean and sd does *not* mean you wan

Re: [R] Want to draw 3D cylinder objects

2008-03-27 Thread Greg Snow
Here is one approach to drawing simple cylinders at specified locations, the height, width, and angle should all be numbers between 0 and 1 and you may want to rewrite the ms.cylinder function below so that the arguments are more meaningful relative to the input data that you want to use: > li

Re: [R] Dynamic string as element name in a list

2008-03-27 Thread Paul Lemmens
Hi, Sorry yes, I forgot to give comment about the lapply(). > > foo <- function(x) { > > out <- list() > > lapply(x$clipno, function(c) { > > clipname <- x$clipname > > # stuff > > > > out[[clipname]] <- rnorm(5) > > }) > > return(out) > > } > > So x is a dataframe with th

Re: [R] strptime and plot(),lines()

2008-03-27 Thread Gabor Grothendieck
You normally want to represent your times as POSIXct rather than POSIXlt so try xct <- as.POSIXct(xlt) or you may want to use chron. Read read more about this in R News 4/1 which has info on dates and times. Use the axis or Axis command to create custom axes. ?axis ?Axis You may also want to l

Re: [R] Execute R with *.RData argument

2008-03-27 Thread Gabor Grothendieck
Not sure if this is sufficient but if you always open your RData file in the same directory this may be good enough: mkdir ~/tmp cd ~/tmp R x <- 33 q() # answer y to save in .RData Now whenever you open R in ~/tmp it will load .RData containing x. You must be in ~/tmp and the file must be called

Re: [R] Dynamic string as element name in a list

2008-03-27 Thread Henrique Dallazuanna
HI, I don't understand why you're using lapply. Please provide a example of your 'x' data.frame str(x) On 27/03/2008, Paul Lemmens <[EMAIL PROTECTED]> wrote: > Hi Henrique, > > > On Thu, Mar 27, 2008 at 2:52 PM, Henrique Dallazuanna <[EMAIL PROTECTED]> > wrote: > > Try this: > > > > foo <

Re: [R] Execute R with *.RData argument

2008-03-27 Thread Bio7
$ R ... > load("/home/user/workspace.RData") or put that line in your .Rprofile -- see ?Startup. (My guess is that you are used to the facility for drag-and-drop on Windows. Also, please re-read 'An Introduction to R' for the supported command-line arguments -- '-f' is supported but this is not

[R] how to apply bootstrap with a grouping variable?

2008-03-27 Thread Alfonso Pérez
Hello, my name is Alfonso. I'm trying to apply bootstrap to a database. This database present as variables: cohort, age, length, an group. The variable group is unique for each age*cohort, at this way, if we have 18 cohorts and we study individuals with an age between 2 and 10 years (9 dife

Re: [R] Rule for accessing attributes?

2008-03-27 Thread Prof Brian Ripley
On Thu, 27 Mar 2008, Christos Hatzis wrote: > Yes, indeed. The help page says that @ extracts the contents of a slot in > S4 objects. But you mention below that this 'works' for S3 objects because > S4 slots are stored as attributes. Doesn't this mean that @ is currently > implemented to access

Re: [R] Dynamic string as element name in a list

2008-03-27 Thread Paul Lemmens
Hi Henrique, On Thu, Mar 27, 2008 at 2:52 PM, Henrique Dallazuanna <[EMAIL PROTECTED]> wrote: > Try this: > > foo <- function(x) > { > clipname <- "LK" > out <- list() > out[[clipname]] <- rnorm(5) > return(out) > } That easy ... Hadn't thought of it. But now I have a refinement in foo() f

Re: [R] barplot as Trellis graphic

2008-03-27 Thread Deepayan Sarkar
On 3/26/08, Agustin Lobo <[EMAIL PROTECTED]> wrote: > Dear list, > > Is there any way of making barplots as a Trellis graphic? Yes, the function to use is 'barchart'. -Deepayan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo

[R] strptime and plot(),lines()

2008-03-27 Thread erkan yanar
Hello, Im reading Data out of a Database. #v+ rs <- dbGetQuery(con,"SELECT * ... ) attach(rs) #v- There ist a colum I convert into "Time". #v+ > zeit<-strptime(datum,format="%Y-%m-%d %H:%M:%S"); > class(zeit) [1] "POSIXt" "POSIXlt" #v- 1. A plot(zeit,money) plots the Data. All i see on the x

Re: [R] options in 'rnorm' to set the lower bound of normal dist

2008-03-27 Thread Ted Harding
Brian Ripley's suggestions of truncated normal and log-normal are of course resources for ensuring that you get positive simulated results. However, I think youre real problem (having looked at the numbers you quote) is that you should not be thinking of using a normal distribution, or anything si

Re: [R] Dynamic string as element name in a list

2008-03-27 Thread Henrique Dallazuanna
Try this: foo <- function(x) { clipname <- "LK" out <- list() out[[clipname]] <- rnorm(5) return(out) } On 27/03/2008, Paul Lemmens <[EMAIL PROTECTED]> wrote: > Dear all, > > I have a piece of code along the lines of > > f <- function(x) { > clipname <- "LK" # but is in real determined based

Re: [R] generate random numbers subject to constraints

2008-03-27 Thread Naji Nassar
Hi all One suggestion, tranforme the x 00 u > or < ln() (u1 & u2 are not independant) Compute u3 given the above formula Generate the x Hope this help Naji Le 26/03/08 22:41, « Ala' Jaouni » <[EMAIL PROTECTED]> a écrit : > X1,X2,X3,X4 should have independent distributions. They shoul

[R] Dynamic string as element name in a list

2008-03-27 Thread Paul Lemmens
Dear all, I have a piece of code along the lines of f <- function(x) { clipname <- "LK" # but is in real determined based on info in data.frame x # other manipulations return( list(clipname=list())) } My intention is to do out <- f(dat) and then (in this example) having/getting out$LK

Re: [R] Rule for accessing attributes?

2008-03-27 Thread Christos Hatzis
Yes, indeed. The help page says that @ extracts the contents of a slot in S4 objects. But you mention below that this 'works' for S3 objects because S4 slots are stored as attributes. Doesn't this mean that @ is currently implemented to access attributes of objects in general (attributes of S3 o

Re: [R] Slow code display in R console

2008-03-27 Thread John Kane
It could be almost anything. You need to supply some information about what you are doing and your system It would be a good idea to supply the information that sessionInfo() gives. --- Huilin Chen <[EMAIL PROTECTED]> wrote: > Hi > > When I copy a block of code to R console, the code > would

Re: [R] avoiding loops

2008-03-27 Thread Ingmar Visser
Thanks for this. I was afraid someone was going to say this ... Does this mean the only way of getting this to run faster is by moving to C code? The cases I'm thinking of applying this in have dimensions of A that are much larger than the example, eg n by n by T where n has a max of 10 or so b

Re: [R] difference between 2 ecdfs

2008-03-27 Thread Zaihra T
Please chk out the url below it might be of some help for plotting step function or *look like* of step function. On Thu, 27 Mar 2008 09:03:58 -0400 wrote: > Thanks to David and Zaihra for their help. > > Besides plotting the difference between 2 ecdfs, I also would like it to

Re: [R] options in 'rnorm' to set the lower bound of normal distribution to 0 ?

2008-03-27 Thread Prof Brian Ripley
On Thu, 27 Mar 2008, Tom Cohen wrote: > > Dear list, > I have a dataset containing values obtained from two different > instruments (x and y). I want to generate 5 samples from normal > distribution for each instrument based on their means and standard > deviations. The problem is values from

Re: [R] difference between 2 ecdfs

2008-03-27 Thread Erwann.Rogard
Thanks to David and Zaihra for their help. Besides plotting the difference between 2 ecdfs, I also would like it to *look like* a step function. Any suggestion? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Winsemius Sent: Friday, March 21, 2008 8

Re: [R] Rule for accessing attributes?

2008-03-27 Thread hadley wickham
> xydf <- data.frame(x = 1:5, y = 11:15) > plt <- ggplot(data = xydf, aes(x = x,y = y)) + geom_point() > attributes(plt) > > Now we can change the title: > > plt$title <- "My Title" > plt This is rather poorly documented, but the preferred way of setting the title is now: p + opts(title = "

Re: [R] ggplot2 argument handling odd

2008-03-27 Thread hadley wickham
> Ok, I will try that, thanks. BTW, where is this aes_string option > documented, sounds useful? How could I do the same thing with facetting? > If I want to save something like ". ~ groupVar" as a string in a > variable, could I pass it with facet_string to ggplot? It's a see also from ?aes (

[R] options in 'rnorm' to set the lower bound of normal distribution to 0 ?

2008-03-27 Thread Tom Cohen
Dear list, I have a dataset containing values obtained from two different instruments (x and y). I want to generate 5 samples from normal distribution for each instrument based on their means and standard deviations. The problem is values from both instruments are non-negative, so if using

[R] Covariates in LME

2008-03-27 Thread Aberg Carl
Hi, Im using lme to calculate a mixed factors ANOVA according to: px_anova = anova(lme(dep~music*time*group, random = ~1|id, data = px_data)) where dep is a threshold, time is a repeated measures variable (2 levels) group is a between subjects variable (2 levels) id is a random factor (subject i

[R] adding bwplot to existing bwplot

2008-03-27 Thread Karin Lagesen
Hello. I have made many normal boxplots where I have added a new boxplot to an existing one. When I have done this, I have used the at command to move the boxplots a bit so that they could fit next to eachother, like this: boxplot(data.., at = number_of_categories-0.15) boxplot(data..,

[R] Covariates in LME?

2008-03-27 Thread Aberg Carl
Hi, Im using lme to calculate a mixed factors ANOVA according to: px_anova = anova(lme(dep~music*time*group, random = ~1|id, data = px_data)) where dep is a threshold, time is a repeated measures variable (2 levels) group is a between subjects variable (2 levels) id is a random factor (subject i

Re: [R] Mac OS X 10.4.11 - R2.6.2 - Problem with proxy

2008-03-27 Thread Liviu Andronic
Hello Vincent, On Thu, Mar 27, 2008 at 11:25 AM, Vincent Alcouffe <[EMAIL PROTECTED]> wrote: > I have 60 Macintoshs on Mac OS X 10.4.11 for learn "R" to studient > of University and i want to Install New Packages. I click on the button > "access list Mirrors" and it propose me a list of mirr

[R] [R-pkgs] Update of TeachingDemos package

2008-03-27 Thread Greg Snow
This is to announce that versio 2.0 of the TeachingDemos package is now on CRAN (and hopefully soon to a mirror near you). This is a major upgrade of the package, some of the improvements include: The package now uses an NAMESPACE so it is easier to load just the parts that you need. Some of the

[R] Mac OS X 10.4.11 - R2.6.2 - Problem with proxy

2008-03-27 Thread Vincent Alcouffe
Hello, I have 60 Macintoshs on Mac OS X 10.4.11 for learn "R" to studient of University and i want to Install New Packages. I click on the button "access list Mirrors" and it propose me a list of mirrors. None work correctly. All the mirrors take an error. For exemple for the Lyon (France)

Re: [R] Loop problem

2008-03-27 Thread Jim Lemon
Oops, missed the first line of the example: storm.data<-data.frame(meas.index=10001:2,cumrain=runif(1,-10,10)+10) You can generalize the function to whatever column names you have like this: find.max.rain<-function(raindata,howmany,raincol) { # a lazy way of getting the same structure

Re: [R] Re place with previous value

2008-03-27 Thread bartjoosen
Maybe something like: f <- function(x,y) ifelse(sign(y[x])==-1,return(y[x-1]), return(y[x])) test[,3] <- sapply(seq_along(test[,3]),f,test[,3]) Ravi S. Shankar wrote: > > Hi R, > > I have a dataframe with > dim(test) > [1] 435150 4 > class(test) > [1] "data.frame" > In the third colum

  1   2   >