Re: [R] How to turn a string into a variable name ?

2008-03-14 Thread Ng Stanley
Thanks everyone. On 3/14/08, Simon Blomberg [EMAIL PROTECTED] wrote: Or maybe use assign? assign(natural_nums, 1:10) natural_nums [1] 1 2 3 4 5 6 7 8 9 10 Cheers, Simon. On Fri, 2008-03-14 at 14:39 +1000, [EMAIL PROTECTED] wrote: I'm not sure why you would wish to do

[R] alias for a class

2008-03-14 Thread Christophe Genolini
Hi the list Is it possible to give two names for a class ? One long name for using in programmation, and one short name for the quick and durty uses ? With function, we can do mcf - myCoolFunction - function(x) With class, I define clusterizedLongData, I want to use it with the full name

Re: [R] zoo object: replace NAs from another zoo object

2008-03-14 Thread Timothy W. Hilton
Gabor, Many thanks for your suggestion. This solution is very close, but not exactly what I had in mind, because na.omit removes the entire row in which an NA appears. I want to replace values in old with non-NA values from corresponding times in new. If a timestamp from old does not appear

Re: [R] alias for a class

2008-03-14 Thread Duncan Murdoch
Christophe Genolini wrote: Hi the list Is it possible to give two names for a class ? One long name for using in programmation, and one short name for the quick and durty uses ? Not easily. With function, we can do mcf - myCoolFunction - function(x) That creates a new function

[R] Selecting elements in vector

2008-03-14 Thread Rainer M Krug
Hi Consider the following code x - rep(1:13, 13) y - 1:3 I want to select all elements in x which are equal to 1, 2 or 3. I know that I could use sel - x==y[1] | x==y[2] | x==y[3] x[sel] to obtain the values, but in my analysis, the y-vector is thousands of elements long. Is there any

Re: [R] alias for a class

2008-03-14 Thread cgenolin
Not easily. Ok So you could probably write a function that tracked down and copied all the pieces, but it's not easy. b. Well, you're right, it's not worth it. So I will define a class ClusterizLongData then a constructor cld - clusterizLongData - function(){new(ClusterizLongData)}

[R] Optimization with constraint.

2008-03-14 Thread Andreas Klein
Hello. I have some problems, when I try to model an optimization problem with some constraints. The original problem cannot be solved analytically, so I have to use routines like Simulated Annealing or Sequential Quadric Programming. But to see how all this works in R, I would like to start

Re: [R] Selecting elements in vector

2008-03-14 Thread Gabor Csardi
Use %in%: x [ x %in% y ] G. On Fri, Mar 14, 2008 at 12:37:45PM +0200, Rainer M Krug wrote: Hi Consider the following code x - rep(1:13, 13) y - 1:3 I want to select all elements in x which are equal to 1, 2 or 3. I know that I could use sel - x==y[1] | x==y[2] | x==y[3]

Re: [R] Selecting elements in vector

2008-03-14 Thread Rainer M Krug
Thanks - that is exactly what I was looking for Rainer On Fri, Mar 14, 2008 at 1:10 PM, Henrique Dallazuanna [EMAIL PROTECTED] wrote: Try this: x[x %in% y] On 14/03/2008, Rainer M Krug [EMAIL PROTECTED] wrote: Hi Consider the following code x - rep(1:13, 13) y

Re: [R] Plot contour over filled contour

2008-03-14 Thread S Ellison
Devred, Emmanuel [EMAIL PROTECTED] 13/03/2008 18:08:45 Dear R-users, I haven't found a way in the searchable archive to overplot a contour (lines) over a surface. I got round this by using the plot.axis parameter, which accepts a set of plotting commands and isn't fussy about what. Since

[R] cmd shell

2008-03-14 Thread elyakhlifi mustapha
Hello. I have a problem with shell langage. To delete a not empty directory using the OS shell I have to do like this: rd /s dossier1 and dossier1 contain an other directory dossier2. But when I use the function shell like this: shell(paste(rd /s,shQuote(dossier1,type=cmd))) it

[R] arules package (apriori)

2008-03-14 Thread soumaya_ben_hassine
hello, I want to perform the Apriori association rules algorithm to my data. The set of data contains missing values and consists in a combination of continuous and categorical variables. After discretizing the continuous variables, I wrote the following instruiction to perform Apriori, but I

Re: [R] zoo object: replace NAs from another zoo object

2008-03-14 Thread Gabor Grothendieck
Try this: window(old, time(new)) - ifelse(is.na(new), old[time(new)], new) old PPAR pcp (05/19/06 23:58:00) NA NA NA (05/20/06 00:00:00) 956.23 252.30 NA (05/20/06 00:02:00) 955.68 244.85 0 (05/20/06 00:04:00) 955.70 236.45 0 (05/20/06 00:06:00) 955.68

[R] smoothScatter

2008-03-14 Thread Tom Hart
Hi, I have been trying to plot density plots using the example on: http://addictedtor.free.fr/graphiques/graphcode.php?graph=139 I used to use this function, but I cannot get any old code or even the example to work. library(geneplotter) require(RColorBrewer) x1 - matrix(rnorm(1e4),

[R] Comparing switchpoints from segmented

2008-03-14 Thread Rob Knell
Hello everyone Not strictly an R question but close... hopefully someone will be able to help. I wish to compare the switchpoints in two switchpoint regressions. The switchpoints were estimated using the segmented library running in R, and I have standard errors for the estimates. I

Re: [R] test individual values in rows

2008-03-14 Thread Gabor Csardi
keep - apply( DATA, 1, min ) = 100 DATA - DATA[ keep, ] See ?apply for more. Gabor On Fri, Mar 14, 2008 at 01:26:49PM +, IAIN GALLAGHER wrote: Hi list. I have a numerical dataset 22,000 rows deep and 43 columns wide. I would like to remove those rows which contain only values less

[R] Mixed Model nested ANOVA (lme help)

2008-03-14 Thread Stephen Cole
Hello Again R help readers - I have posted in the past and want to thank all those who replied with helpful suggestions. This regards mixed model anova, and the nlme package. My purpose is to make a comparison of barnacle recruit density from 3 different regions. In each of these regions i have

[R] GDD and dashed lines (lty=2)

2008-03-14 Thread Charles Annis, P.E.
Greetings, R Aficionados: I'm running R2.6.2 on a DELL WinXP box with 2 Gig RAM. My package GDD renderings of dashed lines aren't dashed. abline() will produce a dashed line, but lines() won't. Here is some illustrative code: library(GDD) GDD(dashed line, type=gif, width=480,

Re: [R] plotting zoo object

2008-03-14 Thread Gabor Grothendieck
Please use dput(x) to display data in your posts in easily copied form. Try this: library(zoo) z - zoo(matrix(1:48, 4, dimnames = list(NULL, month.abb)), 1968:1971) zz - zooreg(c(coredata(z)), start = as.yearmon(1968), freq = 12) You could also consider using a ts series: tt - as.ts(zz) On

Re: [R] smoothScatter

2008-03-14 Thread Liaw, Andy
I just tried it and had no problem with that code. Are you sure the packages are installed correctly? What does sessionInfo() say after you got the error? smoothScatter() _is_ in geneplotter, as is densCols(). Andy From: Tom Hart Hi, I have been trying to plot density plots using the

Re: [R] Distances between two datasets of x and y co-ordinates

2008-03-14 Thread Liaw, Andy
From: [EMAIL PROTECTED] Andrew McFadden [EMAIL PROTECTED] writes: I am trying to determine the distances between two datasets of x and y points. This can be done efficiently in the package 'spatstat'. library(spatstat) crossdist(x1, y1, x2, y2) where x1, y1 are

[R] maximum allowed matrix size of R

2008-03-14 Thread LIU, YUEFU [AG/1000]
Hi! All, I was thinking to use R to handle my large scale data of 3 Mi records On Unix. Could you let me know if there is limits of R for its matrices and vectors and what is the maximum allowed size if there is ? Thank you advance Yuefu St Louis

Re: [R] maximum allowed matrix size of R

2008-03-14 Thread Prof Brian Ripley
See ?Memory-limits And BTW 'on Unix' is far from sufficient, as the help page will explain to you. On Fri, 14 Mar 2008, LIU, YUEFU [AG/1000] wrote: Hi! All, I was thinking to use R to handle my large scale data of 3 Mi records On Unix. Could you let me know if there is limits of R for its

Re: [R] Comparing switchpoints from segmented

2008-03-14 Thread vito muggeo
Dear Rob, Rob Knell ha scritto: Hello everyone Not strictly an R question but close... hopefully someone will be able to help. I wish to compare the switchpoints in two switchpoint regressions. The switchpoints were estimated using the segmented library It's a package. running in R,

[R] SAS data

2008-03-14 Thread Samuel Okoye
Hello, I am trying to read the SAS file MyData.sa7bdat in R! This file is saved under D:\data! I therefore wrote path -D:/SasData sashome - C/Progra, Files/SAS Institute/9_1/SAS sascmd - file.path(sashome, sas.exe) MyData - read.ssd(path, MyData, sascmd=sascmd) The

[R] Forward Selection with regsubsets

2008-03-14 Thread wkoh
Hi, I would like to perform a forward selection procedure on a data set with 6 observations and 10 predictors. I tried to run it with regsubsets (I set nvmax=number of observations) but I keep getting these warning messages: Warning messages: 1: 5 linear dependencies found in:

[R] multiple comparisons

2008-03-14 Thread Stephen Cole
Hello again R help. This is a simple question perhaps(laughing as I type) with a simple answer. Is the multcomp package appropriate for using with a lme built under the nlme package. I know i can get it to work (i.e report p-values for a tukey test) but i am not unsure if this is appropriate

Re: [R] Splitting a set of vectors in a list (Solved )

2008-03-14 Thread Bert Gunter
?[ ?InternalMethods x[i,j] is just shorthand for [(x,i,j) . (AFAIK)**All** operators (+,-,...,subscripting,...) in R are functions, stemming from its LISP-like heritage, and can actually called by the usual functional syntax, f(...), instead of the operator syntax. Not sure where this is

Re: [R] Splitting a set of vectors in a list (Solved )

2008-03-14 Thread Liaw, Andy
From: Bert Gunter ?[ ?InternalMethods x[i,j] is just shorthand for [(x,i,j) . (AFAIK)**All** operators (+,-,...,subscripting,...) in R are functions, stemming from its LISP-like heritage, and can actually called by the usual functional syntax, f(...), instead of the operator syntax.

[R] multiple testing in survival

2008-03-14 Thread darteta001
Dear list, I am willing to perform a cox PH regression analysis on my time to reach a severity score of 5. I have 600 observations and 50 predictor variables. So I first want to perform a log-rank test (using the survdiff() function) on each individual variable in order to select a subset of

Re: [R] Elbow criterion plots for determining k in hierarchical clustering

2008-03-14 Thread Guera
re: ... (I) would like to create a plot to examine for the classic elbow criterion to use in determining the best number of clusters. Ideally I'd like to plot percent variance explained (y axis) against number of clusters (x axis) Is there a way to do this in R...? I found a way to

Re: [R] Splitting a set of vectors in a list (Solved )

2008-03-14 Thread John Kane
--- Liaw, Andy [EMAIL PROTECTED] wrote: From: Bert Gunter ?[ ?InternalMethods x[i,j] is just shorthand for [(x,i,j) . (AFAIK)**All** operators (+,-,...,subscripting,...) in R are functions, stemming from its LISP-like heritage, and can actually called by the usual

Re: [R] SAS data

2008-03-14 Thread Lawrence Hanser
Looks to me like you are trying to read sas.exe as your data rather than MyData.sa7bdat Larry On Fri, Mar 14, 2008 at 8:21 AM, Samuel Okoye [EMAIL PROTECTED] wrote: Hello, I am trying to read the SAS file MyData.sa7bdat in R! This file is saved under D:\data! I therefore wrote

[R] dput Was Re: plotting zoo object

2008-03-14 Thread John Kane
This is only the second time that I remember haveing even seen a reference to dput(). The first time was about 3-4 days ago in something of a throw-away comment. Should it be in the posting guide and FAQ etc as a guide to new users? --- Gabor Grothendieck [EMAIL PROTECTED] wrote: Please use

Re: [R] dput Was Re: plotting zoo object

2008-03-14 Thread Achim Zeileis
On Fri, 14 Mar 2008, John Kane wrote: This is only the second time that I remember haveing even seen a reference to dput(). The first time was about 3-4 days ago in something of a throw-away comment. Should it be in the posting guide and FAQ etc as a guide to new users? The posting guide

Re: [R] dput Was Re: plotting zoo object

2008-03-14 Thread John Kane
Ah so it does. I must have missed it entirely. Thanks --- Achim Zeileis [EMAIL PROTECTED] wrote: On Fri, 14 Mar 2008, John Kane wrote: This is only the second time that I remember haveing even seen a reference to dput(). The first time was about 3-4 days ago in something of a

Re: [R] cumsum list..

2008-03-14 Thread yoooooo
Yes! mapply is awesome! Thanks. Gabor Csardi wrote: cumsum( mapply(function(i,j) sum(a$data[i:j]), x, y) ) Is this what you want? Gabor On Thu, Mar 13, 2008 at 06:02:13AM -0700, yoo wrote: Hi all, i have the following.. a - data.frame(data = seq(1,10)) i have indices:

Re: [R] Optimization with constraint.

2008-03-14 Thread Hans W Borchers
Andreas Klein klein82517 at yahoo.de writes: Hello. I have some problems, when I try to model an optimization problem with some constraints. The original problem cannot be solved analytically, so I have to use routines like Simulated Annealing or Sequential Quadric Programming. But

[R] Lme does not work without a random effect (UNCLASSIFIED)

2008-03-14 Thread Park, Kyong H Mr ECBC
Classification: UNCLASSIFIED Caveats: NONE Dear R users, I'm interested in finding a random effect of the Block in the data shown below, but 'lme' does not work without the random effect. I'm not sure how to group the data without continuous value which is shown in the error message at the

Re: [R] Lme does not work without a random effect (UNCLASSIFIED)

2008-03-14 Thread Sundar Dorai-Raj
Park, Kyong H Mr ECBC said the following on 3/14/2008 12:25 PM: Classification: UNCLASSIFIED Caveats: NONE Dear R users, I'm interested in finding a random effect of the Block in the data shown below, but 'lme' does not work without the random effect. I'm not sure how to group the

[R] combine two data-frames into one

2008-03-14 Thread Suyan Tian
Hi Everyone: I need some help on combining two datasets into one. Since for those two datasets, there are different variables. Like In dataset 1, I have pt x1 x2 1 12 24 2 20 17 In dataset 2, I have pt x2 x3 3 19 33 4 20 16 The final dataset I want should look as pt x1 x2 x3

Re: [R] combine two data-frames into one

2008-03-14 Thread Henrique Dallazuanna
Try: merge(x, y, all=T) On 14/03/2008, Suyan Tian [EMAIL PROTECTED] wrote: Hi Everyone: I need some help on combining two datasets into one. Since for those two datasets, there are different variables. Like In dataset 1, I have pt x1 x2 1 12 24 2 20 17 In dataset 2, I

Re: [R] combine two data-frames into one

2008-03-14 Thread John Kane
library(reshape) ?rbind.fill --- Suyan Tian [EMAIL PROTECTED] wrote: Hi Everyone: I need some help on combining two datasets into one. Since for those two datasets, there are different variables. Like In dataset 1, I have pt x1 x2 1 12 24 2 20 17 In dataset 2, I have

Re: [R] Addition of numeric data to dates

2008-03-14 Thread Henrique Dallazuanna
If I understand: as.Date(2008-03-14) + 5*365 On 14/03/2008, Jillywadd [EMAIL PROTECTED] wrote: Hello! I currently have a table of data with a column of start dates and a column with some numbers representing years. I need to add these numbers to the dates to get an end date. The two

[R] using nrow to identify one row

2008-03-14 Thread Gregory Gentlemen
Hi fellow R-users, I have run into a problem when trying to identify the number of rows in a matrix. Say we have an arbitrary 5 by 5 matrix called temp: temp - matrix(norm(25), nrow=5) The problem is that nrow(temp[1,]) returns NULL. I would like it to return 1 because in my larger program I

Re: [R] using nrow to identify one row

2008-03-14 Thread Henrique Dallazuanna
nrow is for number of rows in matrix/data.frame, here you can use: NROW(temp[1,]) length(temp[1,]) But if you want the index of row try this: unique(row(temp)[1,]) On 14/03/2008, Gregory Gentlemen [EMAIL PROTECTED] wrote: Hi fellow R-users, I have run into a problem when trying to identify

Re: [R] using nrow to identify one row

2008-03-14 Thread Gabor Csardi
Try temp[1,,drop=FALSE] See ?[ for the explanation. Gabor On Fri, Mar 14, 2008 at 04:46:10PM -0400, Gregory Gentlemen wrote: Hi fellow R-users, I have run into a problem when trying to identify the number of rows in a matrix. Say we have an arbitrary 5 by 5 matrix called temp: temp -

[R] problems creating data frames

2008-03-14 Thread Will Holcomb
I am having two problems creating data frames that I have solutions, but they really seem like kludges and I assume I just don't understand the proper R way of doing things. The first situation is I have an set of uneven data vectors. When I try to use them to create a data frame I would like the

Re: [R] Addition of numeric data to dates

2008-03-14 Thread Prof Brian Ripley
On Fri, 14 Mar 2008, Henrique Dallazuanna wrote: If I understand: as.Date(2008-03-14) + 5*365 What about leap years? That is 2013-03-13. x - as.Date(2008-03-14) xx - as.POSIXlt(x) xx$year - xx$year+5 as.Date(xx) [1] 2013-03-14 is I think what is being asked for. On 14/03/2008,

Re: [R] problems creating data frames

2008-03-14 Thread jim holtman
This should do what you want for the data.frame: x - list(Behavior_Therapy = c(6, 7, 6, 5, 5, 5, 7, 8, 9, 6, 6, 7), + Atenolol = c(4, 8, 10, 3, 6, 5, 6, 3, 7, 5, 4, 6), + Placebo = c(0, 7, 0, 7, 0, 7)) # find the longest vector and make all the

[R] Rejection sampling to draw from distributions

2008-03-14 Thread Anup Nandialath
Dear friends, Please find below the code that I have employed for a rejection sampler to draw from asymmetric laplace distributions. I was wondering if this code can be written more efficiently? Are there more efficient ways of drawing random numbers from asymmetric laplace distributions??

[R] How to let R repeat computations over a number of variables

2008-03-14 Thread Uli Kleinwechter
Hello, I have written a small script to read a dataset, compute some basic descriptives and write them to a file (see below). The variable maizeseedcash of which the statistics are calculated is contained in the data frame agr_inputs. My question is whether there is a way to make R compute

[R] fBrowser in Rmetrics - does it exist?

2008-03-14 Thread Liviu Andronic
Dear useRs, I have read in several sources [1] [2] [3] that Rmetrics includes an Rcmdr-based graphical user interface named fBrowser GUI. However, I have a hard time finding it anywhere (on the net, etc.), nor do I manage to load it (having had Rmetrics installed). Could anyone shed some light

[R] legend: bold and color of border

2008-03-14 Thread Thomas Steiner
How do I write bold face in the legend - the function does not accept font=2 as argument? How do I plot a legend box with a background color, but not a border? Or, better: How do I specify the color of the legend-box-borderline? Okay, I abuse the legend, but have a look at

[R] ayuda

2008-03-14 Thread Rosaura Cordero
hola, si me pudieran decir como hago para colocar dentro de un ciclo una pausa - ¿Con Mascota por primera vez? - Sé un mejor Amigo [[alternative HTML version deleted]] __ R-help@r-project.org mailing

Re: [R] ayuda

2008-03-14 Thread Mose Andre
Try Sys.sleep() On Fri, Mar 14, 2008 at 4:33 PM, Rosaura Cordero [EMAIL PROTECTED] wrote: hola, si me pudieran decir como hago para colocar dentro de un ciclo una pausa - ¿Con Mascota por primera vez? - Sé un mejor Amigo [[alternative HTML version

Re: [R] How to let R repeat computations over a number of variables

2008-03-14 Thread David Winsemius
Uli Kleinwechter [EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: Hello, I have written a small script to read a dataset, compute some basic descriptives and write them to a file (see below). The variable maizeseedcash of which the statistics are calculated is contained in the data

Re: [R] Rejection sampling to draw from distributions

2008-03-14 Thread Charles C. Berry
On Fri, 14 Mar 2008, Anup Nandialath wrote: Dear friends, Please find below the code that I have employed for a rejection sampler to draw from asymmetric laplace distributions. I was wondering if this code can be written more efficiently? Are there more efficient ways of drawing random

[R] filehash

2008-03-14 Thread Davood Tofighi
Hello, I'm using filehash on the windows XP and it has been working fine with the newest R version 2.6.2. However, on the windows vista, when I ran the same code, I got the following error: dbCreate(simdb)#create simdb database [1] TRUE db-dbInit(simdb) #initiate an object of database

Re: [R] problems creating data frames

2008-03-14 Thread Gabor Grothendieck
This was just discussed this week: https://stat.ethz.ch/pipermail/r-help/2008-March/157082.html On Fri, Mar 14, 2008 at 5:01 PM, Will Holcomb [EMAIL PROTECTED] wrote: I am having two problems creating data frames that I have solutions, but they really seem like kludges and I assume I just

[R] Where are the latest html help for R, base packages and Bioc packages ?

2008-03-14 Thread Ng Stanley
Hi, Can anyone direct me ? Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide

[R] How to get the value of last element in a vector/array ?

2008-03-14 Thread Ng Stanley
Hi, a[length(a)] gives the value of last element. Is there an alternative without using functions ? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the