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 ove
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, 20
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 1:
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 7:5
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 implementatio
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
appreciated
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 <- s
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 a
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 (i
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
t(aggregate(
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))
14 matches
Mail list logo