Skip to content
Back to formatted view

Raw Message

Message-ID: <CA+jRDxDMG_zG4VaXXBZ7hmCkSTuOU+N-djDu76JD+MRr5rGRTQ@mail.gmail.com>
Date: 2017-09-22T16:04:22Z
From: Shane Carey
Subject: Subset
In-Reply-To: <519380DF-14BD-43AA-9FA0-E3F659AE6F88@utoronto.ca>

Super,

Thanks

On Fri, Sep 22, 2017 at 4:57 PM, Boris Steipe <boris.steipe at utoronto.ca>
wrote:

> > a <- c("<0.1", NA, 0.3, 5, "Nil")
> > a
> [1] "<0.1" NA     "0.3"  "5"    "Nil"
>
> > b <- as.numeric(a)
> Warning message:
> NAs introduced by coercion
> > b
> [1]  NA  NA 0.3 5.0  NA
>
> > b[! is.na(b)]
> [1] 0.3 5.0
>
>
> B.
>
>
> > On Sep 22, 2017, at 11:48 AM, Shane Carey <careyshan at gmail.com> wrote:
> >
> > Hi,
> >
> > How do I extract just numbers from the following list:
> >
> > a=c("<0.1",NA,0.3,5,Nil)
> >
> > so I want to obtain: 0.3 and 5 from the above list
> >
> > Thanks
> >
> >
> > --
> > Le gach dea ghui,
> > *Shane Carey*
> > *GIS and Data Solutions Consultant*
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > 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.
>
>


-- 
Le gach dea ghui,
*Shane Carey*
*GIS and Data Solutions Consultant*

	[[alternative HTML version deleted]]