[R] Extracting data using subset function
Upananda Pani
up@n@nd@@p@n| @end|ng |rom gm@||@com
Sun Feb 5 15:07:03 CET 2023
Dear All,
I want to create a vector p and extract first 20 observations using subset
function based on logical condition.
My code is below
p <- 0:100
I know i can extract the first 20 observations using the following command.
q <- p[1:20]
But I want to extract the first 20 observations using subset function which
requires a logical condition. I am not able to frame the logical condition.
The code should be
q <- subset(p, logical condition)
I am not able to do it. Please let me know what you think.
Best regards,
Upananda
[[alternative HTML version deleted]]
More information about the R-help
mailing list