Displaying 20 results from an estimated 1000 matches similar to: "lapply where each list object has multiple parts"
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,
2007 Feb 08
5
remove component from list or data frame
Sorry to ask such a simple question, but I can't find the answer after
extensive searching the docs and the web.
How do you remove a component from a list? For example say you have:
lst<-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,
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
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 ??? ??? ??? ??? ???
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 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 Jun 08
0
data
Hi,
Try this:
final3New<-read.table(file="real_data_cecilia.txt",sep="\t")
dim(final3New)
#[1] 5369??? 5
#Inside the split within split, dummy==1 for the first row.? For lists that have many rows, I selected the row with dummy==0 (from the rest) using the #condition that the absolute difference between the dimensions of those rows and the first row dimension was minimum
2008 May 07
3
use list elements to subtract values from the dataframe
Hi,
I have a dataframe wf existing of a header with different labels and beneath
the values of those labels :
wf:
label1 label2 ...
0,45 0,21
0,10 0,45
.... ....
I have a list
fl <- c("label2","label3",..)
Isn't possible to use the list elements in the list in order to subtract
values from the dataframe? like :
wf$fl[[1]]
When I do in R I get :NULL
2013 May 16
1
To List or Not To List
Dear R Helpers,
A few weeks ago I asked for some help on how to accomplish modifications
to data in a set of data frames. As part of that request I mentioned that
I realized that one way to accomplish my goal was to put the data frames
together in a list but that I was looking for a way to do it with data
frames and a loop because I "believe the better thing is to work df by df
for my
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 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 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
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 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 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="")))
2011 Sep 02
2
If NA Problem!
Hi All!
Please find code and the respective lists below. My problem: I specify the
case that lilwin[[p]] is not an NA and want the code found in iwish to be
returned ONLY for that case. Why do I get a list of length 2 (and why is
NULL the first element)? I understand that the code below is quite
senseless. I have run into a problem while working on a large project and
wanted to simplify it in
2012 Dec 21
2
ggplot2: setting martin
Is it possible to set the margin in ggplot2 to a fixed size? I create many
plots, and I want them to look the same.
Especially I want them to have the same left margin.
But
P<-ggplot()+geom_bar(aes(c("short label1","short
label2"),runif(2)))+coord_flip()
P<-creates a plot with another margin as
ggplot()+geom_bar(aes(c("very very very very long
2008 Dec 02
3
boxplot via plot command
Hi folks,
I've just discovered that the following code leads to boxplot (surprisingly to me).
Can anybody explain to me why? Is this documented somewhere? I've never
consider this option before.
x <- rnorm(300)
l <- c(rep("label1",100), rep("label2",50), rep("label3",150))
df <- data.frame(as.factor(l), x)
plot(df)
Thank you!
Antje
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 ...
..
..
2017 May 23
2
[imaptest] Explaining errors
Hi,
I'm an Apache James committer and we are curious to use imaptest in
order to validate our IMAP protocol implementation.
I'm using the nightlybuild : imaptest-20170506
I follow the examples given in the /T/ /est IMAP server compliancy/
examples https://imapwiki.org/ImapTest/Examples.
And I wanted to analyse the errors reported, here are some:
Error: user1 at james.org[11]: seq too