# [R] Decrete value check in a matrix

John Kane jrkrideau at inbox.com
Mon Jul 2 15:53:20 CEST 2012

```Glad it works.  So far we seem to have at least three ways to do it.  R is amazing!

John Kane

> -----Original Message-----
> From: antony.akkara at ge.com
> Sent: Mon, 2 Jul 2012 06:04:03 -0700 (PDT)
> To: r-help at r-project.org
> Subject: Re: [R] Decrete value check in a matrix
>
> Good. Its working fine.
>
> Thank you John !
>
>
>
> From: John Kane [via R]
> [mailto:ml-node+s789695n4635113h41 at n4.nabble.com]
> Sent: Monday, July 02, 2012 6:18 PM
> To: Akkara, Antony (GE Energy, Non-GE)
> Subject: Re: Decrete value check in a matrix
>
>
>
> You are not asking for a Decrete [sic]  (descrete) value check but
> rather if the numbers are intergers.
>
> Try this:
>
> # from the ?is.integer help page
> is.wholenumber <-
>     function(x, tol = .Machine\$double.eps^0.5)  abs(x - round(x)) < tol
>
>
> aa  <- data.frame( na = c( 1, 3.4, 5, 5.6), nb = c(2.4, 4, 6, 6.7))
> ww  <- data.frame(  is.wholenumber(aa))
> cbind(aa, ww)
>
> John Kane
>
>
>> -----Original Message-----
>> From: [hidden email]
>> Sent: Mon, 2 Jul 2012 03:04:48 -0700 (PDT)
>> To: [hidden email]
>> Subject: [R] Decrete value check in a matrix
>>
>> Hi All,
>>
>> Here i have an Dataframe (or) Matrix like this,
>>
>> MyMatrix <-
>> ABC          XYZ
>> ------        -------
>> 1              2.5
>> 3.4           4
>> 5              6
>> 5.6          6.7
>>
>> Here i need to check each column value having decrete value or not ?.
>> If that particular coulmn-value having decrete value, then the result
>> should
>> be
>> TRUE/FALSE respectively in the result column.
>> Finally, i need to get the result as  Dataframe (or) Matrix form like
>> this
>>
>> ABC          XYZ      ABC_RESULT               XYZ_RESULT
>> ------        -------     --------------------
>> --------------------
>> 1              2.5                 TRUE                       FALSE
>> 3.4           4                    FALSE                     TRUE
>> 5              6                    TRUE                        TRUE
>> 5.6          6.7                  FALSE                     FALSE
>>
>> - Can any one help me fast ?
>>
>> Antony.
>>
>
>
> ____________________________________________________________
> Easily monitor multiple email accounts & access them with a click.
> Visit http://www.inbox.com/notifier and check it out!
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
>
> ________________________________
>
> below:
>
> http://r.789695.n4.nabble.com/Decrete-value-check-in-a-matrix-tp4635090p
> 4635113.html
>
> To unsubscribe from Decrete value check in a matrix, click here
> <http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscrib
> e_by_code&node=4635090&code=YW50b255LmFra2FyYUBnZS5jb218NDYzNTA5MHwxNTUx
> OTQzMDI5> .
> NAML
> <http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_view
> er&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.Bas
> icNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.tem
> -instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemai
> l.naml>
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Decrete-value-check-in-a-matrix-tp4635090p4635118.html
> Sent from the R help mailing list archive at Nabble.com.
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help