Karl Schilling
2021-Oct-24 20:57 UTC
[R] problem with plotting clustered data with convex hull using ggfortify
Dear all:
I have some data that I want to cluster and display as groups surrounded
by convex hulls. Here, i use the iris data as an example:
library(ggfortify)
autoplot(fanny(iris[-5], 3), frame = TRUE)
I used this code before, about a year ago, and then it resulted in data
surrounded by convex hulls., just as may be seen in the description of
ggfortify here:
http://rstudio-pubs-static.s3.amazonaws.com/53162_cd16ee63c24747459ccd180f69f07810.html
Presently, no hulls are drawn; instead some line is projected on each
cluster.
I found out that there is an addition to autoplot command, "frame.type =
c("convex", "norm", "t"). Whereas
""norm" and "t" give confidence
ellipses as expected, "convex" results in a straight line as mentioned
above.
Any help would be appreciated.
Best
--
Karl Schilling
Bert Gunter
2021-Oct-24 21:19 UTC
[R] problem with plotting clustered data with convex hull using ggfortify
ggfortify is a (nonstandard) contributed package. Please note that per the
posting guide linked below:
"For questions about functions in standard packages distributed with R (see
the FAQ Add-on packages in R
<https://cran.r-project.org/doc/FAQ/R-FAQ.html#Add-on-packages-in-R>), ask
questions on R-help.
If the question relates to a *contributed package* , e.g., one downloaded
from CRAN, try contacting the package maintainer first. You can also use
find("functionname") and packageDescription("packagename")
to find this
information. *Only* send such questions to R-help or R-devel if you get no
reply or need further assistance. This applies to both requests for help
and to bug reports."
So while you may get help here, the above may be a better course of action.
Also, if all you have done is copy and paste code, you should consider
going through the vignettes for the package. They seem fairly extensive
from my quick look and may well provide the answers you seek.
Bert Gunter
On Sun, Oct 24, 2021 at 1:57 PM Karl Schilling <karl.schilling at
uni-bonn.de>
wrote:
> Dear all:
>
> I have some data that I want to cluster and display as groups surrounded
> by convex hulls. Here, i use the iris data as an example:
>
> library(ggfortify)
> autoplot(fanny(iris[-5], 3), frame = TRUE)
>
> I used this code before, about a year ago, and then it resulted in data
> surrounded by convex hulls., just as may be seen in the description of
> ggfortify here:
>
>
>
>
http://rstudio-pubs-static.s3.amazonaws.com/53162_cd16ee63c24747459ccd180f69f07810.html
>
>
> Presently, no hulls are drawn; instead some line is projected on each
> cluster.
>
> I found out that there is an addition to autoplot command, "frame.type
> c("convex", "norm", "t"). Whereas
""norm" and "t" give confidence
> ellipses as expected, "convex" results in a straight line as
mentioned
> above.
>
> Any help would be appreciated.
>
> Best
>
> --
> Karl Schilling
>
> ______________________________________________
> R-help at 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]]
Rui Barradas
2021-Oct-24 22:32 UTC
[R] problem with plotting clustered data with convex hull using ggfortify
Hello,
R 4.1.1 on Ubuntu 20.04.3 LTS.
I can reproduce this error. It happens with ggfortify 0.4.12 but not
with 0.4.11.
First ggfortify 0.4.11, notice the warnings.
rui at rui:~$ R -q -f rhelp.R
> library(ggfortify)
Loading required package: ggplot2
> library(cluster)
>
> autoplot(fanny(iris[-5], 3), frame = TRUE)
Warning messages:
1: `select_()` was deprecated in dplyr 0.7.0.
Please use `select()` instead.
This warning is displayed once every 8 hours.
Call `lifecycle::last_warnings()` to see where this warning was generated.
2: `group_by_()` was deprecated in dplyr 0.7.0.
Please use `group_by()` instead.
See vignette('programming') for more help
This warning is displayed once every 8 hours.
Call `lifecycle::last_warnings()` to see where this warning was generated.
> packageVersion("cluster")
[1] ?2.1.2?
> packageVersion("ggfortify")
[1] ?0.4.11?
>
> sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 LTS
[...]
#---------------
Now ggfortify 0.4.12, notice that the errors are gone but there's a
message, probably printed with cat().
rui at rui-p6550pt:~$ R -q -f rhelp.R
> library(ggfortify)
Loading required package: ggplot2
> library(cluster)
>
> autoplot(fanny(iris[-5], 3), frame = TRUE)
Adding missing grouping variables: `cluster`
> packageVersion("cluster")
[1] ?2.1.2?
> packageVersion("ggfortify")
[1] ?0.4.12?
>
> sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 LTS
[...]
One problem was fixed, another showed up.
You should contact the package maintainer.
Hope this helps,
Rui Barradas
?s 21:57 de 24/10/21, Karl Schilling escreveu:> Dear all:
>
> I have some data that I want to cluster and display as groups surrounded
> by convex hulls. Here, i use the iris data as an example:
>
> library(ggfortify)
> autoplot(fanny(iris[-5], 3), frame = TRUE)
>
> I used this code before, about a year ago, and then it resulted in data
> surrounded by convex hulls., just as may be seen in the description of
> ggfortify here:
>
>
>
http://rstudio-pubs-static.s3.amazonaws.com/53162_cd16ee63c24747459ccd180f69f07810.html
>
>
>
> Presently, no hulls are drawn; instead some line is projected on each
> cluster.
>
> I found out that there is an addition to autoplot command, "frame.type
=
> c("convex", "norm", "t"). Whereas
""norm" and "t"? give confidence
> ellipses as expected, "convex" results in a straight line as
mentioned
> above.
>
> Any help would be appreciated.
>
> Best
>