[R] 4D data acsess

David Winsemius dwinsemius at comcast.net
Thu Jun 30 00:02:14 CEST 2011


On Jun 29, 2011, at 4:56 PM, katarv wrote:

> Hi Sarah,
>
> I use readMat function, from R.matlab function.
>
> str(X) tells that
>
> X : num [1:64, 1:64, 1:21, 1:300]  as I said, the first 3 columns  
> are x,y,z
> coordinates. And I need all values in the last column correcponding  
> to a
> given (x,y,z) coordinate.

You should be able to access those values with:

X[1,1,1, ]

or equivalently:

X[1,1,1,1:300]

>
> if you list the values of X,

> then they are non zero, but for some reason R
> tells that dim(X): NULL

Now that seems a bit odd. What happens if you try:

Y <- X
dim(Y) <- c(64,64,21,300)
Y[ 1, 1, 1, ]

>
> --
> View this message in context: http://r.789695.n4.nabble.com/4D-data-acsess-tp3633552p3634004.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list