similar to: using table and tapply?

Displaying 20 results from an estimated 1000 matches similar to: "using table and tapply?"

2010 Jun 21
0
using table and tapply? solved
Here is my solution: tapply(zzz$DEATH1,zzz$GENDER,sum, na.rm=TRUE) Dear R People: Here is a little section of a data frame: > zzz[1:10,] DATE GENDER AGE Co DEATH1 3945 2009-04-16 M 24 Botulinic 23 3851 2009-04-16 M 35 Constitutional 23 8495 2009-04-16 F 49 Constitutional 27 10967 2009-04-16 F 47 Constitutional
2010 Jun 22
2
constructing a data frame from ftable
Dear R People: I have the following data set with the columns DATE, GENDER, and Co. Co has 8 possible options. > a.df[1:10,] DATE GENDER Co 1 2009-04-16 F Rash 2 2009-04-16 F Other 3 2009-04-16 M Botulinic 4 2009-04-16 M Other 5 2009-04-16 M Constitutional 6 2009-04-16 F Other 7 2009-04-16
2009 Mar 10
2
simple question beginner
  Hi there,   I am beginner in R and I have some basic question. Suppose I run a common procedure such as a t test or cox model like below:   out<-coxph( Surv(tstart,tstop, death1) ~ x1+x1:log(tstop+1) , test1,method=c("breslow"))    Which yields the following result:   Call: coxph(formula = Surv(tstart, tstop, death1) ~ x1 + x1:log(tstop +     1), data = test1, method =
2006 Jul 04
1
using weights in lrm
Dear all, just a quick question regarding weights in logistic regression. I do results <- lrm(y.js ~ h.hhsize + h.death1 + h.ill1 + h.ljob1 + h.fin1 + h.div1 + h.fail1 + h.sex + h.ch.1
2009 Sep 21
2
cox memory
Hi there, I have a rather large data set and perform the following cox model: test1 <- list(tstart,tstop,death1,chemo1,radio1,horm1) out1<-coxph( Surv(tstart,tstop, death1) ~ chemo1+chemo1:log(tstop+1)+horm1+horm1:log(tstop+1)+age1+grade1+grade1:log(tstop+1)+positive1+positive1:log(tstop+1)+size1+size1:log(tstop+1), test1) out1 Up to here everything works fine (with each covariate
2010 Jun 21
2
difference in dates
Dear R People: I have a data frame with the two following date columns: > a.df[1:10,c(1,6)] DATE DEATH 1207 2009-04-16 2009-05-06 1514 2009-04-16 2009-05-06 2548 2009-04-16 2009-05-08 3430 2009-04-16 2009-05-09 3851 2009-04-16 2009-05-09 3945 2009-04-16 2009-05-09 7274 2009-04-16 2009-05-12 7532 2009-04-16 2009-05-12 7651 2009-04-16 2009-05-12 8495 2009-04-16 2009-05-13 >
2009 Jan 26
1
Sweave'ing Danish characters
Hi, I am writing an Sweave document and am using 'xtable' to make frequency tables of diagnoses of people undergoing cholecystectomy. Some of these diagnoses contain Danish characters ("?", "?", and "?"), and these characters are all garbled in the Latex document after I run Sweave. The odd thing is, everything looks absolutely right in the R console, and if
2011 Jul 06
2
wgcna
Hi, I'm running a tutorial ("Meta-analyses of data from two (or more) microarray data sets"), which use wgcna package. I have an error in the function modulePreservation (it is below). I'm using R2.13 Can you help me? Do you know, what is happens? Thanks Raquel multiExpr = list(A = list(data=t(badea)),B = list(data=t(mayo))) # two independent datasets (dim = 13447 x 36) mp =
2010 May 26
2
sequential treatment of a vector for formula
Please pardon the simplicity of this question of biological nature. I'm trying to calculate a statistic, px, the proportion of a cohort that survives through the interval x:x+1. I have the vector from which the calc is to be made but I can't figure out how to tell R to take the current value and divide it by the next value. The formula is P0=L1/LO The following is an example of the
2006 Feb 27
1
Different deviance residuals in a (similar?!?) glm example
Dear R-users, I would like to show you a simple example that gives an overview of one of my current issue. Although my working setting implies a different parametric model (which cannot be framed in the glm), I guess that what I'll get from the following example it would help for the next steps. Anyway here it is. Firstly I simulated from a series of exposures, a series of deaths (given a
2011 Jul 09
3
Basic vector logic not working
I am interning in a computer science lab and I'm very new to R. The language basics are clear, but this particular problem isn't: I have a very large dataframe called "data" which holds data from Halo matches. I'm trying to analyze a certain window such that data$deaths>20 and data$deaths<=27. When I enter the line kills = data$kills[data$deaths>20] or any single
2009 Sep 01
2
Basic population dynamics
Hello, For insect mortality data I'm trying to get an R script that will take the data from the raw form and convert it to Lx (% survival) for a number of treatments. The raw data has the number of days lived for each individual for the respective treatment. Thus, for example, when R selects the data for a single treatment I end up with the following vectors: >day=seq(from=0,to=6)
2004 Jan 01
1
Barplot errors in MASS script
Reading "Modern Applied Statististics with S" and trying the corresponding examples both in the book and in ../lib/R/library/MASS/script, I'm now trying chapter 4 plotting bars with the following code on a linux box with R 1.8.1: ---------------------- library(MASS) library(lattice) options(echo=T, width=65, digits=5) lung.deaths <- aggregate(ts.union(mdeaths, fdeaths), 1)
2007 May 01
1
Levels attribute in integer columns created by model.frame()
The following is evidence of what is surely an undesirable feature. The issue is the handling, in calls to model.frame(), of an explanatory variable that has been derived as an unclassed factor. (Ross Darnell drew this to my attention.) ## Data are slightly modified from p.191 of MASS > worms <- data.frame(sex=gl(2,6), Dose=factor(rep(2^(0:5),2)), +
2003 Mar 10
1
Problem with example(medpolish) in R-devel
Today's R-devel has a problem in `example(medpolish)'. It appears that the `plot.medpolish' method is not available. Here is the output and traceback() after starting `R --vanilla': > library(eda) > example(medpolish) mdplsh> deaths <- rbind(c(14, 15, 14), c(7, 4, 7), c(8, 2, 10), c(15, 9, 10), c(0, 2, 0)) mdplsh> dimnames(deaths) <-
2001 Nov 24
2
horsekicks
Dear friends. I have these well known data on horsekicks: years <- c(109, 65, 22, 3 , 1, 0) deaths <- 0:5 and get a nice but wrong fit from summary(z1 <- glm(years~deaths,family=poisson)) Can I take away the intercept ? Best wishes Troels Ring, Aalborg -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read
2011 Jul 24
1
Histogram of a dataframe subset failing
Like most help forum users, I'm very new to R. I've been having this problem: I started with a dataframe called fullData. With the subset command, I split it into two separate dataframes, soloData and teamData. The hist() function works when I use... hist( subset(fullData, fullData$playlist_id==4 )$deaths) ...the exact call to subset() that I used to create each dataframe. However,
2009 Nov 14
2
formatting dates in axis labels (ggplot2)
I'm having trouble figuring out how to format Date variables when used as axis labels in graphs. The particular case here is an attempt to re-create Nightingale's coxcomb graph with ggplot2, where I'd like the months to be labeled as "Mar 1885", "Apr 1885", using a date format of "%b %Y" applied to label the dates, or really anything other than
2011 May 26
5
Survival: pyears and ratetable: expected events
Dear all, I am having a (really) hard time getting pyears to work together with a ratetable to give me the number of expected events (deaths). I have the following data: dos, date of surgery, as.Date dof, date of last follow-up, as.Date dos, date of surgery, as.Date sex, gender, as.factor (female,male) ev, event(death), 0= censored at time point dof, 1=death at time point dof Could someone
2006 Jul 21
1
Parameterization puzzle
Consider the following example (based on an example in Pat Altham's GLM notes) pyears <- scan() 18793 52407 10673 43248 5710 28612 2585 12663 1462 5317 deaths <- scan() 2 32 12 104 28 206 28 186 31 102 Smoke <- gl(2,1,10,labels=c("No","Yes")) Age <- gl(5,2,10,labels=c("35-44","45-54","55-64","65-74","75-84"),