Re: [R] Extract data from .nc file

2021-03-09 Thread Rasmus Liland
Dear Shailendra and Roy, Yes, the info ncvar_get retrieves is of different lengths. soi_final does not have a time variable for the x axis, and tt is a integer vector int [1:2001(1d)] 0 365 730 1095 1460 1825 2190 2555 2920 3285 ... The file is a HDF5 file: rasmus@twosixty ~ % file

Re: [R] Changing chart border's color

2021-03-09 Thread Rasmus Liland
Right, adding a black border around a plot in R is meaningless. There is also another circular plot being created everytime FactoMineR::PCA runs. It might be (perhaps, idk) fruitful for you to look at the contents of res.pca using str and create the PCA plot yourself using ggplot2 ...

Re: [R] Changing chart border's color

2021-03-09 Thread Rasmus Liland
Please add test.csv using dput 🙃 __ 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

Re: [R] Changing chart border's color

2021-03-09 Thread Mahmood Naderan-Tahan
Hi Rasmus, Please see the following commands. The box fails. > library("FactoMineR") > mydata <- read.csv('test.csv', header=T,row.names=1) > res.pca = PCA(mydata, quali.sup=5, graph=F) > plot(res.pca, choix="ind") > box(col='black') Error in box(col = "black") : plot.new has not been called yet

Re: [R] poLCA problem

2021-03-09 Thread Rasmus Liland
Dear Scott, I think the issue here is you need to form a correct formula poLCA::poLCA can accept. The help page ?poLCA::election has this example: # Latent class models with one (loglinear independence) to three classes data(election) f <- cbind(MORALG,CARESG,KNOWG,LEA

Re: [R] Changing chart border's color

2021-03-09 Thread Rasmus Liland
Hi, it would be useful to know how you created res.pca. https://rdrr.io/r/graphics/box.html Rasmus signature.asc Description: PGP signature __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/

Re: [R] Plot_ly bar plots - bars span sevral x values when there are missing values.

2021-03-09 Thread Rasmus Liland
Dear Nevil, Although I am a bit unfamiliar with plotly, it seems it is possible to plot two bars side by side at least: h <- df[3:4,] p <- plotly::plot_ly( data = h, x = ~ x, y = ~ y, type = "bar") p <- plotly::layout(p=p,

Re: [R] Gradient plots in ggplot2

2021-03-09 Thread phil
Thank you for your suggestions. I found, after much experimentation, that scale_fill_gradientn did indeed provide a good solution, as below. library(ggplot2) a <- c(rep(1,6),rep(2,6),rep(3,6),rep(4,6)) b <- c(0.1, 0.5,-0.3, 1.2,-0.4,-1.2, 0.7, 0.8,-1.2,-0.5,10.0, 0.3, 0.2,-0.4,-15.

Re: [R] Specifying plot file name in the rscript

2021-03-09 Thread Mahmood Naderan-Tahan
Right. Thank you very much. Regards, Mahmood From: Ben Tupper Sent: Tuesday, March 9, 2021 2:58:17 PM To: Mahmood Naderan-Tahan Cc: r-help@r-project.org Subject: Re: [R] Specifying plot file name in the rscript Hi, When you call plot() it will draw to the defa

Re: [R] Specifying plot file name in the rscript

2021-03-09 Thread Ben Tupper
Hi, When you call plot() it will draw to the default device - in your case the pdf() device. When the default device results in a file, R selects a filename for you unless you tell it otherwise. You can specify the filename by explicitly calling pdf() first. pdf("var_plot.pdf") plot(res.pca, cho

[R] Changing chart border's color

2021-03-09 Thread Mahmood Naderan-Tahan
Hi I would like to make the color of the chart border to black. However, the following command doesn't work plot(res.pca, choix="ind", border="black") Any way to fix that? Regards, Mahmood [[alternative HTML version deleted]] __ R-help@r-

[R] Specifying plot file name in the rscript

2021-03-09 Thread Mahmood Naderan-Tahan
Hi I use the following R script to plot two graphs. library(FactoMineR) mydata <- read.csv('test.csv', header=T,row.names=1) res.pca = PCA(mydata, quali.sup=5, graph=F) plot(res.pca, choix="var", axes=c(1,2)) dev.new() plot(res.pca, choix="ind", axes=c(1,2)) After running "Rscript my.r", I see

[R] [R-pkgs] pkglite: Compact Package Representations

2021-03-09 Thread Nan Xiao
Dear all, I am happy to announce that {pkglite} is now on CRAN. It aims to offer a tool, grammar, and standard to represent and exchange R packages as text files. It can convert one or more source packages to a text file and restore the package structures from the file. I hope you find it help