Re: [R] R lattice contourplot: select only specific values

2021-11-17 Thread Luigi Marongiu
Awesome, thanks! On Wed, Nov 17, 2021 at 7:50 PM Bill Dunlap wrote: > > Try using at=c(1.8, 2.8) to specify the contour levels you want (and omit the > cuts= argument). > > -Bill > > On Wed, Nov 17, 2021 at 5:41 AM Luigi Marongiu > wrote: >> >> I have a dataframe of three variables: x, y, z.

Re: [R] Help with strange RGui behavior? Will not consistently run source.

2021-11-17 Thread Mark Fowler
Hi, This issue bears some similarity to a problem I�ve been experiencing over the last few days. R 4.0.3, Windows 10, RGui. My ability to adjust window dimensions took a serious slide (cursor on edge or corner, click and tug). Usually only works now if I pause for awhile after the click before

Re: [R-es] Consulta de librerías swirl y tseries

2021-11-17 Thread Isidro Hidalgo Arellano
¿Puedes enviar la respuesta de la consola después de hacer cada install.packages()? Un saludo Isidro Hidalgo Arellano Observatorio del Mercado de Trabajo Consejería de Economía, Empresas y Empleo http://www.castillalamancha.es/ -Mensaje original- De: R-help-es En nombre de myubuntu

[R-es] Consulta de librerías swirl y tseries

2021-11-17 Thread myubuntu mail
Buenas. Soy usuario linux, distro ubuntu 21.04 $ R --version R version 4.1.2 (2021-11-01) -- "Bird Hippie" Copyright (C) 2021 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) >library(Rcmd)... corre ok >install.packages("swirl") ... >

Re: [R] How to create a proper S4 class?

2021-11-17 Thread Leonard Mada via R-help
Dear Martin, thank you very much for the guidance. Ultimately, I got it running. But, for mysterious reasons, it was challenging: - I skipped for now the inheritance (and used 2 explicit non-inherited slots): this is still unresolved; [*] - the code is definitely cleaner; [*]

Re: [R] lattice contourplot: how to change line width?

2021-11-17 Thread Luigi Marongiu
Thank you! yes, I thought line width was controlled by some kind of panel function... On Wed, Nov 17, 2021 at 7:06 PM Bert Gunter wrote: > > Your code is unnecessarily complex. > contourplot() will by default use the panel.contourplot() function and pass > down graphical arguments to it. > > So

Re: [R] [External] lattice contourplot: how to change line width?

2021-11-17 Thread Richard M. Heiberger
It didn't work because you left out the ... on the inside. it should be panel.contourplot(..., lty=1, lwd = 3) As Bert pointed out, you don't need to specify the panel function unless you are doing something complex. > On Nov 17, 2021, at 13:06, Bert Gunter wrote: > >>>

Re: [R] R lattice contourplot: select only specific values

2021-11-17 Thread Bill Dunlap
Try using at=c(1.8, 2.8) to specify the contour levels you want (and omit the cuts= argument). -Bill On Wed, Nov 17, 2021 at 5:41 AM Luigi Marongiu wrote: > I have a dataframe of three variables: x, y, z. The value of z are: > ``` > > unique(df$z) > [1] 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.6 3.0 2.4

Re: [R] lattice contourplot: how to change line width?

2021-11-17 Thread Bert Gunter
Your code is unnecessarily complex. contourplot() will by default use the panel.contourplot() function and pass down graphical arguments to it. So this suffices: contourplot(Z ~ X*Y, data = df, cuts = 3, lwd =2) Customization of the panel function appears to be unnecessary for your needs. Bert

Re: [R] Help with strange RGui behavior? Will not consistently run source.

2021-11-17 Thread Eric Berger
Hi Stephen, Does the problem still occur if you connect remotely to your computer from a different computer? e.g. via remote desktop? On Wed, Nov 17, 2021 at 6:50 PM Stephen Hartley < stephen.hartley@gmail.com> wrote: > So I've got an odd problem that I can't seem to nail down, and I'm not

[R] Help with strange RGui behavior? Will not consistently run source.

2021-11-17 Thread Stephen Hartley
So I've got an odd problem that I can't seem to nail down, and I'm not totally sure even where I should go to ask about it. Hopefully this mailing list is acceptable, and please do let me know if not. I'm using the "Rgui.exe" interface for R in windows 10. I've used this for more than a decade

Re: [R] How to create a proper S4 class?

2021-11-17 Thread Martin Morgan
Hi Leonard -- Remember that a class can have 'has a' and 'is a' relationships. For instance, a People class might HAVE slots name and age .People <- setClass( "People", slots = c(name = "character", age = "numeric") ) while an Employees class might be described as an 'is a'

Re: [R] vectorization of loops in R

2021-11-17 Thread Jan van der Laan
Have a look at the base functions tapply and aggregate. For example see: - https://cran.r-project.org/doc/manuals/r-release/R-intro.html#The-function-tapply_0028_0029-and-ragged-arrays , - https://online.stat.psu.edu/stat484/lesson/9/9.2, - or ?tapply and ?aggregate. Also your current code

[R] R lattice contourplot: select only specific values

2021-11-17 Thread Luigi Marongiu
I have a dataframe of three variables: x, y, z. The value of z are: ``` > unique(df$z) [1] 1.0 1.2 1.4 1.6 1.8 2.0 2.2 2.6 3.0 2.4 2.8 ``` I would like to plot the contour where the data get integer values (1.0, 2.0, 3.0) but also highlight where the 1.8 and 2.8 values occurred. Thus, I am

Re: [R] vectorization of loops in R

2021-11-17 Thread Kevin Thorpe
If I follow what you are trying to do, you want the mean of z for each value of y. tapply(df$z, df$y, mean) > On Nov 17, 2021, at 8:20 AM, Luigi Marongiu wrote: > > Hello, > I have a dataframe with 3 variables. I want to loop through it to get > the mean value of the variable `z`, as

[R] vectorization of loops in R

2021-11-17 Thread Luigi Marongiu
Hello, I have a dataframe with 3 variables. I want to loop through it to get the mean value of the variable `z`, as follows: ``` df = data.frame(x = c(rep(1,5), rep(2,5), rep(3,5)), y = rep(letters[1:5],3), z = rnorm(15), stringsAsFactors = FALSE) m = vector() for (i in unique(df$y)) { s = df[df$y

Re: [R] lattice contourplot: how to change line width?

2021-11-17 Thread Luigi Marongiu
sorry, it was easier than expected: just add `lwd` to the main cal. sorry I could not stop the message before checking... On Wed, Nov 17, 2021 at 10:31 AM Luigi Marongiu wrote: > > Hello, > I have generated a contourplot with lattice. How do I set the line > width? I tried with: > ``` >

[R] lattice contourplot: how to change line width?

2021-11-17 Thread Luigi Marongiu
Hello, I have generated a contourplot with lattice. How do I set the line width? I tried with: ``` library(lattice) contourplot(Z ~ X*Y, data = df, cuts = 3, panel=function(x,y,...){ panel.contourplot(lty=1, lwd = 3) }) ``` but did not work... Thank you