Displaying 1 result from an estimated 1 matches for "ann_ind".
Did you mean:
an_id
2004 Aug 19
5
column names in data.frame
Dear R-help,
Please can someone explain how to put a column name on an output data.frame.
##Starting with a data.frame with 3 columns (d$Year, d$NoIndiv, d$wtd_tl)
yr_ind <- split (d$NoIndiv, d$Year)
yr_tl <- split (d$wtd_tl, d$Year)
ann_ind <- sapply (yr_ind, sum)
ann_tl <- sapply (yr_tl, sum)
av_tl <- ann_tl/ann_ind
d2<- data.frame (av_tl)
##This gives me a data.frame with columns, the second of which has a column
name (av_tl)
I have tried
> d2<- data.frame (year = x, av_tl)
> d2<- data.frame (x="year&...