search for: dat2new

Displaying 9 results from an estimated 9 matches for "dat2new".

Did you mean: dat1new
2013 May 11
3
boxplot with grouped variables
my dataset looked like this in the beginning: >Daten V1 V2 V3 1 Dosis Gewicht Geschlecht 2 0 6.62 m 3 0 6.65 m 4 0 5.78 m 5 0 5.63 m I need box plots for V2 with all combination of V1 and V3, so I deleted the first row, and tried this: boxplot(Daten$V2[Daten$V3=="m"]) but it does not work and I
2013 Mar 27
9
conditional Dataframe filling
Hi everyone: This may be trivial but I just have not been able to figure it out. Imagine the following dataframe: a b c d TRUE TRUE TRUE TRUE FALSE FALSE FALSE TRUE FALSE TRUE FALSE FALSE I would like to create a new dataframe, in which TRUE gets 0 but if false then add 1 to the cell to the left. So the results for the example above should be something like: a b c
2013 Sep 27
0
Best and Worst values
...("arun.RData") Pred1<- get(obj_name[1]) Actual1<- get(obj_name[2]) dat2<- data.frame(S1=rep(Pred1[,1],ncol(Pred1)-1),variable=rep(colnames(Pred1)[-1],each=nrow(Pred1)),Predict=unlist(Pred1[,-1],use.names=FALSE),Actual=unlist(Actual1[,-1],use.names=FALSE),stringsAsFactors=FALSE) dat2New<- dat2[!(is.na(dat2$Predict)|is.na(dat2$Actual)),] ?dat3<- dat2New[order(dat2New$S1,dat2New$Predict),] library(plyr) resLow<-ddply(dat3,.(S1),summarize, cbind(head(Predict,5),head(Actual,5))) resHigh<-ddply(dat3,.(S1),summarize, cbind(head(rev(Predict),5),head(rev(Actual),5))) ?resLow...
2013 May 22
0
calcul of the mean in a period of time
...???????????? 2.5 2????????????????????? 4????????????????? 2.6 2?????????????????????? 5???????????????? 1.5 3?????????????????????? 0???????????????? 1.2 4?????????????????????? 0???????????????? 1.3 4?????????????????????? 1???????????????? 1.8 ",sep="",header=TRUE) library(plyr) ?dat2New<-ddply(dat2,.(patient_id),summarize,t=seq(min(t),max(t))) ?res<-join(dat2New,dat2,type="full") ?lst1<-lapply(split(res,res$patient_id),function(x) {x1<-x[x$t!=0,];do.call(rbind,lapply(split(x1,((x1$t-1)%/%3)+1),function(y) {y1<-if(any(y$t==1)) rbind(x[x$t==0,],y) else y; d...
2013 May 09
0
Replace rows in dataframe based on values in other columns
...?????????? 15 Hazel 4/11/2010 ??????????? 15 Hazel 4/11/2010 ??????????? 15 Hazel 4/11/2010 ??????????? 15 Hazel 4/11/2010 ??????????? 17 Pete 9/2/2012 ??????????? 17 Pete 9/2/2012 ??????????? 17 Pete 9/2/2012 ??????????? 17 Pete 9/2/2012 ",sep="",header=TRUE,stringsAsFactors=FALSE) dat2New<-unsplit(lapply(split(dat2,dat2$Restaurant), FUN= function(x) {x1<-x[order(as.Date(x$purchase_date,format="%m/%d/%Y")),]; x1$Current_Owner<- tail(x1$owner,1); x1}),dat2$Restaurant) ? ?rownames(dat2New)<- 1:nrow(dat2New) ?dat2New #?? Restaurant owner purchase_date Current_Owner...
2013 Jun 15
2
Plotting two y-axis vs non-numeric x-axis
Hi dear all, the following code is correct. but I want to use non-numeric x-axis, for example if I replace time <- seq(0,72,6) by month <- c("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","Pag") Ofcourse I use factor(month) instead of
2013 Aug 22
1
converting a summary table to survey database form
Hi! I am looking to choose a condom based on its pleasure score. I received some summarised data from 10 individuals: structure(list(Ramses = c(4, 4, 5, 5, 6, 3, 4, 4, 3, 4), Sheiks = c(5, 5, 6, 4, 7, 6, 4, 5, 6, 3), Trojans = c(7, 8, 7, 9, 6, 3, 2, 2, 2, 3), Unnamed = c(2, 1, 1, 3, 3, 4, 5, 4, 4, 3)), .Names = c("Ramses", "Sheiks", "Trojans", "Unnamed"),
2013 Sep 25
1
Best and worst values for each date
Hi, May be you can try this: obj_name<- load("arun.RData") Pred1<- get(obj_name[1]) Actual1<- get(obj_name[2]) library(reshape2) dat<-cbind(melt(Pred1,id.vars="S1"),value2=melt(Actual1,id.vars="S1")[,3])? # to reshape to long form colnames(dat)[3:4]<- c("Predict","Actual") dat$variable<- as.character(dat$variable) #not that
2013 May 07
4
how to calculate the mean in a period of time?
...????????????? 2.2 1????????????????????? 3???????????????? 1.8 2????????????????????? 0????????????????? 2.3 2?????????????????????? 2???????????????? 2.5 2????????????????????? 4????????????????? 2.6 2?????????????????????? 5???????????????? 1.5 ",sep="",header=TRUE) library(plyr) ?dat2New<-ddply(dat2,.(patient_id),summarize,t=seq(min(t),max(t))) ?res<-join(dat2New,dat2,type="full") res1<-do.call(rbind,lapply(split(res,res$patient_id),function(x) {x1<-x[x$t!=0,];do.call(rbind,lapply(split(x1,((x1$t-1)%/%3)+1),function(y) {y1<-if(any(y$t==1)) rbind(x[x$t==0,],...