Re: [R-es] poner un código en Internet

2021-03-25 Thread Manuel Mendoza
Gracias Eric y Xavier. Finalmente utilicé pastebin porque es más sencillo. Los Gits ofrecen muchas más cosas, pero, de momento, no me hacen falta. En una revista me piden, simplemente, que el código de un índice que desarrollamos esté disponible en algún sitio. Lo pongo aquí, por si le interesa a

Re: [R] Off topic --- underdispersed (pseudo) binomial data.

2021-03-25 Thread Rolf Turner
On Fri, 26 Mar 2021 13:41:00 +1300 Abby Spurdle wrote: > I haven't checked this, but I guess that the number of students that > *pass* a particular exam/subject, per semester would be like that. > > e.g. > Let's say you have a course in maximum likelihood, that's taught once > per year to 3rd

Re: [R] Off topic --- underdispersed (pseudo) binomial data.

2021-03-25 Thread Abby Spurdle
I haven't checked this, but I guess that the number of students that *pass* a particular exam/subject, per semester would be like that. e.g. Let's say you have a course in maximum likelihood, that's taught once per year to 3rd year students, and a few postgrads. You could count the number of

Re: [R] Thanks for help

2021-03-25 Thread Bert Gunter
apply() is also a (disguised) loop, though. I think you will find that indexing via rowSums is a lot faster: ## The example set.seed(111) ## for reproducibility a<-matrix(sample(1:20,350,TRUE),ncol=10) ## 35 rows ## A one-liner a[rowSums(a != 1) == 10, ] ## 20 rows Bert Gunter "The trouble

Re: [R] Thanks for help

2021-03-25 Thread Jim Lemon
Okay, if I understand this, you want to remove all rows that have, for example, a 1 in any of ten columns: a<-matrix(sample(1:20,350,TRUE),ncol=10) # check it out a # first do it with a loop b<-a for(i in 1:ncol(b)) b<-b[b[,i]!=1,] b # now get tricky and do it in one operation

Re: [R] How to average minutes per hour per month in the form of '# hours #minutes'

2021-03-25 Thread Jeff Newmiller
This is a very unclear question. Weeks don't line up with months.. so you need to clarify how you would do this or at least give an explicit example of input data and result data. On March 25, 2021 11:34:15 AM PDT, Dr Eberhard W Lisse wrote: >Thanks, that is helpful. > >But, how do I group it

Re: [R-es] poner un código en Internet

2021-03-25 Thread Eric
https://pastebin.com/ On 25-03-21 17:07, Manuel Mendoza wrote: Buenas tardes (de nuevo), ¿sabéis si hay alguna forma sencilla de poner un código en Internet, al que pueda acceder cualquiera desde un link? Gracias, Manuel [[alternative HTML version deleted]]

Re: [R-es] poner un código en Internet

2021-03-25 Thread Xavier-Andoni Tibau Alberdi
Saludos, Normalmente para eso se usa Github o Gitlab. Que entre otras muchas cosas permite a los demás señalar si han encontrado errores o sugerir mejoras en el código. Es la forma habitual de compartir código o publicar código que se ha usado en artículos científicos. saludos, Xavier Tibau

[R-es] poner un código en Internet

2021-03-25 Thread Manuel Mendoza
Buenas tardes (de nuevo), ¿sabéis si hay alguna forma sencilla de poner un código en Internet, al que pueda acceder cualquiera desde un link? Gracias, Manuel [[alternative HTML version deleted]] ___ R-help-es mailing list

Re: [R-es] eliminar filas que cumplen cierta condición.

2021-03-25 Thread Jorge I Velez
Manuel, Mira ?subset ?grep ?gsub En casos como este, no está de más hacer names(with(data, table(Clase))) y verificar si existen espacios o no. Felicidades, Jorge.- El El jue, 25 de mar. de 2021 a la(s) 12:12 p. m., Manuel Mendoza < mmend...@fulbrightmail.org> escribió: > Buenas tardes,

Re: [R] How to average minutes per hour per month in the form of '# hours #minutes'

2021-03-25 Thread Dr Eberhard W Lisse
Thanks, that is helpful. But, how do I group it to produce hours worked per week per month? el On 2021-03-25 19:03 , Greg Snow wrote: Here is one approach: tmp <- data.frame(min=seq(0,150, by=15)) tmp %>% mutate(hm=sprintf("%2d Hour%s %2d Minutes", min %/% 60,

Re: [R-es] eliminar filas que cumplen cierta condición.

2021-03-25 Thread Manuel Mendoza
Gracias Jorge, di con la clave: la categoría tiene un espacio delante. > table(data$Clase != " ERL") FALSE TRUE 5 1479 Es la df de agaricus, disponible en internet, por lo que ha tenido que fastidiar a más de uno. Un saludo, Manuel El jue, 25 mar 2021 a las 18:26, jorge.senan ()

Re: [R-es] eliminar filas que cumplen cierta condición.

2021-03-25 Thread jorge.senan
Hola Manuel, Normalmente algo está fallando. No sé si un espacio puede ser el problema. Te recomiendo que mires el resultado en consola de unique(data$Clase) Verás si es un string como está escrito correctamente. Además usando unique(data$Clase)[2] podrás seleccionar el elemento,

[R-es] eliminar filas que cumplen cierta condición.

2021-03-25 Thread Manuel Mendoza
Buenas tardes, hay algo que me tiene desconcertado (prueba de mi desconocimiento): ¿cómo puede obtener estas dos cosas de una misma df con 1484 filas? > table(data$Clase) CYT ERL EXC ME1 ME2 ME3 MIT NUC POX VAC 4635 35 44 51163 244 429 20 30 >

Re: [R] How to average minutes per hour per month in the form of '# hours #minutes'

2021-03-25 Thread Greg Snow
Here is one approach: tmp <- data.frame(min=seq(0,150, by=15)) tmp %>% mutate(hm=sprintf("%2d Hour%s %2d Minutes", min %/% 60, ifelse((min %/% 60) == 1, " ", "s"), min %% 60)) You could replace `sprintf` with `str_glue` (and update the syntax as well)

Re: [R] R-help Digest, Vol 217, Issue 25

2021-03-25 Thread phil
Thank you, Messrs Barradas and Gross, for your very helpful advice. Philip Message: 21 Date: Wed, 24 Mar 2021 22:41:25 -0400 From: "Avi Gross" To: Subject: Re: [R] Including a ggplot call with a conditional geom in a function Message-ID: <07e801d72120$59e5c720$0db15560$@verizon.net>

Re: [R] Including a ggplot call with a conditional geom in a function

2021-03-25 Thread Rui Barradas
Hello, In the following code, the fixed parts of the plot are drawn first, assigning the plot to p. Then geom_hline is conditionally added to p and the result returned to caller. This may be a problem if the conditional geom needs to be in a specified order in the plot. Function plotLineFunc2