[R] Help its urgent

Joshua Wiley jwiley.psych at gmail.com
Sat Oct 2 03:03:11 CEST 2010


Hi Josue,

This should help, you are almost there.

# consider this
dat <- c(1, 2)
# passing TRUE/FALSE to the extraction function
dat[c(TRUE, FALSE)]

# Now moving to an array
# Create an array with dimensions 100, 13 filled with random normal numbers
dat <- array(data = rnorm(100*13), dim = c(100, 13))
# Now apply the principle above to the array
# the logical test returns TRUE/FALSE, which is used to select from column 1
dat[ ,1][dat[ ,1] < 0]

# for the entire dataset
dat[dat < 0]

Cheers,

Josh

On Fri, Oct 1, 2010 at 5:52 PM, Josue Nuñez Rico <josue_n_r at hotmail.com> wrote:
>
> Hi I am student of Masters and wanted to know if you can help with a problem I have.  I have an array of 100 * 13 and need to extract all values of that array that are less than a value p = x, insert this code data = c (dat [, 1]> = p1), but only and managed to tell me if is false or true that the data in "column 1" of Table "dat" is greater than p1 and what I need is to extract the values from the table.
> urgent
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/



More information about the R-help mailing list