On Aug 16, 2010, at 5:53 AM, Lily_stats wrote:


Dear all,

I have an xts object , t.xts with 4 columns: "v1" "DD1" "v2" "DD2" and
created a data frame :

t <- as.data.frame(t.xts)

"t" is not the best choice of names for an object because it is the name of a commonly used function

Let's instead assume you used "tt". Try:

tt[which(tt$DD1 >0 & tt$DD1 < 30), "v1"]

Or:

subset(tt, subset=which(tt$DD1 >0 & tt$DD1 < 30), select="v1")


I would like to extract data and create a new data frame for when the values in column DD1 falls between 0 and 30 and extract the corresponding v1 value.

How can I do this?

Thanks.


David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to