Displaying 20 results from an estimated 2000 matches similar to: "calcul of the mean in a period of time"
2013 May 07
4
how to calculate the mean in a period of time?
Hi,
Your question is still not clear.
May be this helps:
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
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)),])
???
2013 Mar 10
0
max row
HI,
Using
c11<- 0.01
c12<- 0.01
c1<- 0.10
c2<- 0.10
One possible problem is that:
dim(res5)
#[1] 513? 20
res6<-aggregate(.~m1+n1+m+n,data=res5[,c(1:6,9:12,21:24)] ,max)
#Error in `[.data.frame`(res5, , c(1:6, 9:12, 21:24)) :
?# undefined columns selected
A.K.
________________________________
From: Joanna Zhang <zjoanna2013 at gmail.com>
To: arun <smartpink111 at
2013 Nov 05
0
Sampling question
Hi,
You may try:
dat1 <- structure(list(SubID = 1:8, CSE1 = c(6L, 6L, 5L, 5L, 5L, 5L,
3L, 3L), CSE2 = c(5L, 4L, 5L, 4L, 6L, 4L, 6L, 6L), CSE3 = c(6L,
7L, 5L, 3L, 7L, 3L, 6L, 6L), CSE4 = c(2L, 2L, 5L, 4L, 5L, 6L,
3L, 3L), WSE1 = c(6L, 6L, 5L, 4L, 6L, 4L, 6L, 6L), WSE2 = c(2L,
6L, 5L, 4L, 4L, 3L, 5L, 5L), WSE3 = c(2L, 2L, 4L, 5L, 4L, 7L,
2L, 4L), WSE4 = c(4L, 3L, 5L, 2L, 1L, 3L, 1L, 7L)),
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 Sep 27
0
Best and Worst values
Ira,
obj_name<- load("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<-
2013 May 09
0
Replace rows in dataframe based on values in other columns
Hi,
dat1<- read.table(text="
Restaurant owner purchase_date
??????????? 23 Chuck 3/4/2011
??????????? 23 Chuck 3/4/2011
??????????? 23 Chuck 3/4/2011
??????????? 23 Chuck 3/4/2011
??????????? 23 Bob??????? 1/1/2013
??????????? 23 Bob??????? 1/1/2013
??????????? 23 Bob???????? 1/1/2013
??????????? 15 Hazel 4/11/2010
??????????? 15 Hazel 4/11/2010
??????????? 15 Hazel 4/11/2010
???????????
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??????????????????????????????????
2004 Jun 01
1
swapping with data.frame
Hi there,
I have some data which are convenient to enter as lists. For example:
t1<-list(fname="animal1",testname="hyla",dspkr="left",res1=39.7,res2=15.0)
t2<-list(fname="animal1",testname="bufo",dspkr="left",res1=14.4,res2=56.1)
2013 Mar 14
0
reshape
Hi Elisa,
You need to check your data.? For some 'st', the data is repeated/duplicated (I am assuming, didn't check it) especially for a particular year.
dat1<-read.csv("elisa.csv",sep="\t")
dat1$st<- as.character(dat1$st)
?str(dat1)
#'data.frame':??? 506953 obs. of? 5 variables:
# $ st?????? : chr? "AGOMO" "AGOMO"
2012 Jan 04
1
function in R for my exercise
Hi R helpers!
I have a question. I'm trying to create a function for an exercise. Here are
the arguments I should include:
x and y are numeric
z is a name ("plus","minus","multiply","divide")
and swap is logical.
Here is what the function should do:
When z="plus", then x+y is performed and so on for the other z names. It
should give a NA
2013 Mar 22
3
Distance calculation
Hi Elisa,
I hope this is what you wanted.
dat1<-read.csv("peaks.csv",sep=",")
#Subset
dat2<-dat1[1:5,]
res1<-do.call(cbind,lapply(seq_len(nrow(dat2)),function(i) do.call(rbind,lapply(split(rbind(dat2[i,],dat2[-i,]),1:nrow(rbind(dat2[i,],dat2[-i,]))), function(x) {x1<-rbind(dat2[i,],x);
2013 Sep 09
0
Duplicated genes
Hi,
May be you can try this:
dat1New<-? dat1[!(duplicated(dat1$gene)|duplicated(dat1$gene,fromLast=TRUE)),]
dat2<-dat1[duplicated(dat1$gene)|duplicated(dat1$gene,fromLast=TRUE),]
?lst1<-split(dat2,dat2$gene)
dat3<-unsplit(lapply(lst1,function(x) {x1<- sum(apply(x[,6:32],2,function(y) y[1]>=y[2]));x2<- sum(apply(x[,6:32],2, function(y) y[1]<=y[2])); if(x1>x2) x[1,] else
2000 Jul 05
1
Tukey.aov with split-plot designs
I am using R 1.1 with Redhat 6.2 and RW 1.001 with Win98 (the upkey doesn't
work on my IBM either as has been previously reported by others).
The function aov doesn't return either the residuals or the residual
degrees of freedom for split-plot designs.
If you use the following code from Baron and Li's "Notes on the use of R
for psycology experiments and questionnaires"
1997 Nov 10
2
R-alpha: loop speed
I noticed Doug only circulated the following on S-news, but it may be of
interest to R users who don't follow S-news. His findings are certainly
consistent with my own, where my problems often force me into the
element by element type of situation.
Paul Gilbert
_______
At the risk of beating this example to death, I went back and compared
the execution time for the element-by-element method
2013 Apr 13
2
Comparison of Date format
Hi,
?In the example you provided, it looks like the dates in Date2 happens first.? So, I changed it a bit.?
DataA<- read.table(text="
ID,Status,Date1,Date2 ??? ??? ??????
1,A,3-Feb-01,15-May-01 ??? ???
1,B,15-May-01,16-May-01 ??? ???
1,A,16-May-01,3-Sep-01 ??? ??? ??? ??? ???
1,B,3-Sep-01,13-Sep-01 ??? ??? ??? ??? ???
1,C,13-Sep-01,26-Feb-04 ??? ??? ??? ??? ???
2010 Oct 17
0
Help on choosing the appropriate analysis method
Dear R-help,
I'd like ask for your opinion on choosing the "right" strategy for a
particular dataset.
We conducted 24-hour electric field measurements on 90 subjects. They
are grouped by job (2 categories) and location (3 categories). There are
four exposure metrics assigned to each subject.
An excerpt from the data:
n job location M OA UE all
0 job1 dist_200 0.297 0.072 0.171
2008 Jul 25
0
nlminb--lower bound for parameters are dependent on each others
Hello
I'm trying to solve two sets of equations (each set has four equations and
all of them share common parameters) with nlminb procedure. I
minimize one set and use their parameters as initial values of other set,
repeating this until their parameters become very close to each other.
I have several parameters (say,param1, param2) and their constraints are
given as inequality and depend