of course, this only applies if you have,

 getOption("OutDec") == "."

In any case, follow David's suggestions.

baptiste

On 1 Jun 2009, at 23:20, baptiste auguie wrote:

your data *seems* to have an unusual decimal separator. That would
explain why the two-step conversion to numeric fails, while the brute
conversion to numeric always gives the factor integer codes.


I don't know where your data comes from (str() would be helpful in any
case), but if you read it using read.table consider the dec=","
argument.


connection <- textConnection(
          "caedois           b1           b2           b3
       1       0,033120395 -20,29478338 -0,274638864
       2     -0,040629634  74,54239889 -0,069958424
       5    -0,001116816   35,2398622  0,214327185"
)

d <- read.table(connection, head=T, dec=",")

str(d)

subset(d, d$b1>0)
#  caedois       b1      b2       b3
# 1       1 0.033120 -20.295 -0.27464

HTH,

baptiste


On 1 Jun 2009, at 22:34, Cecilia Carmo wrote:






 --- the forwarded message follows ---

From: Cecilia Carmo <cecilia.ca...@ua.pt>
Date: 1 June 2009 22:33:15 GMT+02:00
To: "markle...@verizon.net" <markle...@verizon.net>
Subject: Re: [R] subset dataframe/list


Doesn´t work neither!

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 done
coeficientes$b1<-as.numeric(as.character(coeficientes$b1))
And b1 was substituted by NA’s

Then I’ve done
coeficientes$b1<-as.numeric(coeficientes$b1)
And b1 was transformed in other numbers
    caedois   b1           b2           b3
1        1    38    -20,29478338 -0,274638864
2        2     7     74,54239889 -0,069958424
3        5     2     35,2398622  0,214327185
4       10    48
5       14    15  40,06560548 -0,081828338
6       15    31  0,969969409  0,102775555

Thanks anyway,
Cecília


Em Mon, 01 Jun 2009 13:11:48 -0500 (CDT)
markle...@verizon.net escreveu:
hi: when I sent you my solution,  I didn't realize that
you had factors. if you change the
factors  to characters as described in that email, and
then use my approach , i think it should still work.






On Jun 1, 2009, markle...@verizon.net wrote: Hi:

coeficientes[,(coeficientes[,"b1"] > 0)]

will i think give you all the rows of the object where
b1 is greater than zero.

I can't tell if coeficients is a data frame or a matrix
but the above should work in either case.





On Jun 1, 2009, 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 I’ve tried:
coefSelected<-subset(coeficientes,b1>0)
But I´ve got the following
Warning message:
In Ops.factor(b1, 0) : > not meaningful for factors

So I’ve 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.





<ATT00001.txt>

_____________________________

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag
______________________________


        [[alternative HTML version deleted]]

<ATT00001.txt>

_____________________________

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag

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

Reply via email to