Bert Gunter wrote:
>
> Yes. Don't do this.
>
> (what you probably really want to do is fit a model with age as a factor,
> which can be done statistically e.g. by logistic regression; or
> graphically
> using conditioning plots, e.g. via trellis graphics (the lattice package).
> This avoids the
In the end after going at it from scratch...This worked out allright...
##set up data
age.cat<-seq(0,100,10)
year<-(1953:(1953+55))
dat.vec<-sample(1:10,(length(age.cat)*length(year)))
dat.matrix<-matrix(dat.vec,c(length(age.cat),length(year)))
rownames(dat.matrix)<-age.cat
colnames(
That code throws multiple errors. Can you at least test your code
before posting?
(And, again, please avoid using function names as names for your
objects.)
-- David.
On Apr 7, 2010, at 8:54 AM, moleps islon wrote:
So.. here we try again.
##generate dataset
age.cat<-seq(0,100,10)
year<-
So.. here we try again.
##generate dataset
age.cat<-seq(0,100,10)
year<-(1953:(1953+55))
data.vec<-sample(1:1,(age.cat*year))
data.matrix<-matrix(data.vec,c(length(age.cat),length(year))
rownames(data.matrix)<-age.cat
colnames(data.matrix)<-year
##divide into 5 year periods
age.div<-cut(y
On Apr 6, 2010, at 3:30 PM, David Winsemius wrote:
On Apr 6, 2010, at 9:56 AM, moleps islon wrote:
OK... next question.. Which is still a data manipulation problem so I
believe the heading is still OK.
##So now I read my population data from excel.
No, you read it from a text file and pro
On Apr 6, 2010, at 9:56 AM, moleps islon wrote:
OK... next question.. Which is still a data manipulation problem so I
believe the heading is still OK.
##So now I read my population data from excel.
No, you read it from a text file and providing the first ten lines of
that text file should
OK... next question.. Which is still a data manipulation problem so I
believe the heading is still OK.
##So now I read my population data from excel.
pop<-read.csv("pop.csv")
typeof(pop) ## yields a list where I have age-specific population rows
and a yearly column population, where the years are
Thx Erik,
I have no idea what went wrong with the other code snippet, but this one
works.. Appreciate it.
qta<- table(cut(age,breaks = seq(0, 100, by = 10),include.lowest =
TRUE),cut(year,breaks=seq(1950,2010,by=5),include.lowest=TRUE))
M
On 5. apr. 2010, at 21.45, Erik Iverson wrote:
> I d
I don't know what your data are like, since you haven't given a
reproducible example. I was imagining something like:
## generate fake data
age <- sample(20:90, 100, replace = TRUE)
year <- sample(1950:2000, 100, replace = TRUE)
##look at big table
table(age, year)
## categorize data
## see in
I already did try the regression modeling approach. However the epidemiologists
(referee) turns out to be quite fond of comparing the incidence rates to
different standard populations, hence the need for this labourius approach.
And trying the "cutting" approach I ended up with :
> table (age5)
You have tempted, and being weak, I yield to temptation:
"Any good ideas?"
Yes. Don't do this.
(what you probably really want to do is fit a model with age as a factor,
which can be done statistically e.g. by logistic regression; or graphically
using conditioning plots, e.g. via trellis graphics
?cut to create categories
?table to make the table
moleps wrote:
Dear R´ers.
I´ve got a dataset with age and year of diagnosis. In order to age-standardize the incidence I need to transform the data into a matrix with age-groups (divided in 5 or 10 years) along one axis and year divided into 5
12 matches
Mail list logo