similar to: Capturing the whole output using R

Displaying 20 results from an estimated 300 matches similar to: "Capturing the whole output using R"

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,
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
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)),])
2008 Oct 01
3
lapply where each list object has multiple parts
Hi. I have a list where each object in the list has multiple parts. I'd like 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 <-
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 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 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 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 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 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 Jun 30
0
Help: argument is not numeric or logical: returning NA
Hi, One problem with your example dataset is that you have 11 list elements with the last one having different dimensions.? I think it was based on `summarized`. Then, the second problem I encountered for testing is that the dataset you provided doesn't fulfill the criteria. lst1<- list(structure(list......) #output of dput ? lst2<- lst1[1:10] #deleted the last list element
2013 May 22
0
calcul of the mean in a period of time
Hi, I guess you meant this: 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 2?????????????????????
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
2004 Jul 06
2
lme: extract variance estimate
For a Monte Carlo study I need to extract from an lme model the estimated standard deviation of a random effect and store it in a vector. If I do a print() or summary() on the model, the number I need is displayed in the Console [it's the 0.1590195 in the output below] >print(fit) >Linear mixed-effects model fit by maximum likelihood > Data: datag2 > Log-likelihood:
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
2012 Jan 11
3
turning a list of vectors into a data.frame (as rows of the DF)?
As a newer R practicioner, it seems I stump myself weekly (at least) with issues that have spinning my wheels.  Here is yet another... I'm trying to turn a list of numeric vectors (of uneual length) inot a dataframe.  Each vector held in the list represents a row, and there are some rows of unequal length.  I would like NAs as placeholders for "missing" data in the shorter vectors. 
2014 Apr 21
3
Loops (run the same function per different columns)
Hi, Using the example data from library(gvlma) library(gvlma) data(CarMileageData) CarMileageNew <- CarMileageData[,c(5,6,3)] ?lst1 <- list() ?y <- c("NumGallons", "NumDaysBetw") ?for(i in seq_along(y)){ ?lst1[[i]] <- gvlma(lm(get(y[i])~MilesLastFill,data=CarMileageNew)) ?lst1} pdf("gvlmaplot.pdf") ?lapply(lst1,plot) dev.off() You could also use
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 24
1
Divide the data into sub data on a particular condition
Hi, Use ?split() #dat1 is the dataset: lst1<- split(dat1,dat1$BaseProd) lst1 #$`2231` ?# BaseProd? CF OSA #1???? 2231 0.5 0.7 #2???? 2231 0.8 0.6 #3???? 2231 0.4 0.8 # #$`2232` ?# BaseProd CF OSA #4???? 2232? 1?? 2 #5???? 2232? 3?? 1 # #$`2233` ?# BaseProd? CF OSA #6???? 2233 0.9 0.5 #7???? 2233 0.7 0.5 #8???? 2233 4.0 5.0 #9???? 2233 5.0 7.0 lst1[[1]] #? BaseProd? CF OSA #1???? 2231 0.5 0.7
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