Displaying 20 results from an estimated 39 matches for "lst2".
Did you mean:
lst
2007 Feb 08
5
remove component from list or data frame
...t;-c(5,6,7,8,9)
How do you remove, for example, the third component in the list?
lst[[3]]]<-NULL generates an error: "Error: more elements supplied
than there are to replace"
Also, how do you remove a row from a data frame? For example, say you
have:
lst1<-c(1,2,3,4,5)
lst2<-c(6,7,8,9,10)
frame<-data.frame(lst1,lst2)
How do you remove, for example, the second row of frame?
Thanks,
- Jason
2013 Apr 10
6
means in tables
Hi.
I have 2 tables, with same dimensions (8000 x 5). Something like:
tab1:
V1 V2 V3 V4 V5
14.23 1.71 2.43 15.6 127
13.20 1.78 2.14 11.2 100
13.16 2.36 2.67 18.6 101
14.37 1.95 2.50 16.8 113
13.24 2.59 2.87 21.0 118
tab2:
V1 V2 V3 V4 V5
1.23 1.1 2.3 1.6 17
1.20 1.8 2.4 1.2 10
1.16 2.6 2.7 1.6 11
1.37 1.5 2.0 1.8 13
1.24 2.9 2.7 2.0 18
I need generate a table of averages, the
2013 Apr 13
2
Comparison of Date format
...-lapply(seq_len(nrow(DataB)),function(i) {x1<-unlist(mapply(function(x,y) which(x==y),DataA[,3:4],DataB[i,2]));x2<-if(length(x1)==2) DataA[x1[which.min(x1)],!names(DataA)%in%names(x1[which.max(x1)])] else if(length(x1)==1) DataA[x1,c("ID","Status",names(x1))] else NULL})
?lst2<-lapply(lst1,data.frame)
lst2<-lst2[lapply(lst2,nrow)!=0]
?lst2
#[[1]]
#? ID Status??? Date2
#3? 1????? A 3-Sep-01
#[[2]]
#? ID Status???? Date2
#5? 1????? C 26-Feb-04
#[[3]]
#? ID Status??? Date1
#9? 2????? A 6-Mar-02
library(plyr)
?dataNew<-do.call(rbind,lapply(lst2,function(x) {colnam...
2008 Oct 01
3
lapply where each list object has multiple parts
...to take the mean of just one part of each object. Is it possible to do
this with lapply? If not, can you recommend another function? Thanks.
eric
> x1 <- c(0,1,2,3)
> x2 <- c(7,8)
> x3 <- c(2,6,6,8)
> x4 <- c(4,8)
>
> Lst1 <- list(label1 = x1,label2 = x2)
> Lst2 <- list(label1 = x3, label2 = x4)
>
> BigList <- list(Lst1, Lst2)
>
> lapply(BigList$label1, mean)
list()
>
[[alternative HTML version deleted]]
2007 Jul 18
1
Neuman-Keuls
hello,
I have programmed this function to calculate the Neuman-Keuls test but I have a problem the function return an empty list and I don't know why.
summary(fm1)
E <- sqrt((summary(fm1)[[1]]["Residuals","Mean Sq"])/length(LR))
lst <- list()
lst1 <- list()
lst2 <- list()
NK <- function (x) {
if (length(x) == 2) {
Tstudent <- t.test(subset(exple, groupe == names(x)[1])$vd,subset(exple, groupe == names(x)[2])$vd)
t <- as.numeric(Tstudent$statistic)
if (t >= Tstudent$conf.int[1:2][1] & t <= Tstudent$conf.int[1:2][2]) {
lst1[[...
2013 Sep 05
2
binary symmetric matrix combination
Hi,
May be this helps:
m1<- as.matrix(read.table(text="
y1 g24
y1 0 1
g24 1 0
",sep="",header=TRUE))
m2<-as.matrix(read.table(text="y1 c1 c2 l17
?y1 0 1 1 1
?c1 1 0 1 1
?c2 1 1 0 1
?l17 1 1 1 0",sep="",header=TRUE))
m3<- as.matrix(read.table(text="y1 h4??? s2???? s30
?y1 0 1 1 1
?h4 1 0 1 1
?s2 1 1 0 1
?s30 1 1 1
2013 Sep 20
3
search species with all absence in a presence-absence matrix
Dear list
I have a matrix composed of islandID as rows and speciesID as columns.
IslandID: Island A, B, C….O (15 islands in total)
SpeciesID: D0001, D0002, D0003….D0100 (100 species in total)
The cell of the matrix describes presence (1) or absence (0) of the species
in an island.
Now I would like to search the species with absence (0)
in all the islands (Island A to Island O.)
2013 Aug 25
1
Capturing the whole output using R
Hi,
May be this helps:
#Creating some dummy data.?
set.seed(24)
lst1<-lapply(1:8,function(x) ts(sample(1:25,20,replace=TRUE)))
set.seed(49)
lst2<-lapply(1:8,function(x) ts(sample(1:45,20,replace=TRUE)))
??Find_Max_CCF()
#No vignettes or demos or help files found with alias or concept or
#title matching ?Find_Max_CCF? using regular expression matching.
Found a function with the same name from
http://r.789695.n4.nabble.com/ccf-functi...
2013 Nov 08
2
making chains from pairs
Hello,
having a data frame like test with pairs of characters I would like to
create chains. For instance from the pairs A/B and B/I you get the vector A
B I. It is like jumping from one pair to the next related pair. So for my
example test you should get:
A B F G H I
C F I K
D L M N O P
> test
V1 V2
1 A B
2 A F
3 A G
4 A H
5 B F
6 B I
7 C F
8 C I
9 C K
10 D L
2013 Jun 08
0
data
...lied the first #constraint).? I guess you wanted to select only a pair of rows (dummy=0 and dummy=1) for each lists.
fun1<- function(dat,percent,number){???
??? lst1<- split(dat,list(dat$year,dat$industry))
??? lst1New<- lapply(lst1,function(x) x[!(all(x$dummy==0)|all(x$dummy==1)),])
??? lst2<- lst1New[lapply(lst1New,nrow)>0]
??? lst3<- lapply(lst2,function(x){
??? ??? ??? ??? lapply(x$dimension,function(y){
??? ??? ??? ??? ? x1<- x[(y < (x$dimension+(x$dimension*percent))) & (y > (x$dimension-(x$dimension*percent))),]??? ???
??? ??? ??? ??? })???
??? ??? ??? ???...
2013 Apr 18
6
count each answer category in each column
Hey,
Is it possible that R can calculate each options under each column and
return a summary table?
Suppose I have a table like this:
Gender Age Rate
Female 0-10 Good
Male 0-10 Good
Female 11-20 Bad
Male 11-20 Bad
Male >20 N/A
I want to have a summary table including the information that how many
answers in each category, sth like this:
X
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)),])
??? lst4<- lst3[lapply(lst3,nrow)!=0]
??? lst5<- lapply(seq_along(lst4),function(i){
??? ??? ??? ??? ???? do.call(rbind,lapply(which(lst...
2013 May 02
3
R issue with unequal large data frames with multiple columns
I'm a bit of an amateur R programmer. I can do simple R scenarios but my
handle on complex grammatical issues isn't steady.
I have 12 CSV files that I've read into dataframes. Each has 8 columns and
over 2000000 rows. Each dataframe has data associated by time component
and a date component in the format of:
X.DATE and then X.TIME
X.DATE is in the format of MMDDYYYY and X.TIME is
2006 Jul 26
1
.Call question
Writing R Ext says to treat R objects that are arguments to .Call as
read only (i.e. don't modify).
I have a long list of lists that and I want to avoid the overhead of a
copy in my C code. I would just like to modify some of the elements
of list by replacing them with elements of exactly the same size/type.
below is an example of the essence of the problem. This seems to work.
Is this
2013 Mar 10
0
max row
...t;>>>data.frame(Qm2,Qn2)}))
>>>>
>>>>res5<-cbind(res3,res4)
>>>>head(res5,5)
>>>>
>>>>################################################# calculate cumulative sum #################################
>>>>
>>>>lst2<- split(res5,list(res5$m1,res5$n1,res5$m,res5$n))
>>>>
>>>>res5<-do.call(rbind,lapply(lst2[lapply(lst2,nrow)!=0],
>>>>function(x){?
>>>>x[,21:26]<-NA;?
>>>>x[,21:22][x$Qm2<=c1 & x$Qm>c11,]<-cumsum(x[,17:18][x$Qm2<=...
2013 Jun 07
4
matched samples, dataframe, panel data
I R-helpers
#I have a data panel of thousands of firms, by year and industry and
#one dummy variable that separates the firms in two categories: 1 if the firm have an auditor; 0 if not
#and another variable the represents the firm dimension (total assets in thousand of euros)
#I need to create two separated samples with the same number os firms where
#one firm in the first have a corresponding
2009 Sep 29
1
Comparing vectors from lists
Hi guys,
I still did not solve my problem properly! I have to compare the values of two lists of 250 numbers as a result of using the ?by function!
List1 of 250
$ 0 : num [1:28] 22 11 31...
$ 1 : num [1:15] 12 14 9 ...
..
..
..
- attr(*, "dim")= int 250
- attr(*, "dimnames")=List of 1
List2 of 250
$ 0 : num [1:24] 20 12 22...
$ 1 : num [1:17] 11 12 19 ...
..
..
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)),])
??? lst4<-lapply(lst3,function(x) {vect.brutal=c()
??? ??? ??? ??? for(line in which(x$evnmt_brutal==1)){
??? ??? ??? ??? ?? if(x$evnmt_bru...
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)),])
??? lst4<- lst3[lapply(lst3,nrow)!=0]
??? lst5<- lapply(seq_along(lst4),function(i){
???????????????????? do.call(rbind,lapply(which(lst...
2002 Nov 28
4
Mime-Version: 1.0
I am using expression() to incorporate text into graphics. To create a
superscript, I use the '^' character. Can someone please tell me the
character to use to create a subscript?
Thank you
-----------------------------------------------------
Christine Donnelly
Statistical Consulting Unit
The Graduate School
John Dedman Mathematical Sciences Building (Bldg 27)
Australian National