# RE: [R] help for matrix formation.

From: Mulholland, Tom <Tom.Mulholland_at_dpi.wa.gov.au>
Date: Thu 17 Mar 2005 - 17:12:54 EST

# Create a vector with 2400 items
x <- runif(2400)

# Create a 600 by 4 matrix
y <- matrix(x,ncol = 4)

#If you needed the matrix to be done row by row #y <- matrix(x,ncol = 4,byrow = T)

# Extract values from a particular part of the matrix z <- y[500,3] #row 500 column 3
z

# Extract values that meet certain criterion z <- y[y < 0.01]
z

# Find postion of those that are extracted which(y < 0.01)

HTH, Tom

> -----Original Message-----
> From: Lakshmi Dhevi Baskar [mailto:lavanya_ldb2000@yahoo.co.in]
> Sent: Thursday, 17 March 2005 1:16 PM
> To: r-help-request@stat.math.ethz.ch
> Cc: r-help@stat.math.ethz.ch
> Subject: [R] help for matrix formation.
>
>
> Dear people,
>
> I've been trying to find a way to do the following.
>
> I have a data set in text file with 3 columns and 2400 rows.
> i tried to read the table as
>
> I would like to read the third column values (which has 2400
> value) and split them into matrix of size (600,4):
>
> as
> first 600 column values in first column in matrix and next
> 600 next values(600 to 1200) as values in second column in
> matrix and so on.
>
> and could you also suggest me how to retrieve those items in
> matrix like matrix(520,3) =0 ...
>
> thanks in advance for the help.
>
>
>
> ---------------------------------
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help