[R] (no subject)
Nolwenn Le Meur
nolwenn.lemeur at nantes.inserm.fr
Wed Aug 6 12:44:36 CEST 2003
Hi everybody,
Hope your are not all on holyday because I've got a problem that is going to
drive me crazy...
I would like to remove some rows from a dataframe. The rows correspond to
some
specific indexes which I can get by looking at the name in the first column
of my dataset. But I manage to get only the opposite of what I really want
(function #1)
#Function#1:
remove.func<-function(data){
Name<-as.character(data[,1])
indexZZ<-grep("ZZ",Name,value=FALSE)
data<-data[indexZZ,] # give me what I don't want
print(slide)
}
#Function#2:
remove.func<-function(data,Name){
Name<-as.character(data[,1])
indexZZ<-grep("ZZ",Name,value=FALSE)
data<-data[!indexZZ,] #doesn't work, give an empty dataframe
print(slide)
}
Thanks :|
Nolwenn Le Meur
********************************************
Nolwenn Le Meur
INSERM U533
Faculté de médecine
1, rue Gaston Veil
44035 Nantes Cedex 1
France
Tel: (+33)-2-40-41-29-86 (office)
(+33)-2-40-41-28-44 (secretary)
Fax: (+33)-2-40-41-29-50
mail: nolwenn.lemeur at nantes.inserm.fr
More information about the R-help
mailing list