Re: [R] Best practice: to factor or not to factor for float variables

2014-07-05 Thread MacQueen, Don
However, > format((0.1+0.2)) == format(0.3) [1] TRUE Which suggests that if you want to treat measured variables as categories, one way to do it is to format them first. Of course, one may have to control the format more carefully than above (if necessary, see for example ?formatC). merge() on

Re: [R] Best practice: to factor or not to factor for float variables

2014-07-04 Thread Sebastian Schubert
Hi Hadley, actually, I started with floating point numbers, ensured that the respective numbers are equal in R but I still got strange behaviour with dplyr's group_by: https://github.com/hadley/dplyr/issues/482 If I had to guess, I would suppose the source of this error somewhere in the C++ part

Re: [R] Best practice: to factor or not to factor for float variables

2014-07-04 Thread David Winsemius
Keep as numeric and group with cut(), Hmisc::cut2, or findInterval. The beauty of the functional language design is that you do not need to create a new factor variable. -- David Sent from my iPhone > On Jul 4, 2014, at 8:33 AM, Hadley Wickham wrote: > > Why not just round the floating poin

Re: [R] Best practice: to factor or not to factor for float variables

2014-07-04 Thread Hadley Wickham
Why not just round the floating point numbers to ensure they're equal with zapsmall, round or signif? Hadley On Fri, Jul 4, 2014 at 4:04 AM, Sebastian Schubert wrote: > Hi, > > I would like to ask for best practice advice on the design of data > structure and the connected analysis techniques. >

Re: [R] Best practice: to factor or not to factor for float variables

2014-07-04 Thread PIKAL Petr
riginal Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Sebastian Schubert > Sent: Friday, July 04, 2014 1:04 PM > To: r-help@r-project.org > Subject: [R] Best practice: to factor or not to factor for float > variables >

[R] Best practice: to factor or not to factor for float variables

2014-07-04 Thread Sebastian Schubert
Hi, I would like to ask for best practice advice on the design of data structure and the connected analysis techniques. In my particular case, I have measurements of several variables at several, sometimes equal, heights. Following the tidy data approach of Hadley Wickham, I want to put all data