Hi,
#working directory data1 #changed name data to data1. Added some files in each
of sub directories a1, a2, etc.
indx1<- indx[indx!=""]
lapply(indx1,function(x) list.files(x))
#[[1]]
#[1] "a1.txt" "m11kk.txt"
#[[2]]
#[1] "a2.txt" "m11kk.txt"
#[[3]]
#[1] "a3.txt"
HI,
Just to add:
res<-do.call(c,lapply(list.files(recursive=T)[grep("m11kk",list.files(recursive=T))],function(x)
{names(x)<-gsub("^(.*)\\/.*","\\1",x); lapply(x,function(y)
read.table(y,header=TRUE,stringsAsFactors=FALSE,fill=TRUE))})) #it seems like
one of the rows of your file doesn't
4 3 AR 2 11616 8926
#5 aAAA 1 3 3660 0.0008600 18 3 AA 2 20392 496
#6 AA na 2 1972 0.0007000 11 3 AR 25 509 734
#$a3
# Id M mm x b u k j y p v
#1 aAA 1 2 739 0.1257000 2 2 AA 2 8867 8926
#2 a 1 2 2263 0.0004000 2 2 AR
ot;1911. 8.17 12.90" "1911. 8.18 5.45"
#[19] "1911. 9.19 3.26" "1911. 9.20 5.70" "1911.10.21 9.24"
#[22] "1911.10.22 7.60" "1911.11.23 14.82" "1911.12.24 14.10"
A.K.
Hi,
I couldn't find the data(manaus) in library(Kendall).
I guess data(GuelphP) is similar to your dataset.
class(GuelphP)
[1] "ts"
typeof(GuelphP)
#[1] "double"
head(GuelphP)
#[1] 0.47 0.51 0.35 0.19 0.33 NA
GuelphP
# Jan Feb Mar Apr May Jun Jul Aug Sep Oct
1911. 3. 9 9.34"
#[10] "1911. 4.10 7.10" "1911. 5.11 14.92" "1911. 5.12 14.20"
#[13] "1911. 6.13 7.77" "1911. 6.14 9.36" "1911. 7.15 8.66"
#[16] "1911. 7.16 8.23" "1911. 8.17 11.
;1911. 7.16 8.23" "1911. 8.17 11.90" "1911. 8.18 15.45"
#[19] "1911. 9.19 13.26" "1911. 9.20 15.77" "1911.10.21 19.34"
#[22] "1911.10.22 7.66" "1911.11.23 14.84" "1911.12.24 14.11"
Hi,
set.seed(15)
dat1<-data.frame(col1=rnorm(6),col2=rep(1:2,each=3),col3=rep(letters[1:3],2),col4=runif(6),col5=rep(LETTERS[3:5],2))
dat1[,sapply(dat1,class)!="factor"]
# col1 col2 col4
#1 0.2588229 1 0.5090904
#2 1.8311207 1 0.7066286
#3 -0.3396186 1 0.8623137
#4 0.8971982
Hi,
Try this:
ifelse(rowSums(is.na(Mat))==ncol(Mat),NA,rowSums(Mat,na.rm=TRUE))
#[1] 0 3 NA
A.K.
- Original Message -
From: Christofer Bogaso
To: Marc Schwartz
Cc: r-help
Sent: Saturday, February 16, 2013 1:22 PM
Subject: Re: [R] Handling NA values
Thanks Marc for your reply.
Howe
Hi,
Try by putting quotes ie.
res<- do.call("c",...)
A.K.
From: Vera Costa
To: arun
Sent: Saturday, February 16, 2013 7:10 PM
Subject: Re: reading data
Thank you.
In mine, I have an error " 'what' must be a character strin
4)]
# Estimate Std. Error Pr(>|z|)
#[1,] 0.002659544 0.0009352046 0.004457766
#[2,] 0.002825612 0.0010150314 0.005373144
#[3,] 0.002409738 0.0009563814 0.011747444
#[4,] 0.001725140 0.0011635156 0.138155175
Hope it helps.
A.K.
____
From: Gustav Sigtu
96044 0.0004109854 6.087769e-09
#3.so2 0.0024097381 0.0009563814 1.174744e-02
#4.pm10 0.0009285593 0.0001766520 1.468764e-07
#4.ozone 0.0005455392 0.0004301502 2.047076e-01
#4.so2 0.0017251400 0.0011635156 1.381552e-01
A.K.
From: Gustav Sigtuna
To: arun
#52 3 2 1 1 5 4 3
#53 3 2 2 0 5 4 2
#54 3 2 2 0 5 4 3
#55 3 2 2 0 5 4 4
#56 3 2 2 1 5 4 2
#57 3 2 2 1 5 4 3
#58 3 2 2 1 5 4 4
A.K.
From: Joanna Zhang
To: arun
Sent: Saturday, February 16, 2013 8:46 PM
Subject: Re: [R] cumulative sum
do.call(rbind,lapply((m1+2):(7-n1),function(m)
do.call(rbind,lapply((n1+2):(9-m),function(n)
do.call(rbind,lapply(x1:(x1+m-m1), function(x) expand.grid(m1,n1,x1,y1,m,n,x))
)
names(res)<- c("m1","n1","x1","y1","m","n","x"
HI Vera,
No problem. I am cc:ing to r-help.
A.K.
From: Vera Costa
To: arun
Sent: Sunday, February 17, 2013 5:44 AM
Subject: Re: reading data
Hi. Thank you. It works now:-)
And yes, I use windows.
Thank you very much.
No dia 17 de Fev de 2013 00:44
mponent
Thanks,
A.K.
From: Gustav Sigtuna
To: arun
Sent: Sunday, February 17, 2013 5:49 AM
Subject: Re: Select components of a list
Dear Arun,
Thanks again. The script works perfectly for GLM. Strangely, it does not work
for GAM, although it has the same output for the linear part. I ca
6404e-04
#2.ozone 0.0008389801 0.0004272480 4.956676e-02
#2.so2 0.0032899751 0.0009475318 5.163027e-04
#3.pm10 0.0005398889 0.0001551911 5.035438e-04
#3.ozone 0.0023890220 0.0004082119 4.845107e-09
#3.so2 0.0049121476 0.0008818088 2.539574e-08
#4.pm10 0.0009341888 0.0001760271 1.113999e-07
#4.ozone 0.000
Hi,
I am not sure I understand it correctly.
dat1<-read.table(text="
customer.name product cost
John Toothpaste 30
Mike Toothpaste 45
Peter Toothpaste 40
",sep="",header=TRUE,stringsAsFactors=FALSE)
dat1$no.of.orders<- sqrt((dat1$cost-3.40)/1.20)
dat1
# customer.name
=FALSE),function(i)
paste(i[1],"
To: "smartpink...@yahoo.com"
Sent: Sunday, February 17, 2013 2:35 PM
Subject: histogram
Dear Arun,
[text file is attached in case format of email is changed]
For the following data set
33 18 13 47 30 10 6 21 39 25 40 29 14 16 44 1 41 4 15 20
),lapply(seq(5,50,5),function(x) x),SIMPLIFY=FALSE),function(i)
paste(i[1],"
To: "smartpink...@yahoo.com"
Sent: Sunday, February 17, 2013 3:27 PM
Subject: addition in the initial question
Dear Arun,
just a small change in the initial question.
what if, instead of counting number i
0 27 22
#45 3 2 0 1 5 4 1 27 22
#46 3 2 0 1 5 4 2 27 22
#47 3 2 1 0 5 4 1 49 49
#48 3 2 1 0 5 4 2 49 49
#49 3 2 1 0 5 4 3 49 49
#50 3 2 1 1 5 4 1 47 49
#51 3 2 1 1 5 4 2 47 49
#52 3 2 1 1 5 4 3 47 49
#53 3 2 2 0 5 4 2 23 43
#54 3 2 2 0 5 4 3 23 43
#55 3 2
you want the separate counts per a1,a2,a3 within the group:
res4<-lapply(seq_along(res3),function(i) do.call(rbind,lapply(res3[[i]],
function(x) table(x$mm[x[["b"]]<0.01]
names(res4)<- names(res2)
res4
#$group_a
# 2 3
#a1 3 1
#a2 3 1
#a3 3 1
#$group_b
# 2 3
#b1 3 1
#b
t;,"",names(lista)),sep="")
res2<-split(lista,names(lista))
res3<- lapply(res2,function(x)
{names(x)<-paste(gsub(".*_","",names(x)),1:length(x),sep="");x})
res4<-lapply(seq_along(res3),function(i) do.call(rbind,lapply(res3[[i]],
functi
Sent: Monday, February 18, 2013 4:10 PM
Subject: RE: [R] addition in the initial question [SCL:4]
Thanks arun,
here it is
vec1<-c(gg)
vec2<-vec1[1:124]
names(vec2)<-(1:124)
label1<-unlist(lapply(mapply(c,lapply(seq(0,0.90,0.1),function(x)
x),lapply(seq(0.1,1,0.1),function(x) x)
Hi
plot(totdata,seq_along(totdata),type='l',pch=1,lty=1,col='blue',lwd=1)
A.K.
- Original Message -
From: Jie Tang
To: r-help@r-project.org
Cc:
Sent: Monday, February 18, 2013 10:17 PM
Subject: [R] how to change the plot from X-axis to Y-axis
hello ,Rusers:
I have a dataset for ex
exist in d3, so that rows are left as missing or NA
tail(res2,3)
# m1 n1 x1 y1 m n x y cterm1_P0L cterm1_P1L cterm1_P0H cterm1_P1H
#427 3 3 2 2 4 5 3 2 NA NA NA NA
#428 3 3 2 2 4 5 3 3 NA NA NA NA
#429 3 3 2 2 4 5 3 4
y)
expand.grid(m1,n1,x1,y1,m,n,x,y)) )))
names(res1)<- c("m1","n1","x1","y1","m","n","x","y")
attr(res1,"out.attrs")<-NULL
res1
library(plyr)
res2<- join(res1,d3,by=c("m1","n1
of 2 variables:
#..$ date1 : chr [1:29585] "1930. 1. 1" "1930. 1. 2" "1930. 1. 3" "1930.
1. 4" ...
#..$ discharge: chr [1:29585] "-.000" "-.000" "-.000" "-.000"
...
Regarding the space betwee
earlier reply, if you don't want the combination of m1=3
and n1=3 in the expanded dataset,
use type="inner" in ?join().
library(plyr)
res2<- join(res1,d3,by=c("m1","n1"),type="inner")
A.K.
____
From: Joanna Zhang
T
27;t show me the results you expected in the expansion. So, I am
not sure about how it will look like.
A.K.
____
From: Joanna Zhang
To: arun
Sent: Tuesday, February 19, 2013 11:43 AM
Subject: Re: [R] cumulative sum by group and under some criteria
Thanks. I can
3 2 3 0.9025 0.64 0.857375 0.512
#240 2 3 1 2 4 5 3 4 2 3 0.9025 0.64 0.857375 0.512
A.K.
From: Joanna Zhang
To: arun
Sent: Tuesday, February 19, 2013 11:43 AM
Subject: Re: [R] cumulative sum by group and under some criteria
Thanks. I can get the dat
HI Alain,
Try this:
df.breaks<-data.frame(id=df[,1],sapply(df[,-1],function(x)
findInterval(x,quantile(x),rightmost.closed=TRUE)),stringsAsFactors=FALSE)
df.breaks
# id a b c
#1 x01 1 1 1
#2 x02 1 1 1
#3 x03 2 2 2
#4 x04 3 3 3
#5 x05 4 4 4
#6 x06 4 4 4
A.K.
- Original Message -
From:
0 4 4 0 2 0.9025 0.64 0.9025 0.64
#4 2 2 0 0 4 4 1 0 0.9025 0.64 0.9025 0.64
#5 2 2 0 0 4 4 1 1 0.9025 0.64 0.9025 0.64
#6 2 2 0 0 4 4 1 2 0.9025 0.64 0.9025 0.64
From: Joanna Zhang
To: arun
Sent: Tuesday, February 19, 2013 11:43 AM
Subject: Re: [R] cumulative sum by group and un
Hi,
Try this:
dat1<- read.table(text="
Patient Treatment Outcome Advice Treatment Outcome Advice
P1 T1 O1 A1 T2 O2 A2
",sep="",header=TRUE,stringsAsFactors=FALSE)
names(dat1)[-1]<-paste(gsub("\\..*","",names(dat1)[-1]),"_",rep(1:2,each=
),xlab="Charge",ylab="Relative
Frequencies",col=colour,legend.text = rownames(freq.rel.i1))
barplot(freq.rel.f1,beside=T,main=("Sample with
FDR<0.01"),xlab="Charge",ylab="Relative Frequencies",col=colour,legend.text =
rownames(freq.rel.f1))
#ch
1911. 8. 1 1.99
#11 1911. 9. 1 2.16
#12 1911.10. 1 2.45
#13 1911.11. 1 3.59
#14 1911.12. 1 5.71
A.K.
From: eliza botto
To: "smartpink...@yahoo.com"
Sent: Wednesday, February 20, 2013 8:25 AM
Subject: RE: d
Hi,
Do you need "exp^"? Should it be "exp(-((...?
x1<-as.numeric(x)
sd1<-sd(small)
mean1<- mean(small)
((1/sd1)*sqrt(2*pi))*exp(-((x1-mean1)^2)/(2*(sd1^2)))
# [1] 4.189541e-27 4.190295e-27 4.191049e-27 4.191803e-27 4.192557e-27
#[6] 4.193311e-27 4.194065e-27 4.194820e-27 4.195574e-27 4.196329e
Hi,
I guess this is what you wanted:
seq1<-matrix(c(1,-1,0,1,1,-1,0,0,-1,1,1,NA),3,4)
seq1
# [,1] [,2] [,3] [,4]
#[1,] 1 1 0 1
#[2,] -1 1 0 1
#[3,] 0 -1 -1 NA
set.seed(15)
mat1<-matrix(rnorm(12),3)
mat1
# [,1] [,2] [,3] [,4]
#[1,]
h("/home/arunksa111/Trial", "myplot.pdf")
pdf(file=mypath1)
lapply(seq_len(ncol(res1)),function(i){
matplot(res1[,i],type="l",col="grey")
lines(b,lwd=2,col="black")
})
dev.off()
From: eliza botto
To: "sma
Hi,
May be this helps:
dat1<- read.table(text="
Subject Block Trial Feature1 Feature2
1 1 1 48 40
1 1 2 62 18
1 2 1 34 43
1 2 2 51 34
1 3 1 64 14
",sep="",header=TRUE)
res1<-do.call(rbind,lapply(split(dat1,dat1$Block),function(x)
data.frame(unique(x[,1:2]),t(colMeans(x[
Hi,
Try this:
dat1<- read.table(text="
ID COMPL SEX HEREDITY
1 0 1 2
1 0 1 2
1 3 1 2
2 0 0 1
2 1 0 1
2 2 0 1
2 2 0 1
3 0 0 1
3 0 0 1
3 0 0 1
3 0 0 1
3
Hi,
You can also use:
do.call(rbind,lapply(split(dat1,dat1$ID),function(x) head(x[x$COMPL!=0,],1)))
# ID COMPL SEX HEREDITY
#1 1 3 1 2
#2 2 1 0 1
#3 3 2 0 1
- Original Message -
From: Tasnuva Tabassum
To: r-help@r-project.org
Cc:
Sent: Sat
HI,
Tried your approach:
dat1$sequence <- as.vector(unlist(lapply( aggregate(dat1$ID,
by=list(dat1$ID),FUN=length)$x, FUN=function(x){seq(1, x)})))
dat0 <- dat1[dat1$sequence==1 & dat1$COMPL!= 0, ] #your second solution
dat0
#[1] ID COMPL SEX HEREDITY sequence
#<0 rows> (or 0-l
.
From: Tasnuva Tabassum
To: Xiaogang Su
Cc: arun ; R help ; Rui Barradas
Sent: Saturday, February 23, 2013 11:23 PM
Subject: Re: [R] Selecting First Incidence from Longitudinal Data
Hi
Thank you very much, but I forgot to tell that I also want to include the
patients for which no
50 0.25 0.5479167 0.6958333 0.4
# Fmm_f2 Fnn_f2 Qn2 Qm2
#1 0.000 0.000 1.000 1.000
#2 0.000 0.358 0.6416667 1.000
#3 0.000 0.6958333 0.3041667 1.000
#4 0.200 0.200 0.800 0.800
#5 0.3791667 0.3791667 0.6208333 0.6208333
#6 0.4000
200 0.2 0.2000 0.000 0.4
#5 0.0073509189 0.25 0.25 0.593 0.6 0.407 0.4 0.4035 0.407 0.4
# 0.0001934452 0.50 0.25 0.302 0.6 0.698 0.4 0.5490 0.698 0.4
From: Joanna Zhang
To: arun
Sent: Saturday, February 23, 2013 5:35 PM
Subject: Re: [R] cumulati
ode
# ID COMPL SEX HEREDITY
#3 1 3 1 2
#5 2 1 0 1
#12 3 2 0 1
#13 4 0 1 2
A.K.
____
From: Tasnuva Tabassum
To: arun
Sent: Sunday, February 24, 2013 12:08 AM
Subject: Re: [R] Selecting First Incidence fro
st1[lapply(lst1,nrow)!=0],function(x){
x[,11:14]<-NA;
x[,11:12][x$Qm<=c11,]<-cumsum(x[,9:10][x$Qm<=c11,]); # cumsum if
x$Qm<=c11 & x>2
x[,13:14][x$Qn<=c12,]<-cumsum(x[,9:10][x$Qn<=c12,]); #cumsum if x$Qn<=12
& y>2
colnames(x)[11:14]<-
c("cterm1
Hi,
You could also try:
library(gtools)
smartbind(df2,df1)
# a b d
#1 7 99 12
#2 7 99 12
When df1!=df2
smartbind(df1,df2)
# a b d x y c
#1 7 99 12 NA NA NA
#2 NA 34 88 12 44 56
A.K.
- Original Message -
From: Anika Masters
To: r-help@r-project.org
Cc:
Sent: Tuesday, Febr
1000, 0.2+res2$x, 0.8+res2$m-res2$x)
length(Pm2)
#[1] 1000
A.K.
- Original Message -
From: Zjoanna
To: r-help@r-project.org
Cc:
Sent: Tuesday, February 26, 2013 3:13 PM
Subject: Re: [R] cumulative sum by group and under some criteria
Hi Arun
I noticed that the values of Fmm, Fnn,
t;)),function(i)
as.numeric(unlist(strsplit(i,"",function(x)
rbeta(1000,0.2+x[1],0.8+x[2]-x[1]))
A.K.
From: Joanna Zhang
To: arun
Sent: Tuesday, February 26, 2013 10:37 PM
Subject: Re: [R] cumulative sum by group and under some criteria
I don
612 0.3060 0.000 0.612 1.000 0.388
#4 0.069833730 0.00 0.25 0.59 0.000 0.2950 0.295 0.295 0.705 0.705
#5 0.007350919 0.25 0.25 0.60 0.566 0.5830 0.583 0.583 0.417 0.417
A.K.
From: Joanna Zhang
To: arun
Sent: Tuesday, February 26, 2013 11:32 PM
Subject: Re: [R] cumulative sum
C D
#2 2 2 4 4 0.2 0.1 0.3 0.4
A.K.
From: Joanna Zhang
To: arun
Sent: Wednesday, February 27, 2013 1:25 AM
Subject: Re: [R] cumulative sum by group and under some criteria
Thanks very much! it works!
suppose that I have a data:
m1 n1 m n A B
8
#[5,] 206818 187223 54717 99734 0 78124
#[6,] 229688 343090 124372 62678 78124 0
A.K.
- Original Message -
From: arun
To: eliza botto
Cc: R help
Sent: Wednesday, February 27, 2013 9:41 AM
Subject: Re: matrix multiplication
Hi,
Just to add:
res<-do.call(cbind,lapply
146L, 139L, 426L, 375L, 66L, 299L,
438L, 223L, 175L, 92L, 225L, 276L, 185L, 336L, 371L, 306L, 366L,
319L), .Dim = c(124L, 8L))
Eliza
--
> Date: Wed, 27 Feb 2013 05:44:55 -0800
> From: smartpink...@yahoo.com
> Subject: Re: matrix multiplication
> To: eliza_bo...@hotmail.com
&g
, 27 Feb 2013 05:44:55 -0800
> From: smartpink...@yahoo.com
> Subject: Re: matrix multiplication
> To: eliza_bo...@hotmail.com
>
> Hi Elisa,
>
> Could you just dput that dataset?
> Arun
>
>
>
>
>
>
>
> From: eliza
66165 5.266969 2.055659 2.641375 2.064289 0.989997 2.380017 2.671741
#[3,] 1.937378 1.581713 0.023942 0.268916 0.019627 0.556773 0.138237 0.284099
# [,33]
#[1,] 1.806361
#[2,] 2.357779
#[3,] 0.127118
A.K.
From: eliza botto
To: "smartpink...@yah
#3rd function for p-value
fpv<- function(Countdata){
resNew<-do.call(cbind,lapply(split(names(Countdata)[4:ncol(Countdata)],gsub("[0-9]","",names(Countdata)[4:ncol(Countdata)])),
function(i) {x<-if(ncol(Countdata[i])>1) rowSums(Countdata[i]) else
Countdata[i]; colnames(x)<-N
Hi,
You could also try:
gsub("[()]","",names(dataFrame))
set.seed(15)
datF<- data.frame(sample(1:10,15,replace=TRUE))
names(datF)<- "fBodyGyroskewness()Z"
gsub("[()]","",names(datF))
#[1] "fBodyGyroskewnessZ"
sub("\\(\\)","",names(datF))
#[1] "fBodyGyroskewnessZ"
A.K.
- Original Messa
Hi Rui,
Looks like a bug:
###if(names(model)[1] = "(Intercept)")
Should this be:
if(names(model)[1] == "(Intercept)")
A.K.
- Original Message -
From: Rui Barradas
To: Mike Rennie
Cc: r-help Mailing List
Sent: Friday, March 1, 2013 3:18 PM
Subject: Re: [R] solving x in a polynomial
00225625 0.03515625 0.500 0.500 0 0
# cterm1_P0H cterm1_P1H sumTerm1_p0 sumTerm1_p1
#1 0 0 0.8145062 0.3164062
#2 0 0 0.9002438 0.5273438
#3 0 0 0.9025000 0.5625000
A.K.
From: Joanna Z
HI,
Not sure I understand it correctly,
data1<-read.table(text="
a b c d
0 1 1 0
1 1 1 1
1 0 0 1
",sep="",header=TRUE)
data2<- data1
data3<- data1
If i follow this logic for the 1st and 2nd columns,
data1[ data1[ , 4 ] == 0 , 1 ] <-
ly(1:ncol(x1), function(i) {x2<-
dat2[,x1[,i]];dim(x2[!as.logical(rowSums(x2==0)),])[1]}))})
res
#[[1]]
#[1] 6 7 6 6 5 6
#[[2]]
#[1] 6 5 6 5
#
#[[3]]
#[1] 5
A.K.
From: Utpal Bakshi
To: arun
Sent: Saturday, March 2, 2013 2:14 PM
Subject: Re: explanation of t
Hi,
Try this:
set.seed(51)
mat1<- as.matrix(data.frame(REC.TYPE=
sample(c("SAO","FAO","FL-1","FL-2","FL-15"),20,replace=TRUE),Col2=rnorm(20),Col3=runif(20),stringsAsFactors=FALSE))
dat1<- as.data.frame(mat1,stringsAsFactors=FALSE)
dat1[grepl("SAO|FL-15",dat1$REC.TYPE),]
# REC.TYPE Col2
HI,
You could also use ?data.table()
n<- 30
set.seed(51)
mat1<- as.matrix(data.frame(REC.TYPE=
sample(c("SAO","FAO","FL-1","FL-2","FL-15"),n,replace=TRUE),Col2=rnorm(n),Col3=runif(n),stringsAsFactors=FALSE))
dat1<- as.data.frame(mat1,stringsAsFactors=FALSE)
table(mat1[,1])
#
# FAO FL-1
HI,
Check these links:
http://r.789695.n4.nabble.com/Re-new-question-td4659908.html
http://r.789695.n4.nabble.com/Re-reading-data-td4658705.html#a4659751
It shows reading files (not binary files) from multiple subdirectories and
doing some calculations.
You may need to change it according to you
3 2 3 6 3 5 2 4 8 13 21 21 23 20
#25-50 0 2 1 4 3 3 5 7 8 8 8 11 12 11 13 12 11 15 14 18 17 12 10 3 2 3 6
#50-75 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 2 0 0 2 0 1
------
Hi,
You could use:
res<-unsplit(lapply(split(Vec,Vec),function(x) if(length(x)>1)
c(head(x,1),paste0(head(x,-1),seq_along(head(x,-1 else x),Vec)
res
# [1] "B" "B1" "C" "E" "B2" "E1" "E2" "D" "D1" "A"
A.K.
- Original Message -
From: Christofer Bogaso
To: r-help
Cc:
Sent: M
,119,120,122,124
A.K.
- Original Message -
From: arun
To: eliza botto
Cc: R help
Sent: Monday, March 4, 2013 3:26 PM
Subject: Re: histogram
Hi,
dat1<- read.csv("rightest.csv",sep=",&quo
___
From: eliza botto
To: "smartpink...@yahoo.com"
Sent: Monday, March 4, 2013 3:21 PM
Subject: RE: histogram
Dear Arun,
Thanks for replying
Although codes well defined my problem but the table in the end should look
like the following
its j
: eliza botto
To: "smartpink...@yahoo.com"
Sent: Monday, March 4, 2013 5:50 PM
Subject: RE: histogram
Dear Arun,
Just a small inquiry i have.
you can see that in the results, there are some stations which are repeating
themselves like station number 16 which is included in all three
Hi,
May be you can try:
res1<- gsub("\\_.*\\_.*\\_.*","",x)
res2<-sub("(\\w)(\\w)(\\w)(\\w)(\\w)(\\w)(\\w)(\\w)(\\w)(\\w)(\\w)$", "",
x,perl=TRUE)
identical(res1,res2)
#[1] TRUE
A.K.
- Original Message -
From: Irucka Embry
To: r-help@r-project.org
Cc:
Sent: Monday, March 4, 2013 9:
81 0.6027881 0.5637881 1.000
#here, the first column is testing a2, against a2, a,c,t, second c2, against t,
c2, a,c, third c3 against c,t,c3,a, and fourth t2 against a,c,t, and t2.
A.K.
From: Vera Costa
To: arun
Sent: Tuesday, March 5, 2013 9:38 AM
S
)
table(cut(x,breaks=seq(0,75,25),labels=label1
colnames(resNew)<- resNew[1,]
resNew1<- resNew[-1,]
row.names(resNew1)<-gsub("vec1.","",row.names(resNew1))
Names3<-apply(resNew1,1,function(x) paste(names(which(x!=0)),collapse=","))
res2<- data.frame(F
indx2550<-which(x$Categ=="25-50");indx5075<-which(x$Categ=="50-75");
if(length(indx5075)>=1)
{matplot(k[,indx5075],ylim=c(0,5),type="l",col="grey",main=paste("range
50-75","line=",unique(x$Name1),sep=" "),xlab="T&q
Hi,
b[b[,4]>15 & (b[,1]>4|is.na(b[,1])) & (b[,2]>4|is.na(b[,2])),]
# [,1] [,2] [,3] [,4] [,5]
#[1,] 6 NA NA 16 20
#[2,] NA 5 NA 17 21
A.K.
- Original Message -
From: HJ YAN
To: r-help@r-project.org
Cc:
Sent: Tuesday, March 5, 2013 9:33 PM
Subject: [R] How to
Hi,
Try this:
mat1<- as.matrix(read.table(text="
1 1 3 2 3 1 1 2 3 3 2
",sep="",header=FALSE))
res<-lapply(1:3,function(i) which(mat1==i))
names(res)<- c("a","c","b")
res
#$a
#[1] 1 2 6 7
#$c
#[1] 4 8 11
#$b
#[1] 3 5 9 10
A.K.
- O
Hi HJ,
Tem2<- as.data.frame(Tem1)
res<-do.call(rbind,split(Tem2,Tem2$V1))
row.names(res)<- 1:nrow(res)
head(res,7)
# V1 V2
#1 111 1
#2 111 2
#3 111 3
#4 111 4
#5 111 13
#6 111 14
#7 111 15
A.K.
From: HJ YAN
To: arun
Cc: r-help@r-project.
ique(Tem1[,1])) {
Tem2<- subset(Tem1, Tem1[,1]==i)
Tem3<- rbind(Tem3,Tem2)
Tem5<- Tem3[-1,]
}
head(Tem5)
# V1 V2
# 111 1
# 111 2
# 111 3
# 111 4
# 111 13
# 111 14
A.K.
____
From: HJ YAN
To: arun
Cc: r-help@r-project.org
Sent: Wednesday, March 6, 2013 8:
] 333 30
A.K.
From: HJ YAN
To: arun
Sent: Wednesday, March 6, 2013 10:33 AM
Subject: Re: [R] How to combine conditional argument and logical argument in R
to create subset of data...
Thank you SO MUCH Arun!!!
That's brilliant-- I've learnt some very us
Just to add:
Tem1[Tem1[,2]%in%setdiff(Tem1[,2],Tem2[,2]),]
A.K.
- Original Message -
From: arun
To: HJ YAN
Cc: R help
Sent: Wednesday, March 6, 2013 11:06 AM
Subject: Re: [R] How to combine conditional argument and logical argument in R
to create subset of data...
Hi,
No problem
4
#[12,] 333 5
#[13,] 333 6
#[14,] 333 7
A.K.
From: HJ YAN
To: arun
Cc: r-help@r-project.org
Sent: Wednesday, March 6, 2013 4:09 PM
Subject: Re: [R] How to combine conditional argument and logical argument in R
to create subset of data...
Dear Arun
Th
2 23
#[8,] 333 4
#[9,] 333 5
#[10,] 333 6
#[11,] 333 7
#[12,] 222 6
#[13,] 222 7
#[14,] 333 11
In cases of more replicates (triplicates, etc...) how do you want to process.
Also, here the duplicate rows were found only in Tem1.
A.K.
From: HJ YAN
To: aru
Hi,
dfrm<- read.table(text="
Point_counts Psi_Sp
1 A 0
2 A 1
3 B 1
4 B 2
5 B 0
6 C 1
7
lines(temper[[i]][1]);
lines(temper[[i]][2])})
dev.off()
which may not be the one you wanted.
A.K.
From: Irucka Embry
To: smartpink...@yahoo.com
Sent: Wednesday, March 6, 2013 9:32 PM
Subject: Re: [R] multiple plots and looping assistance requested (revised code
yahoo.com
Sent: Wednesday, March 6, 2013 5:24 PM
Subject: Re: [R] multiple plots and looping assistance requested (revised codes)
Hi Arun, thanks for the note. Thank you especially for noting the use of the
";" and "{}." I have updated my own code and the possible reproducib
dev.off()
A.K.
From: Irucka Embry
To: smartpink...@yahoo.com
Cc: r-help@r-project.org
Sent: Wednesday, March 6, 2013 11:49 PM
Subject: Re: [R] multiple plots and looping assistance requested (revised codes)
Hi Arun, thank you for your assistance.
I ha
ux
Sum",sub=paste(i,colnames(x)[2],sep="_"),xlab="Calendar Year
Timesteps",ylab="Total Flux (kg/season)");lines(x[,1],x[,2])}))
dev.off()
A.K.
From: Irucka Embry
To: smartpink...@yahoo.com
Cc: r-help@r-project.org
Se
AAASSPVGVGQR 1-n_acPro/ 2 0 0 1
#3 aAGAAGGR 1-n_acPro/ 2 0 0 1
#4 aAAAGAAGGRGSGPGRR 1-n_acPro/ 2 1 0 0
#5 AAALQAK 2 0 1 1
#6 aAGAGPEMVR 1-n_acPro/ 2 0 0 2
A.K.
From: Vera Costa
To: arun
Sent: Th
Not sure if this what you wanted.
do.call(rbind,(matrix.list[desired.matrices]))
# [,1] [,2] [,3]
#[1,] 1 4 7
#[2,] 2 5 8
#[3,] 3 6 9
#[4,] 19 22 25
#[5,] 20 23 26
#[6,] 21 24 27
A.K.
From: Heath Blackmon
To: r-
Hi,
Try this:
library(xts)
Date1<- seq(as.POSIXct("2012-09-10 02:15:00",format="%Y-%m-%d %H:%M:%S"),
as.POSIXct("2012-09-12 02:15:00",format="%Y-%m-%d %H:%M:%S"), by="min")
length(Date1)
#[1] 2881
set.seed(15)
value<- rnorm(2881)
xt1<-xts(value,order.by=Date1)
res<-apply.daily(xt1,sum)
res1<- r
Hi,
Try this:
betas<- c(0.01,0.01,0.01)
LData<- list(int=rep(1,10), date=
matrix(c(152:161,163:168,162:165),nrow=2,ncol=10,byrow=TRUE),
land=c(rep(0,4),1,0,1,1,0,0))
betas2<- c(0.01,1,2)
mapply(`*`,LData,betas2)
#$int
# [1] 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01
#$date
# [,1] [,
list(lapply(strsplit(as.character(index(res))," "), function(x)
x[1]))
#Error in `index<-.xts`(`*tmp*`, value = c("2012-09-10", "2012-09-11", :
# unsupported ‘index’ index type of class ‘character’
Convert it to `date`
index(res)<- as.Date(unlist(lapply(strsplit
Hi,
If you look at ?cov(),
there are options for 'use':
set.seed(15)
a=array(rnorm(9),dim=c(3,3))
a[3,2]<- NaN
cov(a,use="complete.obs")
# [,1] [,2] [,3]
#[1,] 1.2360602 -0.32167789 0.8395953
#[2,] -0.3216779 0.08371491 -0.2185001
#[3,] 0.8395953 -0.21850006 0.57029
Hi,
You can try:
mat1<- do.call(rbind,x)
lapply(seq_len(ncol(mat1)),function(i) mat1[,i])
#[[1]]
#[1] 12.10 3.44
#[[2]]
#[1] 0.1 3.0
#[[3]]
#[1] 12.0 33.1
#[[4]]
#[1] 1.1 23.0
A.K.
- Original Message -
From: ishi soichi
To: PIKAL Petr
Cc: r-help
Sent: Friday, March 8, 2013 5:06 A
;)
par(mfrow=c(1,1))
lapply(names(temp2New),function(i) lapply(temp2New[[i]],function(x)
{plot(x[,1],x[,2],main="Seasonal Flux
Sum",sub=paste(i,colnames(x)[2],sep="_"),xlab="Calendar Year
Timesteps",ylab="Total Flux (kg/season)");lines(x[,1],x[,2])}))
dev.off(
-%Y"
labs<- format(tt,fmt)
axis(side=1,at=tt[ix],labels=labs[ix],tcl=-0.7,cex.axis=0.7)
legend("topleft",colnames(z1),lty=1,col=1:2)
#subset
z2<- zoo(dat1[1:5,-1],dat1[1:5,1])
Hope this helps.
A.K.
- Original Message -
From: "jakob.h...@gmail.com"
To: smartp
Hi,
try this:
sim.df<-data.frame(sim.code,sim.val,stringsAsFactors=FALSE)
sim.df[,1][-grep("\\d+$",sim.df[,1])]<-
paste(sim.df[,1][-grep("\\d+$",sim.df[,1])] , 1,sep="")
sim.df
# sim.code sim.val
#1 1.1234.1a.1 4
#2 1.1234.1a.2 5
#3 1.3245.2c.5 3
#4 4.6743.3c.1
Hi,
Using your code:
sub("[.]$",".1",sim.code)
#[1] "1.1234.1a.1" "1.1234.1a.2" "1.3245.2c.5" "4.6743.3c.1" "4.3254.6b.4"
#[6] "3.5463.2a.1"
A.K.
- Original Message -
From: chris201
To: r-help@r-project.org
Cc:
Sent: Friday, March 8, 2013 5:23 AM
Subject: [R] Substitute value
Hi,
I h
#2012-02-01 02:30:00 4.9 5.2
#2012-08-01 02:30:00 4.1 4.7
#2012-12-01 03:00:00 4.7 4.3
#2013-01-01 01:00:00 3.0 4.3
#2013-01-01 01:30:00 3.8 4.1
#2013-01-01 02:00:00 3.8 4.3
#2013-01-01 02:30:00 3.9 4.2
#2013-01-01 03:00:00 3.7 4.5
A.K.
- Original
701 - 800 of 3327 matches
Mail list logo