Re: [R] better code?
OK. How about the following: R> x1.df$d. <- as.Date(as.character(x1.df$d), format="%m/%d/%Y") R> sapply(x1.df, class) d x yd. "factor" "numeric" "numeric""Date" R> R> (byLH <- by(x1.df[2:3], x1.df$d., var)) x1.df$d.: 2005-01-01 x
Re: [R] better code?
Hi, Laura: How about the following: > sapply(x1.df, class) d x y "factor" "numeric" "numeric" > (byLH <- by(x1.df[-1], x1.df$d, var)) x1.df$d: 1/1/2005 x y x 1.272688 -0.783719 y -0.783719 0.884866 ---