Skip to content
Back to formatted view

Raw Message

Message-ID: <1385143122.87047.YahooMailNeo@web142601.mail.bf1.yahoo.com>
Date: 2013-11-22T17:58:42Z
From: arun
Subject: data manipulation

Hi,
You could use either:
names(which(sapply(lapply(neutral_classes,`%in%`,50),any)))
#[1] "B"


#or
vec1 <-unlist(neutral_classes)
?names(vec1) <- gsub("\\d+","",names(vec1))
?names(vec1)[vec1==50]
#[1] "B"



A.K.


Hi everyone. 
I have a list like this: 
neutral_classes = list(A = 71:100, B = 46:70, C = 21:45, D = 0:20) 
and I'm trying to return the letter of the named vector for with an integer belong. For example, B if I use the value 50. 
Any help would be greatly appreciated. 
Regards,Phil 		 	 ? 		 ?