Skip to content

Selecting names with regard to visit frequency

1 message · arun

#
Hi Michael,


It is not clear how you read the dataset.? It looks like a dataframe.
df1<- read.table(text='
"","x" 
"A1",2 
"A2",5 
"A3",4 
"A4",6 
"A5",24 
"A6",7 
"A7",12 
"A8",3 
"A9",5
',sep=",",header=TRUE,row.names=1)
?vec1<-unlist(df1)
?names(vec1)<- row.names(df1)
?names(vec1)[vec1%in% 3:5]
#[1] "A2" "A3" "A8" "A9"
?names(vec1)[!is.na(match(vec1,3:5))]
#[1] "A2" "A3" "A8" "A9"
names(vec1)[vec1>=3 & vec1<=5]
#[1] "A2" "A3" "A8" "A9"
A.K.