Sebastian
Sí, es gigantesco anidar if, pero hay una gran ventaja, cuándo hay un caso
raro, un impuesto o cotización muy particular, por ejemplo, ahora en
Argentina tenemos varios valores para las monedas, cuestiones que en un
país normal no existe, en ese esquema, if permite continuar
Hi,
I cannot believe I did that. Usually I remember to add parenthesis but this
time obviously I didn’t. Thank you all so much for answering so quickly.
Thanks,
Monica
On Fri, Apr 17, 2020 at 7:06 PM Peter Langfelder
wrote:
> You need 1:(m-1) in your function. The operator : has precedence
A different solution:
grr2 <- function( rn ) {
f <- function( i ) {
if ( 0 == i %% 2 ) seq.int( i )
else seq( i, 1 )
}
L <- lapply( seq.int( rn - 1 ), f )
do.call( c, L )
}
On April 17, 2020 5:11:40 PM PDT, Jeff Newmiller
wrote:
>A useful help page:
>
>?Syntax
>
>On April 17,
A useful help page:
?Syntax
On April 17, 2020 4:26:19 PM PDT, Rolf Turner wrote:
>
>
>The answer is very simple: parentheses. (Also think about "operator
>precedence".) If you assign rn <- 3, then 1:rn-1 is:
>
>[1] 0 1 2
>
>The "-" operator is applied *after* the ":" operator.
>
>You want
The answer is very simple: parentheses. (Also think about "operator
precedence".) If you assign rn <- 3, then 1:rn-1 is:
[1] 0 1 2
The "-" operator is applied *after* the ":" operator.
You want 1:(rn-1) which gives
[1] 1 2
and the desired result.
cheers,
Rolf Turner
On 18/04/20
https://cran.r-project.org/web/views/Multivariate.html
https://cran.r-project.org/web/views/Environmetrics.html
https://cran.r-project.org/web/views/TimeSeries.html
Also search on "multiresponse GAM" or similar at rseek.org. This brought up
what looked to me like useful hits.
And of course, don't
It might be possible via the VGAM package:
https://cran.r-project.org/package=VGAM
But I've never used this package, so not sure.
It may also be possible to use a single response, by including
additional explanatory terms.
This is what I would do, if I could...
Noting that some GAM
You need 1:(m-1) in your function. The operator : has precedence over -:
> 1:3-1
[1] 0 1 2
> 1:(3-1)
[1] 1 2
Happened to me a few times as well before I remembered.
HTH,
Peter
On Fri, Apr 17, 2020 at 3:50 PM Monica Palaseanu-Lovejoy
wrote:
>
> Hi,
>
> I wrote a relatively simple function. If
Hello,
I am modelling the diet of Nile perch through time. I have 3 diet classes as
my response variables; fish 1, fish 2, and invertebrates.
The response variables are correlated, declines in invert consumption ~
increase in fish consumption. Any advice on how to handle this would be
Hi,
I wrote a relatively simple function. If i run the code inside the function
line by line i am getting the result i was expecting, but if i run the
function, i get a different result.
The function:
grr1 <- function(rn) {
r.up <- c()
for (i in 1:rn-1) {
if (i%%2==0) ru <- seq(1,i) else ru <-
On 2020-04-17 20:06, Medic wrote:
> I can't understand how to do a survival analysis (?Surv ()) when some
> event occurred before the start of observation (left censored). If I
> understand correctly, there are two methods. I chose a method with: 1)
> time from the start of treatment to the event
On 2020-04-17 20:06, Medic wrote:
I can't understand how to do a survival analysis (?Surv ()) when some
event occurred before the start of observation (left censored). If I
understand correctly, there are two methods. I chose a method with: 1)
time from the start of treatment to the event and 2)
I can't understand how to do a survival analysis (?Surv ()) when some
event occurred before the start of observation (left censored). If I
understand correctly, there are two methods. I chose a method with: 1)
time from the start of treatment to the event and 2) the indicator of
the event. I did
Hola Marcelino. No conocía la función. Me la voy a anotar. Gracias. Saludos, Sebastián. Enviado desde Correo para Windows 10 De: Marcelino De La Cruz RotEnviado: viernes, 17 de abril de 2020 13:46Para: Emilio L. Cano; residuo.so...@gmail.comCC: Lista R; Javier MarcuzziAsunto: RE: [R-es] Convertir
Emilio, muchas gracias. Era lo que estaba buscando. Saludos, Sebastián. Enviado desde Correo para Windows 10 De: Emilio L. CanoEnviado: viernes, 17 de abril de 2020 12:55Para: residuo.so...@gmail.comCC: Javier Marcuzzi; Lista RAsunto: Re: [R-es] Convertir lista de precios a dolares por gramo Hola,
Hola:
Tambi�n se podr�a hacer con R base, usando la funci�n match:
precios$Peso.gr <- precios$Peso * ratios$Ratio[match(precios$Unidad,
ratios$Unidad)]
precios$Precio.S <- precios$Precio * tipos$TC[match(precios$Pa�s, tipos$Pa�s)]
precios$Precio.S.gr <- precios$Precio.S/precios$Peso.gr
Hola,
Hay muchas formas de hacerlo en una sola línea. A mí me gusta con dplyr, te
pego debajo un ejemplo reproducible
Salud,
Emilio L. Cano
http://emilio.lcano.com
——
precios <- read.table(
text ="Producto País Precio Unidad Peso
A AR 10 kg 12
B BR 210 lb 0,5
C UY 3,5 kg 90
A BR 3 kg 3
C CO
Javier: Si lo empecé a hacer con if anidados pero me queda gigantesco. Saludos, Sebastián. Enviado desde Correo para Windows 10 De: Javier MarcuzziEnviado: jueves, 16 de abril de 2020 19:16Para: Sebastian KrukCC: Lista RAsunto: Re: [R-es] Convertir lista de precios a dolares por gramo Estimado
I think we could stick to capital `R-`. A few false positives, if any,
are probably harmless.
Vitalie
On Fri, 17 Apr 2020 at 02:18, Tyler Smith via ESS-help
wrote:
>
> I have some TeX-related stuff:
>
> r-mpost
> r-pmpost
> r-upmost
>
> I don't know what they do, I assume they were pulled in
Some comments on the contributions:
a) for Petr's suggestion, to return the desired structure modify the
statement to
t(aggregate(t(dfr), list(idx), median)[,-1])
And, although less readable, can certainly be put in a one-liner
solution by removing the idx definition
Hi Peter,
I worked out a neat function to add the century to short dates. It
works fine on its own, but sadly it bombs when used with sapply. Maybe
someone else can point out my mistake:
add_century<-function(x,changeover=68,previous=19,current=20,pos=1,sep="-") {
xsplit<-unlist(strsplit(x,sep))
Hi
As usual in R, things could be done by different ways.
idx <- (0:(ncol(dfr)-1))%/%3
aggregate(t(dfr), list(idx), median)
Group.1 V1 V2 V3
1 0 2 3 4
2 1 4 5 1
Results should be OK although its structure is different, performance is not
tested.
Cheers
Petr
>
Hola Sebastián,
Se puede hacer de muchas formas. Para mí la más cómoda y rápida es con el
paquete dplyr, te pego debajo ejemplo reproducible.
Un saludo,
Emilio L. Cano
http://emilio.lcano.com
——
precios <- read.table(
text ="Producto País Precio Unidad Peso
A AR 10 kg 12
B BR 210 lb 0,5
C
23 matches
Mail list logo