Hi Jojje,

Try this:

ekob=data.frame(PAP=seq(0,4,by=0.5),CAP=seq(1,5,by=0.5),FAP=seq(4,8,by=0.5))
attach(ekob)

# Option 1
ekob[PAP<1.5 & PAP>0.5 & CAP>1 & CAP<3 & FAP>4,]

# Option 2
subset(ekob,PAP<1.5 & PAP>0.5 & CAP>1 & CAP<3 & FAP>4)

HTH,

Jorge


On Thu, Apr 24, 2008 at 11:31 AM, Jojje Andersson <[EMAIL PROTECTED]>
wrote:

> Hello!
>
> Thanks!
>
> I changed the "," to "." in both datafile and code but the problem remains
> identical.
> Cheers!
> Jojje
>
>
>
>
> > Date: Thu, 24 Apr 2008 09:16:38 +0100> From: [EMAIL PROTECTED]> To:
> [EMAIL PROTECTED]> CC: r-help@r-project.org> Subject: Re: [R] Factor
> to numeric> > The decimal point in R is always '.', never ','.> > On Thu, 24
> Apr 2008, Jojje Andersson wrote:> > >> > Hello!> > I have a problem whith a
> data.frame. I want to make a subset where some of the variables have values
> within ceartain limits.> > The variables are proportions like 1,00, 0,54,
> 0,00 etc.> > I don't get it right as R take the variables for factors.> >>
> >> >> ekobsub1 <- subset(ekob, PAP>0,25 & PAP<0,6 & CAP>0,1 & CAP<0,6 &
> FAP>0,1)> > Error in `[.data.frame`(x, r, vars, drop = drop) : object "CAP"
> not found> > In addition: Warning message:> > In Ops.factor(PAP, 0) : > not
> meaningful for factors> >> >>
> ekobn<-as.numeric(as.character(ekob[["PAP"]]))> > Warning message:> > NAs
> introduced by coercion> >> >> > Thanks!> >> > /Jojje> >> >
> _________________________________________________________________> >
> [[elide!
>  d Hotmail spam]]> >> > px?sc_cmp2=JS_INT_SEMSN_NLPCV> > [[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.> >> > -- > Brian D.
> Ripley, [EMAIL PROTECTED]> Professor of Applied Statistics,
> http://www.stats.ox.ac.uk/~ripley/ <http://www.stats.ox.ac.uk/%7Eripley/>>
> University of Oxford, Tel: +44 1865 272861 (self)> 1 South Parks Road, +44
> 1865 272866 (PA)> Oxford OX1 3TG, UK Fax: +44 1865 272595
> _________________________________________________________________
> [[elided Hotmail spam]]
>
>        [[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.
>

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

Reply via email to