Dear Cecilia, I have followed the replies you got and I found that, perhaps, what you are experiencing has something to do with the decimal symbol in your data.
Consider the following: # Reading the data as you sent it to the list x <- read.table(textConnection("caedois b1 b2 b3 1 1 0,033120395 -20,29478338 -0,274638864 2 2 -0,040629634 74,54239889 -0,069958424 3 5 -0,001116816 35,2398622 0,214327185 4 10 0,171875 5 14 0,007288399 40,06560548 -0,081828338 6 15 0,027530346 0,969969409 0,102775555"), header=TRUE, fill=TRUE) closeAllConnections() x$b1 # shows up as a factor as.numeric(as.character(x$b1)) # NA! Now, let's change the decimal symbol reading the data again BUT changing the name from "x" to "y": # Changing the decimal symbol y <- read.table(textConnection("caedois b1 b2 b3 1 1 0,033120395 -20,29478338 -0,274638864 2 2 -0,040629634 74,54239889 -0,069958424 3 5 -0,001116816 35,2398622 0,214327185 4 10 0,171875 5 14 0,007288399 40,06560548 -0,081828338 6 15 0,027530346 0,969969409 0,102775555"), header=TRUE, fill=TRUE, dec=",") # Here is the difference! closeAllConnections() y$b1 # it show up as numeric! :-) and with "y", here is what you asked early this afternoon: subset(y, b1>0) Now, from the data you have, a workaround would be x[,2:4] <- apply(x[,-1], 2, function(x) gsub(',','.', x) ) subset(x, b1>0) See ?gsub, ?read.table and ?subset for more information. HTH, Jorge On Mon, Jun 1, 2009 at 1:01 PM, Cecilia Carmo <cecilia.ca...@ua.pt> wrote: > Hi R-helpers! > > I have the following object: > >> head(coeficientes) >> > caedois b1 b2 b3 > 1 1 0,033120395 -20,29478338 -0,274638864 > 2 2 -0,040629634 74,54239889 -0,069958424 > 3 5 -0,001116816 35,2398622 0,214327185 > 4 10 0,171875 > 5 14 0,007288399 40,06560548 -0,081828338 > 6 15 0,027530346 0,969969409 0,102775555 > > I´ve tried to subset it like this: > >> coefSelected<-subset(coeficientes,"b1">0) >> > but it does nothing > > Then Ive tried: > >> coefSelected<-subset(coeficientes,b1>0) >> > But I´ve got the following > Warning message: > In Ops.factor(b1, 0) : > not meaningful for factors > > So Ive tried: > >> coefSelected<-subset(coeficientes,coeficientes$b1>0) >> > Warning message: > In Ops.factor(coeficientes$b1, 0) : > not meaningful for factors > > I´ve done > >> mode(coeficientes) >> > [1] "list" > > But I don´t know how to handle it! > Coul anyone help me? > Thanks, > > Cecília Carmo (Universidade de Aveiro Portugal > > ______________________________________________ > R-help@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. > [[alternative HTML version deleted]]
______________________________________________ R-help@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.