[R] Error message after R-3.0.0 upgrade installation

2013-04-29 Thread Anupam Tyagi
R-3.0.0 prints an error message at startup. I uninstalled a previous version and installed this on Windows 8. Uninstall of previous version deleted all previously installed packages and I forgot to keep a list of them. How do I correct this error? " Error: requested primitive type is not consisten

[R] Ridge regression

2013-04-29 Thread Preetam Pal
Hi all, I have run a ridge regression on a data set 'final' as follows: reg=lm.ridge(final$l~final$lag1+final$lag2+final$g+final$u, lambda=seq(0,10,0.01)) Then I enter : select(reg) and it returns: modified HKB estimator is 19.3409 modified L-W estimator

Re: [R] bigmemory and R 3.0

2013-04-29 Thread Prof Brian Ripley
On 29/04/2013 23:46, Benjamin Caldwell wrote: Dear helpers, Does anyone have information on the status of bigmemory and R3.0? Will it just take time for the devs to re-code for the new environment? Or is there an alternative for this new version? What are you asking about? 'bigmemory' has bee

Re: [R] Question regarding error "x and y lengths differ"

2013-04-29 Thread Jim Lemon
On 04/30/2013 11:38 AM, Sean Doyle wrote: Hello, I'm a first semester statistics studentand I am using R for roughly the third time ever. I am following a tutorial and yet I still get the erro

[R] R/3.0.0 serialize limits

2013-04-29 Thread Sam.Moskwa
Hello, I am wondering if I am misinterpreting something from R/3.0.0 NEWS LONG VECTORS: This section applies only to 64-bit platforms. ... o serialize() to a raw vector is unlimited in size (except by resources). However when I try the following it fails: > foo <- raw(25)

Re: [R] Is there a function that print a string vertically (by adding "\n")?

2013-04-29 Thread David Winsemius
On Apr 29, 2013, at 6:50 PM, David Winsemius wrote: > > On Apr 29, 2013, at 6:41 PM, jpm miao wrote: > >> Hi, >> >> I'd like to print a string vertically. For example, I would like to print >> "abcd" as "a\nb\nc\nd" >> >> Is there a function in R such that >> >> Input: "abcd" >> Output: "a\

Re: [R] Is there a function that print a string vertically (by adding "\n")?

2013-04-29 Thread David Winsemius
On Apr 29, 2013, at 6:41 PM, jpm miao wrote: > Hi, > > I'd like to print a string vertically. For example, I would like to print > "abcd" as "a\nb\nc\nd" > > Is there a function in R such that > > Input: "abcd" > Output: "a\nb\nc\nd"? > do.call( paste, list( strsplit("abcd", "")[[1]] , col

[R] Question regarding error "x and y lengths differ"

2013-04-29 Thread Sean Doyle
Hello, I'm a first semester statistics studentand I am using R for roughly the third time ever. I am following a tutorial and yet I still get the error "x and y lengths differ." I am very new to

Re: [R] Looping Over Data Frames

2013-04-29 Thread David Winsemius
On Apr 29, 2013, at 6:03 PM, Sparks, John James wrote: > Dear R Helpers, > > I am re-phrasing a question that I put forth earlier today due to some > particulars in the solution that I am searching for. Many thanks to those > who answered the previous post and to any who would be willing to ans

Re: [R] Is there a function that print a string vertically (by adding "\n")?

2013-04-29 Thread arun
Hi, May be this helps:  cat(paste(strsplit("abcd","")[[1]],collapse="\n")) #a #b #c #d A.K. - Original Message - From: jpm miao To: r-help Cc: Sent: Monday, April 29, 2013 9:41 PM Subject: [R] Is there a function that print a string vertically (by adding "\n")? Hi,   I'd li

[R] Is there a function that print a string vertically (by adding "\n")?

2013-04-29 Thread jpm miao
Hi, I'd like to print a string vertically. For example, I would like to print "abcd" as "a\nb\nc\nd" Is there a function in R such that Input: "abcd" Output: "a\nb\nc\nd"? Thanks, Miao [[alternative HTML version deleted]] __ R-help@

[R] Looping Over Data Frames

2013-04-29 Thread Sparks, John James
Dear R Helpers, I am re-phrasing a question that I put forth earlier today due to some particulars in the solution that I am searching for. Many thanks to those who answered the previous post and to any who would be willing to answer this one. I have a set of data frames. I need to perform some

Re: [R] Function for Data Frame

2013-04-29 Thread Rolf Turner
On 30/04/13 08:34, MacQueen, Don wrote: Just to add a little, don't get distracted by the return() function. Functions return the value of their final expression, provided it isn't an assignment. Note that functions still return the value of their final expression even if it is an assignment.

Re: [R] biplot for principal componens analysis

2013-04-29 Thread Jim Lemon
On 04/30/2013 08:24 AM, capricy gao wrote: I did a PCA for my data which has a dimension of 19000X4 using princomp pca2=princomp((data), cor=F) and obtained a biplot with 19000 labels which were very busy. How can I just show 19000 spot w/o labels? biplot(pca2) Hi capricy, I suppose

Re: [R] bigmemory and R 3.0

2013-04-29 Thread Dirk Eddelbuettel
On 29 April 2013 at 15:46, Benjamin Caldwell wrote: | Dear helpers, | | Does anyone have information on the status of bigmemory and R3.0? Will it | just take time for the devs to re-code for the new environment? Or is there | an alternative for this new version? It just works, with R 3.0.0 and o

[R] R help - bootstrap with survival analysis

2013-04-29 Thread Fayaaz Khatri
Hi, I'm not sure if this is the proper way to ask questions, sorry if not. But here's my problem: I'm trying to do a bootstrap estimate of the mean for some survival data. Is there a way to specifically call upon the rmean value, in order to store it in an object? I've used print(...,print.rmean

[R] bigmemory and R 3.0

2013-04-29 Thread Benjamin Caldwell
Dear helpers, Does anyone have information on the status of bigmemory and R3.0? Will it just take time for the devs to re-code for the new environment? Or is there an alternative for this new version? Thanks Ben Caldwell [[alternative HTML version deleted]]

[R] interesting behavior from aaply

2013-04-29 Thread Benjamin Caldwell
Dear helpers, I'm using plyr to process a large matrix for the first time. My code is set up to work with matrixes, since I learned the hard way that dataframes are considerably slower to process. I started using aaply(), but the data was rearranged from a flat matrix to a [, , 4] array for large

Re: [R] getting started in parallel computing on a windows OS

2013-04-29 Thread Benjamin Caldwell
Martin, This worked, thanks again! *Ben Caldwell* Graduate Fellow University of California, Berkeley 130 Mulford Hall #3114 Berkeley, CA 94720 Office 223 Mulford Hall (510)859-3358 On Thu, Apr 25, 2013 at 10:04 PM, Benjamin Caldwell wrote: > Thanks for this martin. I'll start retooling and l

[R] biplot for principal componens analysis

2013-04-29 Thread capricy gao
I did a PCA for my data which has a dimension of 19000X4 using princomp >pca2=princomp((data), cor=F) and obtained a biplot with 19000 labels which were very busy. How can I just show 19000 spot w/o labels? >biplot(pca2) Thanks a lot:)) -data

Re: [R] Arma - estimate of variance of white noise variables

2013-04-29 Thread Rui Barradas
Hello, Em 29-04-2013 13:49, Preetam Pal escreveu: Hi all, Suppose I am fitting an arma(p,q) model to a time series y_t. So, my model should contain (q+1) white noise variables. Why? How on hearth can you say this? As far as I know, each of them should have the same variance. How do I get th

Re: [R] expanding a presence only dataset into presence/absence

2013-04-29 Thread arun
HI, Check if this is what you wanted.  I am not sure the Hopeful outcome includes all the possible combinations. dat1<- read.csv("Matthewdat.csv",sep=",",header=TRUE,stringsAsFactors=FALSE) dat1  #    Species CallingIndex Site  Date #1 Pseudacris crucifer    2 3608 3

Re: [R] rbinding some elements from a list and obtain another list

2013-04-29 Thread MacQueen, Don
In addition to the other responses, consider this: > i <- 3 > i:i+1 [1] 4 > i:(i+1) [1] 3 4 -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 4/29/13 6:54 AM, "De Castro Pascual, Montserrat" wrote: >Hi everybody, > > >

Re: [R] Function for Data Frame

2013-04-29 Thread MacQueen, Don
Just to add a little, don't get distracted by the return() function. Functions return the value of their final expression, provided it isn't an assignment. For your example, this will do the job: myfunc <- function(DF) subset(DF, select=-V1) If you want to modify the data frames in place, one wa

Re: [R] speed of a vector operation question

2013-04-29 Thread Mikhail Umorin
Thank you all very much for your time and suggestions. The link to stackoverflow was very helpful. Here are some timings in case someone wants to know. (I noticed that microbenchmark results vary, depending on how many functions one tries to benchmark at a time. However, the "min" stays about t

Re: [R] parSapply can't find function

2013-04-29 Thread Kaiyin Zhong (Victor Chung)
Sorry, I got some new error: Error in cut.default(i, breaks) : 'breaks' are not unique >>>traceback() 20: stop("'breaks' are not unique") 19: cut.default(i, breaks) 18: cut(i, breaks) 17: split.default(i, cut(i, breaks)) 16: split(i, cut(i, breaks)) 15: structure(split(i, cut(i, breaks)), names =

Re: [R] parSapply can't find function

2013-04-29 Thread Duncan Murdoch
On 29/04/2013 2:16 PM, Kaiyin Zhong (Victor Chung) wrote: Hi, Uwe. I still don't get how this can be done correctly. Here is what I tried. In the file funcs.R, define these functions: library('modeest') x = vector(length=500) x = sapply(x, function(i) i=sample(c(1,0), 1)) pastK = function(n, x

Re: [R] parSapply can't find function

2013-04-29 Thread Kaiyin Zhong (Victor Chung)
Oh, indeed, that IS the problem. Thank you!!! Best regards, Kaiyin ZHONG -- FMB, Erasmus MC k.zh...@erasmusmc.nl kindlych...@gmail.com On Mon, Apr 29, 2013 at 8:22 PM, David Winsemius wrote: > > On Apr 29, 2013, at 11:16 AM, Kaiyin Zhong (Victor Chung) wrote: > > >

Re: [R] parSapply can't find function

2013-04-29 Thread David Winsemius
On Apr 29, 2013, at 11:16 AM, Kaiyin Zhong (Victor Chung) wrote: > Hi, Uwe. > > I still don't get how this can be done correctly. Here is what I tried. > > In the file funcs.R, define these functions: > > library('modeest') > x = vector(length=500) > x = sapply(x, function(i) i=sample(c(1,0),

Re: [R] parSapply can't find function

2013-04-29 Thread Kaiyin Zhong (Victor Chung)
Hi, Uwe. I still don't get how this can be done correctly. Here is what I tried. In the file funcs.R, define these functions: library('modeest') x = vector(length=500) x = sapply(x, function(i) i=sample(c(1,0), 1)) pastK = function(n, x, k) { if (n>k) { return(x[(n-k):(n-1)]) } else {ret

Re: [R] expanding a presence only dataset into presence/absence

2013-04-29 Thread arun
I am sorry.  I forgot to update the code:dat1<- read.table(text=" Species Site Date a 1 1 b 1 1 b 1 2 c 1 3 ",sep="",header=TRUE,stringsAsFactors=FALSE) dat1$Present<- 1 dat2<-expand.grid(unique(dat1$Species),unique(dat1$Site),unique(dat1$Date))  colnames(dat2)<- colnames(dat1)[-4] #changed here

Re: [R] cannot compile R on Cray XE6 HLRS HERMIT

2013-04-29 Thread Ben Bolker
Martin Ivanov abv.bg> writes: > Dear All, I am trying to compile R-3.0 on Cray xe6 (HLRS) HERMIT, > no success so far. Here is my experience: You might be better off posting this to the r-de...@r-project.org mailing list (the list is for developer queries: technically this isn't "developmen

Re: [R] Stratified Random Sampling Proportional to Size

2013-04-29 Thread Lopez, Dan
Hi Jeff, a & b) points taken. Thanks for the reference too. c) taking the zero's out did the trick. Dan -Original Message- From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us] Sent: Sunday, April 28, 2013 12:15 AM To: Lopez, Dan Cc: R help (r-help@r-project.org) Subject: Re: [R] Strati

[R] lavaan and semTools warning message

2013-04-29 Thread Duarte Viana
Hello all, I am running a simple path analysis with the function sem.mi (of semTools) after doing multiple imputation in my (missing) data. However, depending on the option to combine the chi-square, I get the following warning messages: Warning messages: 1: In estimateVCOV(lavaanModel, samplesta

Re: [R] expanding a presence only dataset into presence/absence

2013-04-29 Thread arun
Hi, Your output dataset is bit confusing as it contains Sites that were not in the input. Using your input dataset, I am getting this: dat1<- read.table(text=" Species Site Date a 1 1 b 1 1 b 1 2 c 1 3 ",sep="",header=TRUE,stringsAsFactors=FALSE) dat1$Present<- 1 dat2<-expand.grid(unique(dat1$S

Re: [R] rbinding some elements from a list and obtain another list

2013-04-29 Thread arun
Hi, Try this: set.seed(24)  lst1<-lapply(1:4,function(x) as.data.frame(matrix(sample(1:20,20,replace=TRUE),ncol=5)))  names(lst1)<- LETTERS[1:4] res<-lapply(list(c("A","B"),c("C","D")), function(x) do.call(rbind,lst1[x]))  res #[[1]]  #   V1 V2 V3 V4 V5 #A.1  6 14 17 14  4 #A.2  5 19  6 14  1 #A.

Re: [R] Function for Data Frame

2013-04-29 Thread Ben Tupper
Hi, On Apr 29, 2013, at 10:23 AM, Sparks, John James wrote: > Dear R Helpers, > > I have about 20 data frames that I need to do a series of data scrubbing > steps to. I have the list of data frames in a list so that I can use > lapply. I am trying to build a function that will do the data scru

Re: [R] expanding a presence only dataset into presence/absence

2013-04-29 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Matthew Venesky > Sent: Monday, April 29, 2013 8:13 AM > To: r-help@r-project.org > Subject: [R] expanding a presence only dataset into presence/absence > > Hello, > > I'm workin

Re: [R] Function for Data Frame

2013-04-29 Thread arun
Hi, If I understand it correctly, x<-myfunc(x) x #  V2 V3 #1  2  3 #2  2  3 #3  2  2 #4  2  2 #5  1  1 A.K. - Original Message - From: "Sparks, John James" To: r-help@r-project.org Cc: Sent: Monday, April 29, 2013 10:23 AM Subject: [R] Function for Data Frame Dear R Helpers, I have

[R] plspm error: singular matrix 'a' in 'solve'

2013-04-29 Thread Mitch Hunter
Hello, I am running a simple plspm for a class project due later today and I am receiving the following error despite following along exactly with Gaston Sanchez's directions in PLS Path Modeling with R: Error in solve.qr(qr(X.blok), Z[, j]) : singular matrix 'a' in 'solve' I would greatly appre

Re: [R] Stratified Random Sampling Proportional to Size

2013-04-29 Thread William Dunlap
This problem in sampling::strata() comes from calling cbind on a zero-row data.frame with a scalar number. > library(sampling) > strata(mtcars[,c("mpg","hp","gear")], strat="gear", size=c(5,5,0)) Error in data.frame(..., check.names = FALSE) : arguments imply differing number of rows: 0

Re: [R] rbinding some elements from a list and obtain another list

2013-04-29 Thread David Winsemius
On Apr 29, 2013, at 6:54 AM, De Castro Pascual, Montserrat wrote: > Hi everybody, > > > > I have a list, where every element of this list is a data frame. > > > > An example: > > > > Mylist<-list(A=data.frame, B=data.frame, C=data.frame, D=data.frame) I'm looking at this apparently malf

Re: [R] how to add new rows in a dataframe?

2013-04-29 Thread arun
Hi, dat1<- read.table(text=" id    t scores 2 0    1.2 2 2 2.3 2 3    3.6 2 4    5.6 2 6   

Re: [R] Function for Data Frame

2013-04-29 Thread arun
Hi, If it is for the list: lst1<- list(x,x,x)  lst1<-lapply(lst1,myfunc) - Original Message - From: arun To: "Sparks, John James" Cc: R help Sent: Monday, April 29, 2013 12:13 PM Subject: Re: [R] Function for Data Frame Hi, If I understand it correctly, x<-myfunc(x) x #  V2 V3 #1 

[R] expanding a presence only dataset into presence/absence

2013-04-29 Thread Matthew Venesky
Hello, I'm working with a very large dataset (250,000+ lines in its' current form) that includes presence only data on various species (which is nested within different sites and sampling dates). I need to convert this into a dataset with presence/absence for each species. For example, I would lik

Re: [R] all.vars for nested expressions

2013-04-29 Thread William Dunlap
Try poking around in the codetools package. E.g., you can do things like the following expr1 <- quote(a <- fn + tp) # put 'a' in the expression expr2 <- quote( tp / a + fn) expr12 <- call("{", expr1, expr2) expr12 # { #a <- fn + tp #tp/a + fn # } library(codeto

Re: [R] Need help on matrix calculation

2013-04-29 Thread Jorge I Velez
Sorry, the first line should have been Mat[match( Subscript_Vec, rownames(Mat)),] and the rest remains the same. Best, Jorge.- On Mon, Apr 29, 2013 at 11:45 PM, Jorge I Velez wrote: > Christofer, > > The following should get you started: > > r <- Mat[match(rownames(Mat), Subscript_Vec),] > ro

[R] Function for Data Frame

2013-04-29 Thread Sparks, John James
Dear R Helpers, I have about 20 data frames that I need to do a series of data scrubbing steps to. I have the list of data frames in a list so that I can use lapply. I am trying to build a function that will do the data scrubbing that I need. However, I am new to functions and there is somethin

Re: [R] prcomp( and cmdscale( not equivalent?

2013-04-29 Thread David Carlson
I may not understand completely, but it seems you have a 45x45 distance matrix of stimuli and you want to use to determine which stimuli are similar. Wouldn't hierarchical clustering be a more straightforward approach? ?hclust - David L Carlson Associate Profes

[R] rbinding some elements from a list and obtain another list

2013-04-29 Thread De Castro Pascual, Montserrat
Hi everybody, I have a list, where every element of this list is a data frame. An example: Mylist<-list(A=data.frame, B=data.frame, C=data.frame, D=data.frame) I want to rbind some elements of this list. As an example: Output<-list(AB=data.frame, CD=data.frame) Where AB=rbind(A,

Re: [R] all.vars for nested expressions

2013-04-29 Thread Eik Vettorazzi
Hi Felix, I thought, this could be an easy task for substitute, and the following works as expected: all.vars(substitute(expression(tp/a),list(a=expression(fn+tp # [1] "tp" "fn" But (of course) all.vars(substitute(sen,list(a=a))) does not yield the desired result, and I can't figure out, how

Re: [R] Need help on matrix calculation

2013-04-29 Thread arun
r #  [,1] [,2] [,3] #a    1    5    9 #e    3    7   11 #b    4    8   12 #c   NA   NA   NA I guess you meant:  r1<- Mat[match(Subscript_Vec,rownames(Mat)),] rownames(r1)<- Subscript_Vec  r1 #  [,1] [,2] [,3] #a    1    5    9 #e   NA   NA   NA #b    2    6   10 #c    3    7   11 A.K. - Or

Re: [R] Adding elements in data.frame subsets and also subtracting an element from the rest elements in data.frame

2013-04-29 Thread arun
You can also use: library(plyr)   res<-mutate(ddply(cashflow_df,.(instrument,id),numcolwise(sum)),cashflow_change=ave(cashflows_pv,instrument,FUN=function(x) x-head(x,1)))  names(res)[3:4]<- paste0("total_",names(res)[3:4])  res #   instrument id total_cashflow total_cashflows_pv cashflow_change #

Re: [R] Need help on matrix calculation

2013-04-29 Thread Jorge I Velez
Christofer, The following should get you started: r <- Mat[match(rownames(Mat), Subscript_Vec),] rownames(r) <- Subscript_Vec r HTH, Jorge.- On Mon, Apr 29, 2013 at 11:38 PM, Christofer Bogaso < bogaso.christo...@gmail.com> wrote: > Hello again, > > Let say I have 1 matrix: > > Mat <- matrix

Re: [R] Adding elements in data.frame subsets and also subtracting an element from the rest elements in data.frame

2013-04-29 Thread arun
Hi Katherine, res1<-aggregate(cbind(cashflow,cashflows_pv)~instrument+id,data=cashflow_df,sum) res2<-res1[order(res1$instrument),]  res2$cashflow_change<-with(res2,ave(cashflows_pv,instrument,FUN=function(x) x-head(x,1))) names(res2)[3:4]<- paste0("total_",names(res2)[3:4]) res2  #  instrument i

[R] Need help on matrix calculation

2013-04-29 Thread Christofer Bogaso
Hello again, Let say I have 1 matrix: Mat <- matrix(1:12, 4, 3) rownames(Mat) <- letters[1:4] Now I want to subscript of Mat in following way: Subscript_Vec <- c("a", "e", "b", "c") However when I want to use this vector, I am geting following error: Mat[Subscript_Vec, ] Error: subscript out

Re: [R] Adding elements in data.frame subsets and also subtracting an element from the rest elements in data.frame

2013-04-29 Thread Bert Gunter
If this is a homework problem, there is a no homework policy on this list. -- Bert On Mon, Apr 29, 2013 at 5:24 AM, Katherine Gobin wrote: > Dear R forum > > I have a data.frame as > > cashflow_df = data.frame(instrument = > c("ABC","ABC","ABC","ABC","ABC","ABC","ABC","ABC","ABC","ABC","ABC",

[R] cannot compile R on Cray XE6 HLRS HERMIT

2013-04-29 Thread Martin Ivanov
Dear All, I am trying to compile R-3.0 on Cray xe6 (HLRS) HERMIT, no success so far. Here is my experience: I use this to configure and make R: CC="cc" \ CXX="CC" \ F77="ftn" \ FC="ftn" \ CPPFLAGS="-I$PREFIX/include" \ LDFLAGS="-L$PREFIX/lib${LIBDIRSUFFIX}" \ ./configure --prefix=$PREFIX \ --ex

Re: [R] Hi

2013-04-29 Thread Ben Bolker
Fatos Baruti gmail.com> writes: > > What is the entry code formula autocovariance and autocorrelation in R > program for these data? > > a<-c(2,3.5,3.5,2.2,2.2,3.3,2.5,2.5,3.2,2.5,2.5,2.7,1.7,2.7,2.9,2. 3,2.7,3,1.8,2.5,3.1,2.5,2.5,3.2,2.7,1.9,2.6,2.3,2.7,3.2, 2.2,1.5,2.3,2.6,2.5,2.9,2,2.5,2.6

[R] Arma - estimate of variance of white noise variables

2013-04-29 Thread Preetam Pal
Hi all, Suppose I am fitting an arma(p,q) model to a time series y_t. So, my model should contain (q+1) white noise variables. As far as I know, each of them should have the same variance. How do I get the estimate of this variance by running the arma(y) function (or is there any other way)? Appr

Re: [R] Counting number of consecutive occurrences per rows

2013-04-29 Thread PIKAL Petr
Hi rrr<-rle(as.numeric(cut(test$act, c(0,1,199,200), include.lowest=T))) test$res <- rep(rrr$lengths, rrr$lengths) If you put it in function fff<- function(x, limits=c(0,1,199,200)) { rrr<-rle(as.numeric(cut(x, limits, include.lowest=T))) res <- rep(rrr$lengths, rrr$lengths) res } you can use s

[R] Adding elements in data.frame subsets and also subtracting an element from the rest elements in data.frame

2013-04-29 Thread Katherine Gobin
Dear R forum I have a data.frame as cashflow_df = data.frame(instrument = c("ABC","ABC","ABC","ABC","ABC","ABC","ABC","ABC","ABC","ABC","ABC","ABC","ABC","ABC", "ABC", "PQR", "PQR", "PQR","PQR","PQR","PQR","PQR","PQR","PQR","PQR", "PQR", "PQR", "PQR","PQR", "PQR","PQR","PQR","PQR", "PQR","PQR"

Re: [R] Counting number of consecutive occurrences per rows

2013-04-29 Thread jim holtman
try this: > test <- structure(list(jul = structure(c(14655, 14655, 14655, 14655, + 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, + 14655, 14655, 14655), origin = structure(0, class = "Date")), + time = structure(c(1266258354, 1266258954, 1266259554, 1266260154, + 126626075

[R] all.vars for nested expressions

2013-04-29 Thread flxms
Dear R fellows, Assume I define a <- expression(fn+tp) sen <- expression(tp/a) Now I'd like to know, which variables are necessary for calculating sen all.vars(sen) This results in a vector c(tp,a). But I'd like all.vars to evaluate the sen-object down to the ground level, which would result

Re: [R] How to "call" an object given a string?

2013-04-29 Thread arun
Hi, res<- unlist(mget(ls())) names(res)<-NULL  res #[1]  5  5 10 A.K. - Original Message - From: Rui Esteves To: r-help@r-project.org Cc: Sent: Monday, April 29, 2013 7:07 AM Subject: [R] How to "call" an object given a string? Hello, This is very basic and very frustrating. Suppose

[R] all.vars for nested expressions

2013-04-29 Thread flxms
Dear R fellows, Assume I define a <- expression(fn+tp) sen <- expression(tp/a) Now I'd like to know, which variables are necessary for calculating sen all.vars(sen) This results in a vector c(tp,a). But I'd like all.vars to evaluate the sen-object down to the ground level, which would result

Re: [R] quesion about model g1

2013-04-29 Thread meng
Thanks for your reply. As to g2 and g3: g2: a + d + c + a:d + a:c + d:c g3: a + d + c + a:d + a:c + d:c + a:d:c The only difference between g2 and g3 is "a:d:c",which refers to "case depends on drug but in the same way for different levels of age". And anova tests whether this "only difference"

[R] BCP utility

2013-04-29 Thread Stephane.COLAS
Hello, Currently we can load the data with the Bulkload facility with SAS using the BCP utility instead of the t-sql command BULK INSERT to copy data from a file to a SQL table. >From now I can see that RODBC package use only the t-sql command BULK INSERT. It could be interesting to see if the

[R] Hi

2013-04-29 Thread Fatos Baruti
What is the entry code formula autocovariance and autocorrelation in R program for these data? ahttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

Re: [R] Counting number of consecutive occurrences per rows

2013-04-29 Thread jim holtman
Forgot the last part of the question: > test <- structure(list(jul = structure(c(14655, 14655, 14655, 14655, + 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, + 14655, 14655, 14655), origin = structure(0, class = "Date")), + time = structure(c(1266258354, 1266258954, 1266259554,

Re: [R] Comparing two different 'survival' events for the same subject using survdiff?

2013-04-29 Thread Polwart Calum (COUNTY DURHAM AND DARLINGTON NHS FOUNDATION TRUST)
> It isn't that complex: > > myDataLong <- data.frame(Time=c(A, C), Censored=c(B, D), group=rep(0:1, > times=c(length(A), length(C > Fit = survfit(Surv(Time, Censored==0) ~ group, data=myDataLong) > plot(Fit, col=1:2) > survdiff(Surv(Time, Censored==0) ~ group, data=myDataLong) Yes - for the

Re: [R] Comparing two different 'survival' events for the same subject using survdiff?

2013-04-29 Thread Andrews, Chris
It isn't that complex: myDataLong <- data.frame(Time=c(A, C), Censored=c(B, D), group=rep(0:1, times=c(length(A), length(C Fit = survfit(Surv(Time, Censored==0) ~ group, data=myDataLong) plot(Fit, col=1:2) survdiff(Surv(Time, Censored==0) ~ group, data=myDataLong) However, your approach (a

Re: [R] How to "call" an object given a string?

2013-04-29 Thread Eik Vettorazzi
Hi Rui, how about this sapply(ls(),get) cheers Am 29.04.2013 13:07, schrieb Rui Esteves: > Hello, > > This is very basic and very frustrating. > > Suppose this: >> A=5 >> B=5 >> C=10 > >> ls() > "A" > "B" > "C" > > I would like this >> xpto() > 5 > 5 > 10 > > How can I do xpto()? > > Thank

Re: [R] Convert continuous variable into discrete variable

2013-04-29 Thread Frank Harrell
It is important to check for lack of fit of the categorized variable. One way to do this is to test for the additional predictive ability of the original continuous variable after adjusting for its categorized version. It is very uncommon for a categorized continuous variable to fit well, because

[R] How to "call" an object given a string?

2013-04-29 Thread Rui Esteves
Hello, This is very basic and very frustrating. Suppose this: >A=5 >B=5 >C=10 > ls() "A" "B" "C" I would like this >xpto() 5 5 10 How can I do xpto()? Thanks Rui [[alternative HTML version deleted]] __ R-help@r-project.org mailing list htt

[R] Counting number of consecutive occurrences per rows

2013-04-29 Thread zuzana zajkova
Hi, I would appreciate if somebody could help me with following calculation. I have a dataframe, by 10 minutes time, for mostly one year data. This is small example: > dput(test) structure(list(jul = structure(c(14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 1

[R] Comparing two different 'survival' events for the same subject using survdiff?

2013-04-29 Thread Polwart Calum (COUNTY DURHAM AND DARLINGTON NHS FOUNDATION TRUST)
I have a dataset which for the sake of simplicity has two endpoints. We would like to test if two different end-points have the same eventual meaning. To try and take an example that people might understand better: Lets assume we had a group of subjects who all received a treatment. The could