Displaying 20 results from an estimated 166 matches for "temp2".
Did you mean:
temp
2009 Feb 11
2
error in my previous message
i'm sorry. i had an error in my previous code because i left out a
letter in the rownames.
while fixing that, i also found a solution. so i'm sorry for the
confusion.
below is my fix.
temp2 <- matrix(rnorm(10),nc=1,nrow=10)
rownames(temp2) <- c("a","b","c","d","e","f","g","h","i","j")
print(temp2)
temp2 <- as.matrix(temp2[order(temp2[,1,drop=FALSE]),])
print(temp2)
On Wed,...
2009 Feb 11
2
sorting a matrix by the column
this is a bad question but I can't figure it out and i've tried. if i
sort the 2 column
matrix , temp1, by the first column, then things work as expected. But,
if I sort the 1 column matrix, temp2, then it gets turned coerced to a
vector. I realize that I
need to use drop=FALSE but i've put it in a few different places with no
success. Thanks.
temp1 <- matrix(rnorm(10),nc=2,nrow=5)
rownames(temp1) <- c("a","b","c","d","e")
print(...
2012 Oct 31
2
Aggregate Table Data into Cell Frequencies
R-help -
I have this set of aggregated tables (sample data below via dput()). And I
would like to have delayValue as the column variables with the "temp"
(temp1, temp2, temp3) values as the row variables. However I would like to
have the temp variables *aggregated into single rows* so that I have the
frequency ("Freq" | counts) of each time each "delayValue" occurs in the
cells.
I've tried this command without luck, it seems to be droppi...
2004 Sep 28
3
sapply behavior
...ently this same thing happens in 1.8.0, though I
never experienced it. I had a hard time reproducing it, and I don't know
what's setting it off, but the code below seems to do it for me. (I'm using
R on Windows XP, either 1.8.0 or 1.9.1)
Thanks for any help,
Elizabeth Purdom
> temp2<-matrix(sample(1:6,6,replace=F),byrow=F,nrow=6,ncol=4)
> colnames(temp2)<-paste("A",as.character(1:4),sep="")
> temp2<-as.data.frame(temp2)
>
newtemp2<-sapply((1:6),function(x){xmat<-temp2[temp2[,1]==x,,drop=F];return(xmat[1,])})
> print(newtemp2)...
2003 Nov 23
4
remove 0 rows from a data frame
...y dbh age
801 0 2977.196 3090.225 6 36.0
802 0 2951.892 3083.769 8 40.6
803 0 2919.111 3075.557 8 40.6
804 0 2914.123 3072.700 9 42.9
805 0 2925.353 3074.675 8 40.6
How many rows (nft) shall be removed?
> nft<- rpois(1, 2)
> nft
[1] 2
Ok remove 2 rows:
> temp2<- temp[-sample(nrow(temp), nft), ]
> temp2
occ x y dbh age
801 0 2977.196 3090.225 6 36.0
803 0 2919.111 3075.557 8 40.6
805 0 2925.353 3074.675 8 40.6
No problem.
However, sometimes rpois(1, 2) lead to nft=0, and in that case I do not want
> temp2<-...
2006 Jan 04
3
matrix math
I am using R 2.1.1 in an windows XP environment.
I have 2 dataframes, temp1 and temp2.
Each dataframe has 20 variables (“cocolumns") and 525 observations (“rows”). All variables are numeric.
I want to create a new dataframe that also has 20 columns and 525 rows. The values in this dataframe should be the sum of the 2 other dataframe.
(i.e. temp1$column 1+tem...
2007 Jan 30
2
rbind-ing list
hi,
i have a list of data.frame that has same structure. i would like to know a
efficient way of rbind-ing it.
right now, i write:
n = length(temp) # 'temp' is a list of data.frames
temp2 = data.frame()
for (i in 1:n) temp2 = rbind( temp2, temp[[i]])
return(temp2)
but this is not an efficient way since we keeping overwriting temp2. i
wonder if there's faster way.
thanks
--
View this message in context: http://www.nabble.com/rbind-ing-list-tf3140137.html#a8703373
Sent from t...
2011 Jun 17
3
rle on large data . . . without a for loop!
I think need to do something like this:
dat<-data.frame(state=sample(id=rep(1:5,each=200),1:3, 1000,
replace=T,prob=c(0.7,0.05,0.25)),V1=runif(1,10,1000),V2=rnorm(1000))
rle.dat<-rle(dat$state)
temp<-1
out<-data.frame(id=1:length(rle.dat$length))
for(i in 1:length(rle.dat$length)){
temp2<-temp+rle.dat$length[[i]]
out$V1[i]<-mean(dat$V1[temp:temp2])
out$V2[i]<-sum(dat$V2[temp:temp2])
out$state[i]<-rle.dat$value[[i]]
temp<-temp2
}
to a very large dataset. I want to apply a few summary functions to
some variables within a data.frame for given states. to complicate...
2010 Apr 06
3
[LLVMdev] How to get the left-hand operand of an instruction?
Hi,
I am a new novice of LLVM, and I want know how to get the left-hand operand
of an instruction?
For example:
how to get the %temp2 operand in the next instruction:
%temp2 = malloc i8, i32 %n
Thanks a lot!
Best Regards!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100406/be299269/attachment.html>
2009 May 28
2
Replace is leaking?
Okay, someone explain this behaviour to me:
Browse[1]> replace(rep(0, 4000), temp1[12] , temp2[12])[3925]
[1] 0.4462404
Browse[1]> temp1[12]
[1] 3926
Browse[1]> temp2[12]
[1] 0.4462404
Browse[1]> replace(rep(0, 4000), 3926 , temp2[12])[3925]
[1] 0
For some reason, R seems to shift indices along when doing this replacement.
Has anyone encountered this bug before? It seems to crop u...
2012 Jul 12
1
Cox proportional hazard model and coefficients
Hi,
Here is the summary-output of the Coxph-model I used (the output is based on
the best final model i.e. all significant explanatory variables and their
interactions are included):
coxph(formula = Y ~ LT + Food + Temp2 + LT:Food + LT:Temp2 +
Food:Temp2 + LT:Food:Temp2)
n= 555
coef exp(coef)
se(coef) z Pr(>|z|)
LT 9.302e+02 Inf 2.822e+02
3.297 0.000979 ***
Food...
2010 Nov 19
3
Sweave Dynamic Graph Question
...r(mfrow=c(4,3))
Temp1 <- IBM.Close[which(format(time(IBM.Close),"%Y")==yr),]
Temp3 <- tapply(Temp1[,1],as.yearmon(time(Temp1)),FUN=mean)
for(i in Smth:length(Temp3)){
i <- ifelse(i < 10, paste(0,i,sep=""),i)
Date <- paste(i,yr,sep="-")
Temp2 <- IBM.Close[which(format(time(IBM.Close),"%m-%Y")==Date),]
plot(time(Temp2),Temp2,type="l",main=paste(factor(as.numeric(i), labels =
month.name[as.numeric(i)]),yr,sep="-"))
}
}
# my sweave code (pass in IBM.Close)
\pagebreak
\subsection{Graph}
\begin{fig...
2010 Apr 06
0
[LLVMdev] How to get the left-hand operand of an instruction?
Hi Qiuping yi,
> I am a new novice of LLVM, and I want know how to get the left-hand
> operand of an instruction?
>
> For example:
> how to get the %temp2 operand in the next instruction:
>
> %temp2 = malloc i8, i32 %n
there is no left-hand side, temp2 is just a name for the instruction.
Since the LLVM IR is in SSA form, registers have exactly one definition,
and thus there is no point in distinguishing between a register and the
instruction t...
2006 Mar 03
1
NA in eigen()
...s in it. Here
is code, but of course it requires my original, 601x601 symmetric matrix
called mat
> any(is.na(mat))
[1] FALSE
> any(is.na(d))
[1] FALSE
> dim(mat)
[1] 601 601
> length(which(d==0))
[1] 5
> d<-rowSums(mat)
> temp1<-eigen(diag(d)-mat,symmetric=T)
> temp2<-eigen(diag(d)-mat,symmetric=T,EISPACK=T)
> any(is.na(temp1$vec))
[1] TRUE
> any(is.na(temp1$vec[,-52]))
[1] FALSE
> any(is.na(temp2$vec))
[1] FALSE
> all.equal(abs(temp1$vec[,-52]),abs(temp2$vec[,-52]))
[1] "Mean relative difference: 0.3278133"
> all.equal(temp1$v...
2010 Oct 17
4
how to convert string to object?
temp = "~aparch("
temp1 = paste(temp,1, sep = "")
temp2 = paste(temp1,1, sep = ",")
temp3 = paste(temp2, ")",sep = "")
temp 3 is a character but I want to convert to formula object. How do I do
this?
--
View this message in context: http://r.789695.n4.nabble.com/how-to-convert-string-to-object-tp2999281p2999281.html
Sent...
2011 Mar 09
2
Anomaly with unique and match
...mp,
+ stop = 10*temp + test1$time,
+ status = rep(test1$status,4),
+ x = c(test1$x+ 1:7, rep(test1$x,3)),
+ epoch = rep(1:4, rep(7,4)))
>
> fit1 <- coxph(Surv(start, stop, status) ~ x * factor(epoch), stest)
## New lines
> temp1 <- fit1$linear.predictor
> temp2 <- as.matrix(temp1)
> match(temp1, unique(temp1))
[1] 1 2 3 4 4 5 6 7 7 7 6 6 6 8 8 8 6 6 6 9 9 9 6 6
> match(temp2, unique(temp2))
[1] 1 2 3 4 4 5 6 7 7 7 6 6 6 NA NA NA 6 6 6 8 8 8
6 6
-----------------------
I've solved it for my code by not calling match on...
2010 May 28
2
if negative value, make zero
I have a data frame with both positive and negative values, and I want
to make all the negative values equal zero, so i can eventually take
an average.
I've tried
temp2 <- ifelse(tempr<0, 0, tempr)
but it doesn't seem to work.
Any suggestions?
Thanks!
2011 Mar 21
1
round, unique and factor
...a bigger change
the potential for breakage is higer, however.
Terry T.
tmt45% R --vanilla
R version 2.12.2 (2011-02-25)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-unknown-linux-gnu (64-bit)
> load('test.rda')
> ls()
[1] "temp2"
> temp2 <- round(temp2, 15)
> length(unique(temp2))
[1] 954
> length(table(temp2))
[1] 942
> .Machine$double.eps
[1] 2.220446e-16
> range(temp2)
[1] 0.0000 26.0397
Terry T.
2003 May 31
1
Minor problem with unwritable directories
...en I backup
/home). All directories that are not writable--even though
unchanged--will be sent again. [Note that unwritable files are not
transferred again--this only occurs with directories].
-- Set of commands to reproduce problem --
mkdir -p temp1/some/set/of/subdirectories/
mkdir temp2
chmod -R a-w temp1/some/set/of
rsync -av temp1/ temp2/
rsync -av temp1/ temp2/
-- Output from those commands --
# Note the 2nd rsync run and how unwritable directories are listed
# again
1190 newren@amr:~$ mkdir -p temp1/some/set/of/subdirectories/
1191 newren@amr:~$ mkdir temp2...
2013 Mar 07
5
multiple plots and looping assistance requested (revised codes)
Hi Irucka,
I tried it and was able to plot it without any errors.? Here, your code indicates you need two lines. temper[[i]][1]
?temper[[1]][1] # which is the column 1.
? Month
1???? 1
2???? 2
3???? 3
?temper[[1]][2]
#? Data1
#1?? 1.5
#2? 12.3
#3? 11.4
Suppose I use names(temper) instead of seq_along(temper)
pdf("irucka.pdf")
?lapply(names(temper),function(i)