Re: [R] Mapping 2D to 3D

2020-09-18 Thread Jeff Newmiller
When dealing with a 2-d density plot, the z variable is a predefined function 
of your x and y data, it is not something you can specify. If you want to 
specify z, then you need to use geom_contour. You appear to need to study the 
theory of kernel density estimates, which is off topic here. (Technically 
contributed packages like ggplot2 are off topic here also, though sometimes 
people will answer questions about them anyway.)

On September 18, 2020 6:34:43 PM PDT, H  wrote:
>On 09/18/2020 02:26 AM, Jeff Newmiller wrote:
>> No, but fortunately you are off in the weeds. Density has an
>internally-computed "z" coordinate... you should be looking at
>?geom_contour.
>>
>> On September 17, 2020 7:17:33 PM PDT, H 
>wrote:
>>> I am trying to understand how to map 2D to 3D using ggplot() and
>>> eventually plot_gg(). I am, however, stuck on understanding how to
>>> express the third variable to be mapped. This example:
>>>
>>> ggdiamonds = ggplot(diamonds, aes(x, depth)) +
>>> stat_density_2d(aes(fill = stat(nlevel)),
>>> geom = "polygon", n = 100, bins = 10,contour = TRUE) +
>>> facet_wrap(clarity~.) +
>>> scale_fill_viridis_c(option = "A")
>>>
>>> uses a variable nlevel that I now understand is calculated during
>the
>>> building of the ggplot but I have not figured out from where it is
>>> calculated or how to specify a variable of my choosing.
>>>
>>> Does anyone have a good reference for understanding how to specify
>this
>>> variable? Most examples on the 'net seem to use the same dataset but
>do
>>> not specify this particular aspect...
>>>
>>> __
>>> R-help@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.
>
>But looking at the code in my message above, how does one know what
>stat(nlevel) refers to? What if I wanted to map another variable in
>this particular dataset??
>
>__
>R-help@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.

-- 
Sent from my phone. Please excuse my brevity.

__
R-help@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.


Re: [R] Mapping 2D to 3D

2020-09-18 Thread H
On 09/18/2020 03:08 AM, Carlos Ortega wrote:
> Hi,
>
> There are some further references in the own "RStudio Community" and in 
> StackOverflow:
>
>   * https://community.rstudio.com/t/options-to-stat-density-2d/792/4
>   * 
> https://stackoverflow.com/questions/32206623/what-does-level-mean-in-ggplotstat-density2d
>
> Kind Regards,
> Carlos.
>
>
> On Fri, Sep 18, 2020 at 4:17 AM H  > wrote:
>
> I am trying to understand how to map 2D to 3D using ggplot() and 
> eventually plot_gg(). I am, however, stuck on understanding how to express 
> the third variable to be mapped. This example:
>
> ggdiamonds = ggplot(diamonds, aes(x, depth)) +
> stat_density_2d(aes(fill = stat(nlevel)),
> geom = "polygon", n = 100, bins = 10,contour = TRUE) +
> facet_wrap(clarity~.) +
> scale_fill_viridis_c(option = "A")
>
> uses a variable nlevel that I now understand is calculated during the 
> building of the ggplot but I have not figured out from where it is calculated 
> or how to specify a variable of my choosing.
>
> Does anyone have a good reference for understanding how to specify this 
> variable? Most examples on the 'net seem to use the same dataset but do not 
> specify this particular aspect...
>
> __
> R-help@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.
>
Yes, these are two of the links I found but unfortunately they do not explain 
enough. In the second link there is the reference to an internal dataframe etc. 
but I can still not figure out how to specify a z-variable of my choosing when 
I am creating this type of plot...


[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Mapping 2D to 3D

2020-09-18 Thread H
On 09/18/2020 02:26 AM, Jeff Newmiller wrote:
> No, but fortunately you are off in the weeds. Density has an 
> internally-computed "z" coordinate... you should be looking at ?geom_contour.
>
> On September 17, 2020 7:17:33 PM PDT, H  wrote:
>> I am trying to understand how to map 2D to 3D using ggplot() and
>> eventually plot_gg(). I am, however, stuck on understanding how to
>> express the third variable to be mapped. This example:
>>
>> ggdiamonds = ggplot(diamonds, aes(x, depth)) +
>> stat_density_2d(aes(fill = stat(nlevel)),
>> geom = "polygon", n = 100, bins = 10,contour = TRUE) +
>> facet_wrap(clarity~.) +
>> scale_fill_viridis_c(option = "A")
>>
>> uses a variable nlevel that I now understand is calculated during the
>> building of the ggplot but I have not figured out from where it is
>> calculated or how to specify a variable of my choosing.
>>
>> Does anyone have a good reference for understanding how to specify this
>> variable? Most examples on the 'net seem to use the same dataset but do
>> not specify this particular aspect...
>>
>> __
>> R-help@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.

But looking at the code in my message above, how does one know what 
stat(nlevel) refers to? What if I wanted to map another variable in this 
particular dataset??

__
R-help@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.


Re: [R] Creating animation in R Notebooks

2020-09-18 Thread Jeff Reichman
David

The reference helped thank you. The "gifski" library corrected the issue

Jeff

-Original Message-
From: David Winsemius  
Sent: Friday, September 18, 2020 1:19 PM
To: reichm...@sbcglobal.net; r-help@r-project.org
Subject: Re: [R] Creating animation in R Notebooks

https://bookdown.org/yihui/rmarkdown-cookbook/animation.html

On 9/18/20 8:26 AM, Jeff Reichman wrote:
> r-help forum
>
>   
>
> Has anyone created an animations within a R-Notebook. I'm trying to 
> create an animation within a R -Notebook and while my code works 
> outside of a notebook (Console) but inside the R-Notebook framework I 
> only get a list of the  *.png files. Any suggestions?
>
>   
>
> path.animate.plot <- mymap.paths +
>
>transition_reveal(along = date) +
>
>labs(title = 'Date: {frame_along}')  # Add a label on top to say 
> what date each frame is
>
>   
>
> animate(path.animate.plot,
>
>  fps = 3, # frames per second
>
>  nframes = 200) # default is 100 frames
>
>   
>
>[1] "./gganim_plot0001.png" "./gganim_plot0002.png"
> "./gganim_plot0003.png" "./gganim_plot0004.png"
>
>[5] "./gganim_plot0005.png" "./gganim_plot0006.png"
> "./gganim_plot0007.png" "./gganim_plot0008.png"
>
>[9] "./gganim_plot0009.png" "./gganim_plot0010.png"
> "./gganim_plot0011.png" "./gganim_plot0012.png" ..
>
>   
>
> Jeff Reichman
>
>
>   [[alternative HTML version deleted]]
>
> __
> R-help@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.

__
R-help@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.


Re: [R] Creating animation in R Notebooks

2020-09-18 Thread Jeff Newmiller
It is part of a CRAN package rmarkdown, but major contributed packages are 
indeed outside the scope of this list regardless of where they come from.

Google is as always your friend: 
https://community.rstudio.com/t/make-an-rstudio-notebook-inline-animation-that-loops-with-gganimate/27489/2

On September 18, 2020 9:55:30 AM PDT, Bert Gunter  
wrote:
>Maybe better asked here: https://community.rstudio.com/
>as this is largely an RStudio product.
>
>Cheers,
>Bert
>
>Bert Gunter
>
>"The trouble with having an open mind is that people keep coming along
>and
>sticking things into it."
>-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
>
>On Fri, Sep 18, 2020 at 8:27 AM Jeff Reichman 
>wrote:
>
>> r-help forum
>>
>>
>>
>> Has anyone created an animations within a R-Notebook. I'm trying to
>create
>> an animation within a R -Notebook and while my code works outside of
>a
>> notebook (Console) but inside the R-Notebook framework I only get a
>list of
>> the  *.png files. Any suggestions?
>>
>>
>>
>> path.animate.plot <- mymap.paths +
>>
>>   transition_reveal(along = date) +
>>
>>   labs(title = 'Date: {frame_along}')  # Add a label on top to say
>what
>> date
>> each frame is
>>
>>
>>
>> animate(path.animate.plot,
>>
>> fps = 3, # frames per second
>>
>> nframes = 200) # default is 100 frames
>>
>>
>>
>>   [1] "./gganim_plot0001.png" "./gganim_plot0002.png"
>> "./gganim_plot0003.png" "./gganim_plot0004.png"
>>
>>   [5] "./gganim_plot0005.png" "./gganim_plot0006.png"
>> "./gganim_plot0007.png" "./gganim_plot0008.png"
>>
>>   [9] "./gganim_plot0009.png" "./gganim_plot0010.png"
>> "./gganim_plot0011.png" "./gganim_plot0012.png" ..
>>
>>
>>
>> Jeff Reichman
>>
>>
>> [[alternative HTML version deleted]]
>>
>> __
>> R-help@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.
>>
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@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.

-- 
Sent from my phone. Please excuse my brevity.

__
R-help@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.


Re: [R] Creating animation in R Notebooks

2020-09-18 Thread David Winsemius

https://bookdown.org/yihui/rmarkdown-cookbook/animation.html

On 9/18/20 8:26 AM, Jeff Reichman wrote:

r-help forum

  


Has anyone created an animations within a R-Notebook. I'm trying to create
an animation within a R -Notebook and while my code works outside of a
notebook (Console) but inside the R-Notebook framework I only get a list of
the  *.png files. Any suggestions?

  


path.animate.plot <- mymap.paths +

   transition_reveal(along = date) +

   labs(title = 'Date: {frame_along}')  # Add a label on top to say what date
each frame is

  


animate(path.animate.plot,

 fps = 3, # frames per second

 nframes = 200) # default is 100 frames

  


   [1] "./gganim_plot0001.png" "./gganim_plot0002.png"
"./gganim_plot0003.png" "./gganim_plot0004.png"

   [5] "./gganim_plot0005.png" "./gganim_plot0006.png"
"./gganim_plot0007.png" "./gganim_plot0008.png"

   [9] "./gganim_plot0009.png" "./gganim_plot0010.png"
"./gganim_plot0011.png" "./gganim_plot0012.png" ..

  


Jeff Reichman


[[alternative HTML version deleted]]

__
R-help@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.


__
R-help@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.


Re: [R] fusion of two matrices (numerical and logical)

2020-09-18 Thread jim holtman
Here is a way of doing it using the 'arr.ind' option in 'which'

> A <- 1:20
> B <- matrix(A,nrow=5,ncol=4)
> B
 [,1] [,2] [,3] [,4]
[1,]16   11   16
[2,]27   12   17
[3,]38   13   18
[4,]49   14   19
[5,]5   10   15   20
> # B is a numerical matrix
> C <- B<7
> C[4,4] <- TRUE
> C
 [,1]  [,2]  [,3]  [,4]
[1,] TRUE  TRUE FALSE FALSE
[2,] TRUE FALSE FALSE FALSE
[3,] TRUE FALSE FALSE FALSE
[4,] TRUE FALSE FALSE  TRUE
[5,] TRUE FALSE FALSE FALSE
>
> # initialize a 'result' with zeros
> result <- array(0, dim = dim(B))
>
> # get the indices of values to replace
> indx <- which(C, arr.ind = TRUE)
>
> result[indx] <- B[indx]
>
> result
 [,1] [,2] [,3] [,4]
[1,]1600
[2,]2000
[3,]3000
[4,]400   19
[5,]5000
>


Jim Holtman
*Data Munger Guru*


*What is the problem that you are trying to solve?Tell me what you want to
do, not how you want to do it.*


On Sat, Sep 5, 2020 at 11:51 AM Bert Gunter  wrote:

> A is not a matrix. I presume you meant B. If so:
>
> > B[!C] <- 0
> > B
>  [,1] [,2] [,3] [,4]
> [1,]1600
> [2,]2000
> [3,]3000
> [4,]400   19
> [5,]5000
>
> Cheers,
> Bert
>
>
>
>
>
> On Sat, Sep 5, 2020 at 11:18 AM Vivek Sutradhara 
> wrote:
>
> > Hi
> > I would like to get help in combining two matrices. Here is my example:
> > A <- 1:20
> > B <- matrix(A,nrow=5,ncol=4)
> > # B is a numerical matrix
> > C <- B<7
> > C[4,4] <- TRUE
> > # C is a logical matrix
> > # if I combine A and C, I get a vector
> > D1 <- A[C==TRUE]
> > D1
> > D2 <- A[C==FALSE]
> > D2
> >
> > I want to get a matrix with the same dimensions as matrix A. At the
> > coordinates given by the vector D1, I want to retain the values in
> > matrix A. At the locations in D2, I want a zero value.
> > I want to know if I can do this without using any loops.
> > Thanks, Vivek
> >
> > [[alternative HTML version deleted]]
> >
> > __
> > R-help@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.
> >
>
> [[alternative HTML version deleted]]
>
> __
> R-help@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.
>

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Creating animation in R Notebooks

2020-09-18 Thread Bert Gunter
Maybe better asked here: https://community.rstudio.com/
as this is largely an RStudio product.

Cheers,
Bert

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Fri, Sep 18, 2020 at 8:27 AM Jeff Reichman 
wrote:

> r-help forum
>
>
>
> Has anyone created an animations within a R-Notebook. I'm trying to create
> an animation within a R -Notebook and while my code works outside of a
> notebook (Console) but inside the R-Notebook framework I only get a list of
> the  *.png files. Any suggestions?
>
>
>
> path.animate.plot <- mymap.paths +
>
>   transition_reveal(along = date) +
>
>   labs(title = 'Date: {frame_along}')  # Add a label on top to say what
> date
> each frame is
>
>
>
> animate(path.animate.plot,
>
> fps = 3, # frames per second
>
> nframes = 200) # default is 100 frames
>
>
>
>   [1] "./gganim_plot0001.png" "./gganim_plot0002.png"
> "./gganim_plot0003.png" "./gganim_plot0004.png"
>
>   [5] "./gganim_plot0005.png" "./gganim_plot0006.png"
> "./gganim_plot0007.png" "./gganim_plot0008.png"
>
>   [9] "./gganim_plot0009.png" "./gganim_plot0010.png"
> "./gganim_plot0011.png" "./gganim_plot0012.png" ..
>
>
>
> Jeff Reichman
>
>
> [[alternative HTML version deleted]]
>
> __
> R-help@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.
>

[[alternative HTML version deleted]]

__
R-help@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.


[R] Creating animation in R Notebooks

2020-09-18 Thread Jeff Reichman
r-help forum

 

Has anyone created an animations within a R-Notebook. I'm trying to create
an animation within a R -Notebook and while my code works outside of a
notebook (Console) but inside the R-Notebook framework I only get a list of
the  *.png files. Any suggestions?

 

path.animate.plot <- mymap.paths +

  transition_reveal(along = date) +

  labs(title = 'Date: {frame_along}')  # Add a label on top to say what date
each frame is

 

animate(path.animate.plot,

fps = 3, # frames per second

nframes = 200) # default is 100 frames

 

  [1] "./gganim_plot0001.png" "./gganim_plot0002.png"
"./gganim_plot0003.png" "./gganim_plot0004.png"

  [5] "./gganim_plot0005.png" "./gganim_plot0006.png"
"./gganim_plot0007.png" "./gganim_plot0008.png"

  [9] "./gganim_plot0009.png" "./gganim_plot0010.png"
"./gganim_plot0011.png" "./gganim_plot0012.png" ..

 

Jeff Reichman


[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] how to overlay two histograms

2020-09-18 Thread John Kane
Is this what you want?

ggplot(d, aes(counts, fill = name)) +
  geom_bar(stat = "bin", position = "dodge")

Note: You probably should play around with the "bin" width.

On Thu, 17 Sep 2020 at 18:05, Ana Marija 
wrote:

> Hello,
>
> I am trying to overlay two histograms with this:
>
> p <- ggplot(d, aes(CHR, counts, fill = name)) + geom_bar(position =
> "dodge")
> p
>
> but I am getting this error:
> Error: stat_count() can only have an x or y aesthetic.
> Run `rlang::last_error()` to see where the error occurred.
>
> my data is this:
>
> > d
>CHR counts name
> 11 193554  old
> 22 220816  old
> 33 174350  old
> 44 163112  old
> 55 168125  old
> 66 182366  old
> 77 143023  old
> 88 147410  old
> 99 122112  old
> 10  10 138394  old
> 11  11 130069  old
> 12  12 124850  old
> 13  13 104119  old
> 14  14  83931  old
> 15  15  72287  old
> 16  16  71550  old
> 17  17  58380  old
> 18  18  76812  old
> 19  19  37040  old
> 20  20  63407  old
> 21  21  33863  old
> 22  22  33812  old
> 23   1 202783  new
> 24   2 252124  new
> 25   3 213337  new
> 26   4 201001  new
> 27   5 207606  new
> 28   6 228133  new
> 29   7 147218  new
> 30   8 177518  new
> 31   9 121276  new
> 32  10 163447  new
> 33  11 158724  new
> 34  12 142183  new
> 35  13 89  new
> 36  14  83043  new
> 37  15  61063  new
> 38  16  55439  new
> 39  17  32883  new
> 40  18  69135  new
> 41  19  16624  new
> 42  20  48541  new
> 43  21  25479  new
> 44  22  19698  new
>
> Basically I need to show counts per CHR in "old" and "new" side by side.
>
> Please advise,
> Ana
>
> __
> R-help@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.
>


-- 
John Kane
Kingston ON Canada

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] How to reduce the sparseness in a TDM to make a cluster plot readable?

2020-09-18 Thread Andrew

Hello Jim

Thanks for that. I'll read up on it and will give it a go, either later 
today or tomorrow. I am assuming this will work for both tf and tf-idf 
weighted TDMs?


Much appreciated. :-)

Best wishes
Andy


On 18/09/2020 09:18, Jim Lemon wrote:

Hi Andrew,
>From your last email the answer to your problem may be the
findFreqTerms() function. Just increase the number of times a term has
to appear and check the result until you get the matrix size that you
want.

Jim

On Fri, Sep 18, 2020 at 5:32 PM Andrew  wrote:

Hi Abby

Many thanks for reaching out with an offer of help. Very much appreciated.

(1) The packages I'm using are 'tm' for text-mining and the TDM and for
the clustering it is 'cluster'
(2) Not sure where the problem is happening as it doesn't show up as an
error. Where it manifests is in the plotting, however logic would
suggest that it concerns the removal of sparse terms, so that would be
in the TDM process
(3) I don't think I can provide a reproducible example. When I practice
using data sets that packages provide, all is fine. The trouble is when
I apply it to my own data sets which are five documents, etc., as described.

I think the nub of it is really to find a way that I can subset the TDM
to return the twenty or thirty most frequently used words, and then to
plot those using hclust. However, when searching on-line I haven't been
able to find any suggestions on how to do that, nor is there any mention
of using that approach in the books and tutorials I have.

If you (or someone on this list) can advise on how I can sort the terms
in the TDM from most to least frequent, and then to subset the top
twenty or thirty most frequently occurring terms (preferably using tf as
well as tf-idf) and then I can plot that sub-set, then I think that that
would do the trick, and the terms would be plotted clearly and legibly.

Thanks again for your offer of help. I hope that my reply helps clarify
rather than muddy the situation.

Best wishes
Andy


On 17/09/2020 08:43, Abby Spurdle wrote:

I'm not familiar with these subjects.
And hopefully, someone who is, will offer some better suggestions.

But to get things started, maybe...
(1) What packages are you using (re: tdm)?
(2) Where does the problem happen, in dist, hclust, the plot method
for hclust, or in the package(s) you are using?
(3) Do you think you could produce a small reproducible example,
showing what is wrong, and explaining you would like it to do instead?

Note that if the problem relates to hclust, or the plot method, then
you should be able to produce a much simpler example.
e.g.

  mycount.matrix <- matrix (rpois (25000, 20),, 5)
  head (mycount.matrix, 3)
  tail (mycount.matrix, 3)

  plot (hclust (dist (mycount.matrix) ) )

On Tue, Sep 15, 2020 at 6:54 AM Andrew  wrote:

Hello all

I am doing some text mining on a set of five plain text files and have
run into a snag when I run hclust in that there are just too many leaves
for anything to be read. It returns a solid black line.

The texts have been converted into a TDM which has a dim of 5,292 and 5
(as per 5 docs).

My code for removing sparsity is as follows:

   > tdm2 <- removeSparseTerms(tdm, sparse=0.9)

   > inspect(tdm2)

<>
Non-/sparse entries: 10415/16045
Sparsity   : 61%
Maximal term length: 22
Weighting  : term frequency (tf)

While the tf-idf weighting returns this when 0.9 sparseness is removed:

   > inspect(tdm.tfidf)
<>
Non-/sparse entries: 7915/18545
Sparsity   : 70%
Maximal term length: 22
Weighting  : term frequency - inverse document frequency
(normalized) (tf-idf)

I have experimented by decreasing the value I use for decreasing
sparseness, and that helps a bit, for example:

   > tdm2 <- removeSparseTerms(tdm, sparse=0.215)
   > inspect(tdm2)
<>
Non-/sparse entries: 3976/369
Sparsity   : 8%
Maximal term length: 14
Weighting  : term frequency (tf)

But, no matter what I do, the resulting plot is unreadable. The code for
plotting the cluster is:

   > hc <- hclust(dist(tdm2, method = "euclidean"), method = "complete")
   > plot(hc, yaxt = 'n', main = "Hierarchical clustering")

Can someone kindly either advise me what I am doing wrong and/ or
signpost me to some detailed info on how to fix this.

Many thanks in anticipation.

Andy


  [[alternative HTML version deleted]]

__
R-help@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.

__
R-help@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.



[ESS] Latest Emacs distributions out!

2020-09-18 Thread Mark Seeto via ESS-help
> Date: Thu, 17 Sep 2020 16:34:54 -0400
> From: Vincent Goulet 
> To: ess-help@r-project.org
> Subject: [ESS] Latest Emacs distributions out!
> Message-ID: <0281e8bb-019e-413d-9d10-43ad71cb4...@me.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hi all,
>
> With some delay, I'm glad to announce that my "modified" Emacs distributions 
> for Windows and macOS based off GNU Emacs 27.1 are out:
>

Thank you Vincent. I've used your modified Emacs for Windows for many
years, and I find it very useful.

Mark
--

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [R] Seasonal adjustment with seas - Error: X-13 has returned a non-zero exist status

2020-09-18 Thread Weber Sylvain (HES)
Dear Bill, Jeff, and Bert,

Thanks so much for the replies.
Bill is absolutely right. The problem came from the UNC path. 
I could solve the issue by adding the following lines to my Rprofile:
myPaths <- .libPaths()
myPaths <- c('M:/R/win-library/4.0', myPaths[2])  # where 
'M:/R/win-library/4.0' is the traditional DOS path corresponding to the UNC 
path \\... 
.libPaths(myPaths)

Thanks again!

Sylvain


De : Bill Dunlap  
Envoyé : jeudi, 17 septembre 2020 18:35
À : Weber Sylvain (HES) 
Cc : r-help@R-project.org
Objet : Re: [R] Seasonal adjustment with seas - Error: X-13 has returned a 
non-zero exist status

The problem might to due to using an UNC path (//machine//blah/...) instead of 
the traditional DOS path ("H:/blah/...").

E.g., if my working directory has a UNC path, cmd.exe will not work as expected:
> getwd()
[1] "server/dept/devel/bill-sandbox"
> system("C:\\WINDOWS\\SYSTEM32\\cmd.exe /c echo foo bar", intern=TRUE)
[1] "'server\\dept\\devel\\bill-sandbox'"                           
[2] "CMD.EXE was started with the above path as the current directory."
[3] "UNC paths are not supported.  Defaulting to Windows directory."   
[4] "foo bar"                          

You can test that by mapping 
"\\http://hes-nas-prairie.hes.adhes.hesge.ch/Home_S/sylvain.weber/Documents/R/win-library/4.0/x13binary/bin/x13ashtml.exe;
 to a driver letter and using letter-colon everywhere instead of "\\...".

-Bill

On Thu, Sep 17, 2020 at 8:46 AM Weber Sylvain (HES) 
 wrote:
Dear all,

I am using function "seas" from package "seasonal" for seasonal adjustment of 
time series. I am using the latest version of R (4.0.2, 64-bit).
The following lines provide a small working example:
## EXAMPLE ##
library(seasonal)
m <- seas(AirPassengers)
m

On my private laptop, everything is going smoothly, and I obtain the following 
output:
## OUTPUT ##
Call:
seas(x = AirPassengers)

Coefficients:
          Weekday          Easter[1]         AO1951.May  MA-Nonseasonal-01  
         -0.00295            0.01777            0.10016            0.11562  
   MA-Seasonal-12  
          0.49736  

But on my office computer, I receive the following error message after issuing 
" m <- seas(AirPassengers)":
## ERROR ##
Error: X-13 has returned a non-zero exist status, which means that the current 
spec file cannot be processed for an unknown reason.
In addition: Warning message:
In system(cmd, intern = intern, wait = wait | intern, show.output.on.console = 
wait,  :
  running command 'C:\Windows\system32\cmd.exe /c 
"\\http://hes-nas-prairie.hes.adhes.hesge.ch/Home_S/sylvain.weber/Documents/R/win-library/4.0/x13binary/bin/x13ashtml.exe;
 C:\Users\SYLVAI~1.WEB\AppData\Local\Temp\Rtmpe0MDE7\x132d0cb8579b9/iofile -n 
-s' had status 1

A similar issue has been already mentioned in various blogs, for instance:
https://rdrr.io/github/christophsax/seasonal/src/travis/test-x13messages.R
http://freerangestats.info/blog/2015/12/21/m3-and-x13
https://github.com/christophsax/seasonal/issues/154
but I couldn't find any solution yet.

Does anyone have any idea why this issue is occurring?

Thanks very much.

Sylvain

__
mailto:R-help@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.
__
R-help@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.


Re: [R] How to reduce the sparseness in a TDM to make a cluster plot readable?

2020-09-18 Thread Jim Lemon
Hi Andrew,
>From your last email the answer to your problem may be the
findFreqTerms() function. Just increase the number of times a term has
to appear and check the result until you get the matrix size that you
want.

Jim

On Fri, Sep 18, 2020 at 5:32 PM Andrew  wrote:
>
> Hi Abby
>
> Many thanks for reaching out with an offer of help. Very much appreciated.
>
> (1) The packages I'm using are 'tm' for text-mining and the TDM and for
> the clustering it is 'cluster'
> (2) Not sure where the problem is happening as it doesn't show up as an
> error. Where it manifests is in the plotting, however logic would
> suggest that it concerns the removal of sparse terms, so that would be
> in the TDM process
> (3) I don't think I can provide a reproducible example. When I practice
> using data sets that packages provide, all is fine. The trouble is when
> I apply it to my own data sets which are five documents, etc., as described.
>
> I think the nub of it is really to find a way that I can subset the TDM
> to return the twenty or thirty most frequently used words, and then to
> plot those using hclust. However, when searching on-line I haven't been
> able to find any suggestions on how to do that, nor is there any mention
> of using that approach in the books and tutorials I have.
>
> If you (or someone on this list) can advise on how I can sort the terms
> in the TDM from most to least frequent, and then to subset the top
> twenty or thirty most frequently occurring terms (preferably using tf as
> well as tf-idf) and then I can plot that sub-set, then I think that that
> would do the trick, and the terms would be plotted clearly and legibly.
>
> Thanks again for your offer of help. I hope that my reply helps clarify
> rather than muddy the situation.
>
> Best wishes
> Andy
>
>
> On 17/09/2020 08:43, Abby Spurdle wrote:
> > I'm not familiar with these subjects.
> > And hopefully, someone who is, will offer some better suggestions.
> >
> > But to get things started, maybe...
> > (1) What packages are you using (re: tdm)?
> > (2) Where does the problem happen, in dist, hclust, the plot method
> > for hclust, or in the package(s) you are using?
> > (3) Do you think you could produce a small reproducible example,
> > showing what is wrong, and explaining you would like it to do instead?
> >
> > Note that if the problem relates to hclust, or the plot method, then
> > you should be able to produce a much simpler example.
> > e.g.
> >
> >  mycount.matrix <- matrix (rpois (25000, 20),, 5)
> >  head (mycount.matrix, 3)
> >  tail (mycount.matrix, 3)
> >
> >  plot (hclust (dist (mycount.matrix) ) )
> >
> > On Tue, Sep 15, 2020 at 6:54 AM Andrew  wrote:
> >> Hello all
> >>
> >> I am doing some text mining on a set of five plain text files and have
> >> run into a snag when I run hclust in that there are just too many leaves
> >> for anything to be read. It returns a solid black line.
> >>
> >> The texts have been converted into a TDM which has a dim of 5,292 and 5
> >> (as per 5 docs).
> >>
> >> My code for removing sparsity is as follows:
> >>
> >>   > tdm2 <- removeSparseTerms(tdm, sparse=0.9)
> >>
> >>   > inspect(tdm2)
> >>
> >> <>
> >> Non-/sparse entries: 10415/16045
> >> Sparsity   : 61%
> >> Maximal term length: 22
> >> Weighting  : term frequency (tf)
> >>
> >> While the tf-idf weighting returns this when 0.9 sparseness is removed:
> >>
> >>   > inspect(tdm.tfidf)
> >> <>
> >> Non-/sparse entries: 7915/18545
> >> Sparsity   : 70%
> >> Maximal term length: 22
> >> Weighting  : term frequency - inverse document frequency
> >> (normalized) (tf-idf)
> >>
> >> I have experimented by decreasing the value I use for decreasing
> >> sparseness, and that helps a bit, for example:
> >>
> >>   > tdm2 <- removeSparseTerms(tdm, sparse=0.215)
> >>   > inspect(tdm2)
> >> <>
> >> Non-/sparse entries: 3976/369
> >> Sparsity   : 8%
> >> Maximal term length: 14
> >> Weighting  : term frequency (tf)
> >>
> >> But, no matter what I do, the resulting plot is unreadable. The code for
> >> plotting the cluster is:
> >>
> >>   > hc <- hclust(dist(tdm2, method = "euclidean"), method = "complete")
> >>   > plot(hc, yaxt = 'n', main = "Hierarchical clustering")
> >>
> >> Can someone kindly either advise me what I am doing wrong and/ or
> >> signpost me to some detailed info on how to fix this.
> >>
> >> Many thanks in anticipation.
> >>
> >> Andy
> >>
> >>
> >>  [[alternative HTML version deleted]]
> >>
> >> __
> >> R-help@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.
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 

Re: [R] How to reduce the sparseness in a TDM to make a cluster plot readable?

2020-09-18 Thread Andrew

Hi Abby

Many thanks for reaching out with an offer of help. Very much appreciated.

(1) The packages I'm using are 'tm' for text-mining and the TDM and for 
the clustering it is 'cluster'
(2) Not sure where the problem is happening as it doesn't show up as an 
error. Where it manifests is in the plotting, however logic would 
suggest that it concerns the removal of sparse terms, so that would be 
in the TDM process
(3) I don't think I can provide a reproducible example. When I practice 
using data sets that packages provide, all is fine. The trouble is when 
I apply it to my own data sets which are five documents, etc., as described.


I think the nub of it is really to find a way that I can subset the TDM 
to return the twenty or thirty most frequently used words, and then to 
plot those using hclust. However, when searching on-line I haven't been 
able to find any suggestions on how to do that, nor is there any mention 
of using that approach in the books and tutorials I have.


If you (or someone on this list) can advise on how I can sort the terms 
in the TDM from most to least frequent, and then to subset the top 
twenty or thirty most frequently occurring terms (preferably using tf as 
well as tf-idf) and then I can plot that sub-set, then I think that that 
would do the trick, and the terms would be plotted clearly and legibly.


Thanks again for your offer of help. I hope that my reply helps clarify 
rather than muddy the situation.


Best wishes
Andy


On 17/09/2020 08:43, Abby Spurdle wrote:

I'm not familiar with these subjects.
And hopefully, someone who is, will offer some better suggestions.

But to get things started, maybe...
(1) What packages are you using (re: tdm)?
(2) Where does the problem happen, in dist, hclust, the plot method
for hclust, or in the package(s) you are using?
(3) Do you think you could produce a small reproducible example,
showing what is wrong, and explaining you would like it to do instead?

Note that if the problem relates to hclust, or the plot method, then
you should be able to produce a much simpler example.
e.g.

 mycount.matrix <- matrix (rpois (25000, 20),, 5)
 head (mycount.matrix, 3)
 tail (mycount.matrix, 3)

 plot (hclust (dist (mycount.matrix) ) )

On Tue, Sep 15, 2020 at 6:54 AM Andrew  wrote:

Hello all

I am doing some text mining on a set of five plain text files and have
run into a snag when I run hclust in that there are just too many leaves
for anything to be read. It returns a solid black line.

The texts have been converted into a TDM which has a dim of 5,292 and 5
(as per 5 docs).

My code for removing sparsity is as follows:

  > tdm2 <- removeSparseTerms(tdm, sparse=0.9)

  > inspect(tdm2)

<>
Non-/sparse entries: 10415/16045
Sparsity   : 61%
Maximal term length: 22
Weighting  : term frequency (tf)

While the tf-idf weighting returns this when 0.9 sparseness is removed:

  > inspect(tdm.tfidf)
<>
Non-/sparse entries: 7915/18545
Sparsity   : 70%
Maximal term length: 22
Weighting  : term frequency - inverse document frequency
(normalized) (tf-idf)

I have experimented by decreasing the value I use for decreasing
sparseness, and that helps a bit, for example:

  > tdm2 <- removeSparseTerms(tdm, sparse=0.215)
  > inspect(tdm2)
<>
Non-/sparse entries: 3976/369
Sparsity   : 8%
Maximal term length: 14
Weighting  : term frequency (tf)

But, no matter what I do, the resulting plot is unreadable. The code for
plotting the cluster is:

  > hc <- hclust(dist(tdm2, method = "euclidean"), method = "complete")
  > plot(hc, yaxt = 'n', main = "Hierarchical clustering")

Can someone kindly either advise me what I am doing wrong and/ or
signpost me to some detailed info on how to fix this.

Many thanks in anticipation.

Andy


 [[alternative HTML version deleted]]

__
R-help@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.


__
R-help@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.


Re: [R] Mapping 2D to 3D

2020-09-18 Thread Carlos Ortega
Hi,

There are some further references in the own "RStudio Community" and in
StackOverflow:

   - https://community.rstudio.com/t/options-to-stat-density-2d/792/4
   -
   
https://stackoverflow.com/questions/32206623/what-does-level-mean-in-ggplotstat-density2d

Kind Regards,
Carlos.


On Fri, Sep 18, 2020 at 4:17 AM H  wrote:

> I am trying to understand how to map 2D to 3D using ggplot() and
> eventually plot_gg(). I am, however, stuck on understanding how to express
> the third variable to be mapped. This example:
>
> ggdiamonds = ggplot(diamonds, aes(x, depth)) +
> stat_density_2d(aes(fill = stat(nlevel)),
> geom = "polygon", n = 100, bins = 10,contour = TRUE) +
> facet_wrap(clarity~.) +
> scale_fill_viridis_c(option = "A")
>
> uses a variable nlevel that I now understand is calculated during the
> building of the ggplot but I have not figured out from where it is
> calculated or how to specify a variable of my choosing.
>
> Does anyone have a good reference for understanding how to specify this
> variable? Most examples on the 'net seem to use the same dataset but do not
> specify this particular aspect...
>
> __
> R-help@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.
>

[[alternative HTML version deleted]]

__
R-help@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.


Re: [ESS] Latest Emacs distributions out!

2020-09-18 Thread Martin Maechler via ESS-help
> Vincent Goulet via ESS-help 
> on Thu, 17 Sep 2020 16:34:54 -0400 writes:

> Hi all, With some delay, I'm glad to announce that my
> "modified" Emacs distributions for Windows and macOS based
> off GNU Emacs 27.1 are out:

>   Windows:
> https://vigou3.gitlab.io/emacs-modified-windows/ macOS:
> https://vigou3.gitlab.io/emacs-modified-macOS/

> For those of you unfamiliar with these distributions: they
> are almost stock distributions of GNU Emacs with ESS,
> AUCTeX, org and a few other goodies preinstalled. I use
> the macOS version myself on a daily basis.

> In the Windows version, I added a simple, temporary fix
> for ESS 18.10.2 to find the versions of R 4.x.y on one's
> system. The site-start.el includes this line:

> (setq ess-r-versions '("R-1" "R-2" "R-3" "R-4" "R-devel"
> "R-patched"))

> Here 'M-x R' does not work as expected, by 'M-x R-[TAB]'
> correctly lists all the versions of R on my system,
> including 4.0.2.

> Best,
> v.

> Vincent Goulet Professeur titulaire École d'actuariat,
> Université Laval

Thank you very much, Vincent,  for this invaluable service to
those like me who work with Linux "all the time", but need to
run R on Windows a few times a month for testing purposes!

Above, you note

  --> Here 'M-x R' does not work as expected, ...

and I had noted this to happen already many months ago with your
previous versions of Emacs for Windows and current versions of R.

I never went to the root of the problem that evidently   M-x R
no longer works correctly on ESS for Windows.
My guess was that the 'R for Windows' version that we all use
built and packaged by Jeroen Ooms, must have changed some small
thing some months (but less than say 2 years) ago.

I think we should we'd be grateful if someone had the diligence
to find the root cause, and even better found a way for ESS to
again enable  M-x R  on Windows  (finding the latest released
version of R that's available on the machine where I also
typically have a dozen versions of R installed).

Best regards,
Martin

Martin Maechler
ETH Zurich  and  R Core team

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [R] Mapping 2D to 3D

2020-09-18 Thread Jeff Newmiller
No, but fortunately you are off in the weeds. Density has an 
internally-computed "z" coordinate... you should be looking at ?geom_contour.

On September 17, 2020 7:17:33 PM PDT, H  wrote:
>I am trying to understand how to map 2D to 3D using ggplot() and
>eventually plot_gg(). I am, however, stuck on understanding how to
>express the third variable to be mapped. This example:
>
>ggdiamonds = ggplot(diamonds, aes(x, depth)) +
>stat_density_2d(aes(fill = stat(nlevel)),
>geom = "polygon", n = 100, bins = 10,contour = TRUE) +
>facet_wrap(clarity~.) +
>scale_fill_viridis_c(option = "A")
>
>uses a variable nlevel that I now understand is calculated during the
>building of the ggplot but I have not figured out from where it is
>calculated or how to specify a variable of my choosing.
>
>Does anyone have a good reference for understanding how to specify this
>variable? Most examples on the 'net seem to use the same dataset but do
>not specify this particular aspect...
>
>__
>R-help@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.

-- 
Sent from my phone. Please excuse my brevity.

__
R-help@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.


Re: [R] Mapping 2D to 3D

2020-09-18 Thread Abby Spurdle
> But there's no reason for the user to do that when using the plotting 
> function.

I should amend the above.
There's no reason for the user to do that (compute a third "variable"
representing density), if using a high level plotting function, that's
designed to compute the density for you.

It is possible to do it in two or more steps.
(Compute the density matrix, then plot it).

Again, refer to the help file for kde2d.

__
R-help@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.


Re: [R] Mapping 2D to 3D

2020-09-18 Thread Abby Spurdle
I'm not familiar with the gg graphics system.
However, I am familiar with density estimation, and density visualization.

There is *no* third variable, as such.
But rather, density estimates, which in this context, would usually be a matrix.
(And are computed inside the plotting or density estimation functions).

The documentation for the function you've used, says it uses  MASS::kde2d().
This does just that, returns an object, which contains a density matrix.
(Refer to the help file for kde2d).

Of course, there's no reason why one can't create a third variable,
from a mathematical perspective.
e.g. d, z, h, fv, or whatever you prefer...
And then set z = fh (x, y).

But there's no reason for the user to do that when using the plotting function.

Note that there are situations where one might want to set the limits
of the plot.
And set the breaks, colors, and color key.
e.g. Creating two or more plots, and putting them next to each other,
for comparison purposes.


On Fri, Sep 18, 2020 at 2:17 PM H  wrote:
>
> I am trying to understand how to map 2D to 3D using ggplot() and eventually 
> plot_gg(). I am, however, stuck on understanding how to express the third 
> variable to be mapped. This example:
>
> ggdiamonds = ggplot(diamonds, aes(x, depth)) +
> stat_density_2d(aes(fill = stat(nlevel)),
> geom = "polygon", n = 100, bins = 10,contour = TRUE) +
> facet_wrap(clarity~.) +
> scale_fill_viridis_c(option = "A")
>
> uses a variable nlevel that I now understand is calculated during the 
> building of the ggplot but I have not figured out from where it is calculated 
> or how to specify a variable of my choosing.
>
> Does anyone have a good reference for understanding how to specify this 
> variable? Most examples on the 'net seem to use the same dataset but do not 
> specify this particular aspect...
>
> __
> R-help@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.

__
R-help@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.