[R] ifelse problem - bug or operator error

R. Michael Weylandt michael.weylandt at gmail.com
Fri Aug 24 23:50:57 CEST 2012


On Fri, Aug 24, 2012 at 4:46 PM, Jennifer Sabatier
<plessthanpointohfive at gmail.com> wrote:
> Hi Michael,
>
> No, I never use attach(), exactly for the reasons you state.  To do
> due diligence I did a search of code for the function and it didn't
> come up (I would have been shocked because I never us it!).
>
> Now that real data is up, does your suggestion still apply?  I am
> reading it now.
>

If you mean the data you sent to Peter, it got scrubbed by the list
servers as well (they are somewhat draconian, but appropriately so in
the long run). The absolute best way to send R data via email (esp on
this list) is to use the dput() function which will create a plain
text representation of your data _exactly_ as R sees it. It's a little
hard for the untrained eye to parse (I can usually get about 90% of
what it all means but there's some stuff with rownames = NA I've never
looked into) but it's perfectly reproducible to a different R session.
Then us having the same data is a simple copy+paste away.

For more on dput() and reproducibility generally, see
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

It could be the floating point thing (it's hard to say without knowing
how your data was calculated), but Rui seems to think not.

M

> Thanks,
>
> Jen
>
> On Fri, Aug 24, 2012 at 5:38 PM, R. Michael Weylandt
> <michael.weylandt at gmail.com> wrote:
>> Off the wall / wild guess, do you use attach() frequently? Not
>> entirely sure how it would come up, but it tends to make weird errors
>> like this occur.
>>
>> M
>>
>> On Fri, Aug 24, 2012 at 4:36 PM, Jennifer Sabatier
>> <plessthanpointohfive at gmail.com> wrote:
>>> Hi Rui,
>>>
>>> Thanks so much for responding but I think with my HTML problem the vn
>>> data you made must not be the same.  I tried running your code on the
>>> data (I uploaded a copy) and I got the same thing I had before.
>>>
>>> Jen
>>>
>>> On Fri, Aug 24, 2012 at 5:28 PM, Rui Barradas <ruipbarradas at sapo.pt> wrote:
>>>>
>>>> 165114 1 0  0 0 0  417313 1 0  3546 1 0  4613 1 0  225460 1 0  6417 1 1  23




More information about the R-help mailing list