Constructing scattering diagrams with pairs in R on a scale with data containing zeros

I am trying to build several pairs of scatterplots using "pairs". My data frame looks like this:

>e XYZ 0 0 0 2 3 4 0 3 4 3 3 3 

A completely standard data frame is here.

I use this to build my scatter plots, again, nothing special:

 pairs(~X+Y+Z, data=e, log="xy") 

It works great, but does not label. However, if I remove log = "xy" in the command, then the labels are displayed correctly. So I think this is because I want my scatterplots to be on a logarithmic scale.

So my question is: what should I do? Should I delete all lines with zeros in it in advance (how do you do this?) Is there a magic trick that will allow me to have log = "xy" and mark my scatterplots?

Please let me know if this is not clear.

+3
source share
1 answer

You ignored this (where I called your DF data frame):

 R> pairs(~X+Y+Z, data=df, log="xy") There were 30 warnings (use warnings() to see them) 

and if you look at these thirty warnings, you will see that

  • you cannot write data containing zeros on a log scale (and I think you know why)

  • log not a recognized parameter for pairs()

So, if you need a pair chart in the logs, you may have to take the logs yourself (and either add a little epsilon, or use a conversion like log(1 + x) and call pairs() for that data.

Edit The simplest, possibly pairs(~X+Y+Z, data=log(1+DF))

+7
source

All Articles