[R] accessing the ellements in an array and factors.

David Winsemius dwinsemius at comcast.net
Fri Jun 12 06:08:13 CEST 2015


Cross-posting to SO and Rhelp is deprecated.

On Jun 11, 2015, at 8:40 PM, Bogdan Tanasa wrote:

> Dear all,
> 
> please could you please with a simple question : I do have an array of 32
> elements, where each element is indexed by a name : eg :
> 
> list_triplet_wells <-c("A1:A2:A3", "A4:A5:A6 ",  "A7:A8:A9",   "A10:A11:A12
> ")
> xxx <-array(0, dim=4)
> dimnames(xxx) = list(list_triplet_wells)
> 
>> From another script, I have an output like :
> 
>> yyy
> [1]   A1:A2:A3    B4:B5:B6
> 31 Levels:   B4:B5:B6    A1:A2:A3  ...   F4:F5:F6
> 
> so yyy seems to be a factor type. I would need to call the elements of xxx
> array based on the elements of yyy; eg xxx[yyy].
> 
> How can I do this in order to circumvent the factor type of yyy ? Thanks a
> lot,
> 
> bogdan
> 
> 	[[alternative HTML version deleted]]
> 

As is posting in HTML.

> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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
Alameda, CA, USA



More information about the R-help mailing list