similar to: how to calculate the mean in a period of time?

Displaying 20 results from an estimated 1000 matches similar to: "how to calculate the mean in a period of time?"

2013 Apr 29
1
how to add new rows in a dataframe?
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??????????????????????? 7.8 3???????????????? 0??????????????????????? 1.6 3????????????????
2013 Apr 12
5
how to change the date into an interval of date?
Hi, I am not sure I understand your question correctly. dat1<- read.table(text=" id??????????? responsed_at???????????????? number_of_connection????????????????? scores 1????????????????? 12-01-2010?????????????????????????????????? 1????????????????????????????????????????????? 2 1????????????????? 15-02-2010??????????????????????????????????
2013 May 22
0
calcul of the mean in a period of time
Hi, I guess you meant this: dat2<- read.table(text=" patient_id????? t???????? scores 1????????????????????? 0??????????????? 1.6 1????????????????????? 1??????????????? 2.6 1????????????????????? 2???????????????? 2.2 1????????????????????? 3???????????????? 1.8 2????????????????????? 0????????????????? 2.3 2?????????????????????? 2???????????????? 2.5 2?????????????????????
2013 Jun 04
0
choose the lines2
HI, You can do this: dat1<- read.csv("dat7.csv",header=TRUE,stringsAsFactors=FALSE,sep="\t") dat.bru<- dat1[!is.na(dat1$evnmt_brutal),] fun2<- function(dat){? ????? lst1<- split(dat,dat$patient_id) ??? lst2<- lapply(lst1,function(x) x[cumsum(x$evnmt_brutal==0)>0,]) ??? lst3<- lapply(lst2,function(x) x[!(all(x$evnmt_brutal==1)|all(x$evnmt_brutal==0)),])
2013 Jun 04
0
choose the lines2
Hi, May be this helps: dat1<- read.csv("dat7.csv",header=TRUE,stringsAsFactors=FALSE,sep="\t") dat.bru<- dat1[!is.na(dat1$evnmt_brutal),] fun2<- function(dat){?? ????? lst1<- split(dat,dat$patient_id) ??? lst2<- lapply(lst1,function(x) x[cumsum(x$evnmt_brutal==0)>0,]) ??? lst3<- lapply(lst2,function(x) x[!(all(x$evnmt_brutal==1)|all(x$evnmt_brutal==0)),])
2013 May 27
0
choose the lines
Hi, Try this: dat1<- read.csv("dat7.csv",header=TRUE,stringsAsFactors=FALSE,sep="\t") dat.bru<- dat1[!is.na(dat1$evnmt_brutal),] fun1<- function(dat){??? ? ??? lst1<- split(dat,dat$patient_id) ??? lst2<- lapply(lst1,function(x) x[cumsum(x$evnmt_brutal==0)>0,]) ??? lst3<- lapply(lst2,function(x) x[!(all(x$evnmt_brutal==1)|all(x$evnmt_brutal==0)),]) ???
2011 May 10
3
metaMDS and envfit: Help reading output
Hello R experts, I've used metaMDS to run NMDS on some fish abundance data, and am also working on correlating environmental data to the NMDS coordinates. I'm fairly new to metaMDS and NMDS in general, so I have what are probably some very basic questions. My fish abundance data consists of 66 sites for which up to 20 species of fish were identified and counted. I ran metaMDS on this data
2013 Feb 17
6
histogram
HI Elisa, You could use ?cut() vec1<-c(33,18,13,47,30,10,6,21,39,25,40,29,14,16,44,1,41,4,15,20,46,32,38,5,31,12,48,27,36,24,34,2,35,11,42,9,8,7,26,22,43,17,19,28,23,3,49,37,50,45) label1<-unlist(lapply(mapply(c,lapply(seq(0,45,5),function(x) x),lapply(seq(5,50,5),function(x) x),SIMPLIFY=FALSE),function(i) paste(i[1],"<x<=",i[2],sep="")))
2013 Sep 25
1
Computing calculation among two vectors
Hi, Try: x<- 1:4 ?y<- c("*","/","-","+") res<-sapply(y,function(i) {x1<-expand.grid(x,x); unlist(lapply(paste0(x1[,1],i,x1[,2]),function(u) eval(parse(text=u))))}) row.names(res)<- as.character(interaction(expand.grid(x,x),sep="_")) head(res) #??? *?? /? - + #1_1 1 1.0? 0 2 #2_1 2 2.0? 1 3 #3_1 3 3.0? 2 4 #4_1 4 4.0? 3 5 #1_2 2 0.5
2012 May 27
3
write.csv permissions
Dear R help, I have a doubt regarding the write.csv function.? When I save a file (write.csv(res1,"res1.csv")), it is saving with the read-only permission.? I tried to change the permission as a root user with chmod u+x.? Though, it says that "-rwxr--r--? 1 root root???? 164 2012-05-27 10:18 res1.csv", when I open the file it is still read-only.? Is there any way to save the
2013 Sep 02
3
Product of certain rows in a matrix
Hi, You could try: A<- matrix(unlist(read.table(text=" 1 2 3 4 5 6 7 8 9 9 8 7 6 5 4 3 2 1 ",sep="",header=FALSE)),ncol=3,byrow=FALSE,dimnames=NULL) library(matrixStats) ?res1<-t(sapply(split(as.data.frame(A),as.numeric(gl(nrow(A),2,6))),colProds)) ?res1 #? [,1] [,2] [,3] #1??? 4?? 10?? 18 #2?? 63?? 64?? 63 #3?? 18?? 10??? 4
2013 Jun 10
4
Combining CSV data
Hello R community, I am trying to combine two CSV files that look like this: File A Row_ID_CR, Data1, Data2, Data3 1, aa, bb, cc 2, dd, ee, ff File B Row_ID_N, Src_Row_ID, DataN1 1a, 1, This is comment 1 2a, 1, This is comment 2 3a,
2008 May 20
1
drawing lines in 3D (rotating them)
Hi the list, I write a short function to draw lines in 3D, showing then turning. At some point, I add "delais" to slow down the rotation. So two questions: 1) I try to find a library to draw animate lines in 3D but I did not find. That surprise me since it is very simple to do. Did I forget to look somewhere ? If it does not exists and I have to use my own function : 2) Is it
2013 Feb 17
3
Select components of a list
Hi Gustav, Try this: lapply(1:length(models),function(i) lapply(models[[i]],function(x) summary(x)$coef[2,]))[[1]] #1st list component [[1]] #??? Estimate?? Std. Error????? z value???? Pr(>|z|) # pm10 #5.999185e-04 1.486195e-04 4.036606e+00 5.423004e-05 #[[2]] #??? Estimate?? Std. Error????? z value???? Pr(>|z|) #ozone #0.0010117294 0.0003792739 2.6675428048 0.0076408155 #[[3]] #???
2012 Nov 08
5
map two names into one
Thanks. Yes. Your approach can identify: Glaxy ace S 5830 and S 5830 Glaxy ace But you can not identify using same program: Iphone 4S 16 G Iphone 4S 16G How should I solve both in same time. Kind regards,Tammy [[alternative HTML version deleted]]
2013 Nov 21
1
how can I import a number of datsets in a folder in my working directory to a list in R
Hi, Suppose, if I create 15 files in my working directory. set.seed(48) lapply(1:15,function(i) {m1 <- matrix(sample(1:20,1686*2,replace=TRUE),nrow=1686,ncol=2); write.table(m1,paste0("file_",i,".txt"),row.names=FALSE,quote=FALSE)}) ?D <-dir() D1 <- D[order(as.numeric(gsub("\\D+","",D)))] D1 ?res <- t(sapply(D1,function(x) {x1<-
2013 Mar 07
2
xts time series object removing time and leaving just the date
I have and XTS time series object that has date and time. I started with 1 minute data and used apply.daily(x, sum) to sum the data to one cumulative value. This function works just fine however it leaves a time for the last summed value which looks like this 2006-07-19 14:58:00. I need to just have the date and to remove the time value of 14:58:00 just leaving the date value of 2006-07-19 .
2010 Sep 07
2
Plotting longitudinal data
Hello, Hope that someone could help me plotting longitudinal data below: 7213 3333330001 0.8300 13.05.09 1 1 3333330001 0.8700 09.02.05 NULL 4797 3333330001 0.7700 21.03.07 NULL 2399 3333330001 0.7800 12.04.06 NULL 2400 3333330002 NULL 27.03.06 NULL 7230 3333330002 0.8200 14.05.09 0 2 3333330002 0.8400 09.02.05 NULL 4798 3333330002 0.8700 20.03.07 0 4799 3333330003 0.9000 20.03.07 13 2401
2010 Jun 29
3
merging/intersecting 2 data frames
Dear R People: I have two data frames, a.df and b.df as seen here: > a.df[1:10,] DATE GENDER PATIENT_ID AGE SYNDROME 1 4/16/2009 F 23686 45 RASH ON BODY 2 4/16/2009 F 13840 35 CANT URINATE 3 4/16/2009 M 12895 30 BLURRED VISION 4 4/16/2009 M 18375 33 UNABLE TO VOID 5 4/16/2009 M 2237 44
2013 Feb 01
29
cumulative sum by group and under some criteria
Thank you very much for your reply. Your code work well with this example. I modified a little to fit my real data, I got an error massage. Error in split.default(x = seq_len(nrow(x)), f = f, drop = drop, ...) : Group length is 0 but data length > 0 On Thu, Jan 31, 2013 at 12:21 PM, arun kirshna [via R] < ml-node+s789695n4657196h87@n4.nabble.com> wrote: > Hi, > Try this: >