Displaying 2 results from an estimated 2 matches for "supton".
Did you mean:
upton
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
2006 Apr 22
1
factor levels on import
I have a data frame that I plan on importing from a file (there are
other columns of numeric data):
> xy
x y
1 1 1
2 1 1
3 1 1
4 1 1
5 2 2
6 2 2
7 2 2
8 2 2
>
where x is a column of factors, and y is a column of factors, that have
different levels, e.g.,
> x
[1] low low low low hi hi hi hi
Levels: low hi
> y
[1] med med med med medhi medhi medhi medhi
Levels: med