search for: maxa

Displaying 7 results from an estimated 7 matches for "maxa".

Did you mean: max
2016 Apr 20
0
Data reshaping with conditions
...08 351 lee B",header=TRUE) # you can also do this with other reshape functions library(prettyR) svdatstr<-stretch_df(svdat,"id",c("Count","type")) count_ind<-grep("Count",names(svdatstr)) type_ind<-grep("type",names(svdatstr)) svdatstr$maxA<-NA svdatstr$maxB<-NA svdatstr$x<-NA svdatstr$y<-NA for(row in 1:nrow(svdatstr)) { svdatstr[row,"maxA"]<- max(svdatstr[row,count_ind[as.logical(match(svdatstr[1,type_ind],"A",0))]]) svdatstr[row,"maxB"]<- max(svdatstr[row,count_ind[as.logical(ma...
2016 Apr 21
2
Data reshaping with conditions
...) > # you can also do this with other reshape functions > library(prettyR) > svdatstr<-stretch_df(svdat,"id",c("Count","type")) > count_ind<-grep("Count",names(svdatstr)) > type_ind<-grep("type",names(svdatstr)) > svdatstr$maxA<-NA > svdatstr$maxB<-NA > svdatstr$x<-NA > svdatstr$y<-NA > for(row in 1:nrow(svdatstr)) { > svdatstr[row,"maxA"]<- > > max(svdatstr[row,count_ind[as.logical(match(svdatstr[1,type_ind],"A",0))]]) > svdatstr[row,"maxB"]<- >...
2012 Jan 23
1
sqldf + Date class. Ordering and summary statistics appear to be incorrect.
...xample, if I run the following code: =============== begin code ================= library(sqldf) A<-data.frame(Dates=as.Date(c("1994-02-14","1977-02-23","2001-09-18","2009-08-01")),Ret=rnorm(4)) OrderedA<-sqldf('select * from A order by Dates') MaxA<-sqldf('select max(Dates) as Dates from A')[1,1] MinA<-sqldf('select min(Dates) as Dates from A')[1,1] =============== end code ================= Then the result is this: > A Dates Ret 1 1994-02-14 1.2414706 2 1977-02-23 -0.7728146 3 2001-09-18 1.2551331 4...
2016 Apr 21
0
Data reshaping with conditions
...08 351 lee B",header=TRUE) # you can also do this with other reshape functions library(prettyR) svdatstr<-stretch_df(svdat,"id",c("Count","type")) count_ind<-grep("Count",names(svdatstr)) type_ind<-grep("type",names(svdatstr)) svdatstr$maxA<-NA svdatstr$maxB<-NA svdatstr$x<-NA svdatstr$y<-NA for(row in 1:nrow(svdatstr)) { indicesA<-count_ind[as.logical(match(svdatstr[row,type_ind],"A",0))] svdatstr[row,"maxA"]<-max(svdatstr[row,indicesA]) indicesB<-count_ind[as.logical(match(svdatstr[row,typ...
2008 May 02
0
Adaptive design code
...(and only) interim look (must be < t.A) # t.A = length of planned accrual period # t.end = planned end of trial # alpha = overall type I error for the trial # cond.pow = desired conditional power for the trial (power given the observed # information at the the first interim look) # t.maxA = maximum allowable accrual time # t.maxEnd = desired maximum allowable total trial time # num.sim = number of simulations # ############################################################################################# #set parameters for simulation p.0 <- .4 p.a <- .6 n.0 <- 225 n.a...
2016 Apr 20
2
Data reshaping with conditions
Dear All, I am trying to reshape the data with some conditions. A small part of the data looks like below. Like this there will be more data with repeating ID. Count id name type 117 335 sally A 19 335 sally A 167 335 sally B 18 340 susan A 56 340 susan A 22 340 susan B 53 340 susan B 135 351 lee A 114 351 lee A 84 351 lee A 80 351 lee A 19 351 lee A 8 351 lee A 21 351 lee A 88 351 lee B 111 351
2012 Nov 17
3
manipulating longitudinal data in r
Dear list member, I have the following data example ke <- data.frame(patid=c(1,1,1,2,3,3),a=c(1,2,2,1,1,2)) I want to add another variable b, such that the max of 'a' by id is returned i.e data ke becomes ke <- data.frame(patid=c(1,1,1,2,3,3),a=c(1,2,2,1,1,2),b=c(2,2,2,1,2,2)) Any help will be appreciated. Oluwakemi [[alternative HTML version deleted]]