[R] Lists with numbers lists and strings

arun smartpink111 at yahoo.com
Fri Oct 18 18:37:42 CEST 2013


Hi,
Not sure this is what you wanted.
lstNew <- list(Spans, lapply(lapply(Spans,`[`,1),as.character) )
str(lstNew)
#List of 2
 $ :List of 3
  ..$ : num [1:2] 8.37e+08 8.42e+08
  ..$ : num [1:2] 8.32e+08 8.37e+08
  ..$ : num [1:2] 9.30e+08 9.35e+08
 $ :List of 3
  ..$ : chr "8.37e+08"
  ..$ : chr "8.32e+08"
  ..$ : chr "930100000"



A.K.




On Friday, October 18, 2013 11:48 AM, Alaios <alaios at yahoo.com> wrote:
Dear all,
I have a list that is created like that

Spans<-list( c(837e6,842e6), 
          c(832e6,837e6), 
          c(930.1e6,935.1e6)
          )



I would like to include a second list that will contain the string that would correspond to the numbers at the left side. 

I would like thus inside my list to have two sublists. The first onew would be the Spans and the second one the Caption list.

Could you please help me understand how I can do that?

Regards
Alex

    [[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.




More information about the R-help mailing list