search for: christof

Displaying 20 results from an estimated 464 matches for "christof".

2018 Mar 04
3
Change Function based on ifelse() condtion
...at gmail.com> wrote: > That's fine. The issue is how you called Lapply_me(). What did you pass as > the argument to FUN? > And if you did not pass anything that how is FUN declared? > You have not shown that in your email. > > > > > On Sun, Mar 4, 2018 at 7:11 PM, Christofer Bogaso > <bogaso.christofer at gmail.com> wrote: >> >> My modified function looks below : >> >> Lapply_me = function(X = X, FUN = FUN, Apply_MC = FALSE, ...) { >> if (Apply_MC) { >> return(mclapply(X, FUN, ...)) >> } else { >> if (any(names...
2018 Mar 04
0
Change Function based on ifelse() condtion
...om the "..." list before calling FUN, so FUN is being called with zero arguments, exactly as it is declared. A quick workaround is to change the line Lapply_me(as.list(1:4), function(xx) { to Lapply_me(as.list(1:4), function(xx,dummyList) { HTH, Eric On Sun, Mar 4, 2018 at 7:21 PM, Christofer Bogaso < bogaso.christofer at gmail.com> wrote: > Below is my full implementation (tried to make it simple as for > demonstration) > > Lapply_me = function(X = X, FUN = FUN, Apply_MC = FALSE, ...) { > if (Apply_MC) { > return(mclapply(X, FUN, ...)) > } else { > if (...
2018 Mar 04
2
Change Function based on ifelse() condtion
...(any(names(list(...)) == 'mc.cores')) { myList = list(...)[!names(list(...)) %in% 'mc.cores'] } return(lapply(X, FUN, myList)) } } Here, I am not passing ... anymore rather passing myList On Sun, Mar 4, 2018 at 10:37 PM, Eric Berger <ericjberger at gmail.com> wrote: > Hi Christofer, > Before you made the change that I suggested, your program was stopping at > the statement: list(...) = list(..) .etc > This means that it never tried to execute the statement: > return(lapply(X,FUN,...)) > Now that you have made the change, it gets past the first statement and &...
2018 Mar 04
0
Change Function based on ifelse() condtion
That's fine. The issue is how you called Lapply_me(). What did you pass as the argument to FUN? And if you did not pass anything that how is FUN declared? You have not shown that in your email. On Sun, Mar 4, 2018 at 7:11 PM, Christofer Bogaso < bogaso.christofer at gmail.com> wrote: > My modified function looks below : > > Lapply_me = function(X = X, FUN = FUN, Apply_MC = FALSE, ...) { > if (Apply_MC) { > return(mclapply(X, FUN, ...)) > } else { > if (any(names(list(...)) == 'mc.cores')) { &g...
2018 Mar 04
2
Change Function based on ifelse() condtion
@Eric - with this approach I am getting below error : Error in FUN(X[[i]], ...) : unused argument (list()) On Sun, Mar 4, 2018 at 10:18 PM, Eric Berger <ericjberger at gmail.com> wrote: > Hi Christofer, > You cannot assign to list(...). You can do the following > > myList <- list(...)[!names(list(...)) %in% 'mc.cores'] > > HTH, > Eric > > On Sun, Mar 4, 2018 at 6:38 PM, Christofer Bogaso > <bogaso.christofer at gmail.com> wrote: >> >> Hi,...
2018 Mar 04
0
Change Function based on ifelse() condtion
Hi Christofer, Before you made the change that I suggested, your program was stopping at the statement: list(...) = list(..) .etc This means that it never tried to execute the statement: return(lapply(X,FUN,...)) Now that you have made the change, it gets past the first statement and tries to execute the state...
2010 Jul 10
7
Need help on date calculation
Hi all, please see my code: > library(zoo) > a <- as.yearmon("March-2010", "%B-%Y") > b <- as.yearmon("May-2010", "%B-%Y") > > nn <- (b-a)*12 # number of months in between them > nn [1] 2 > as.integer(nn) [1] 1 What is the correct way to find the number of months between "a" and "b", still
2012 Jan 05
3
selection part of "subset"
...hing like a <- c(10,20,15,43,76,41,25,46) tab <- data.frame(a) name <- "a" for (v in unique(tab[[name]])) { r <- subset(tab, name==v) # this does not work ... } i.e. a "string" on the left side of the select expression (subset). How could I solve this? thx Christof
2023 Nov 29
2
Code editor for writing R code
...Quarto. See https://quarto.org/docs/faq/rmarkdown.html Secondly, the OP stated he was using the VS-Code IDE, so there is no reason to point him to the Posit/RStudio IDE for this functionality which VS-Code supports very well (as I noted in my response.) Best, Eric On Wed, Nov 29, 2023 at 6:55?PM Christofer Bogaso <bogaso.christofer at gmail.com> wrote: > > Hi Sergei, > > Where can I find TeX Comments extension in VS Code? > > On Wed, Nov 29, 2023 at 9:34?PM Sergei Ko <sggp.sergei at gmail.com> wrote: > > > > TeX Comments extension in VS Code > > >...
2012 Oct 02
3
lattice xyplot, get current level
...xyplot(y ~ x | subject, panel = function(x,y) { panel.xyplot(x,y) panel.curve(x,y) { # something that dependents on the current subject ... } }) How I get the current subject? (The current subject is the title of the graph, too) thx Christof
2017 Aug 10
3
Zoo rolling window with increasing window size
...likely want = > "right" (or rollapplyr(), as I used). > > R> set.seed(21) > R> x <- rnorm(10) > R> rs <- rollapplyr(x, seq_along(x), sum) > R> cs <- cumsum(x) > R> identical(rs, cs) > [1] TRUE > > > On Thu, Aug 10, 2017 at 1:28 PM, Christofer Bogaso > <bogaso.christofer at gmail.com> wrote: >> Hi again, >> >> I am wondering there is any function for 'zoo' time series, where I >> can apply a user defined function rolling window basis, wherein window >> size is ever increasing i.e. not fixe...
2012 Dec 14
5
A question on list and lapply
Dear all, let say I have following list: Dat <- vector("list", length = 26) names(Dat) <- LETTERS My_Function <- function(x) return(rnorm(5)) Dat1 <- lapply(Dat, My_Function) However I want to apply my function 'My_Function' for all elements of 'Dat' except the elements having 'names(Dat) == "P"'. Here I have specified the name
2017 Aug 02
4
Extracting numeric part from a string
Hi again, I am struggling to extract the number part from below string : "\"cm_ffm\":\"563.77\"" Basically, I need to extract 563.77 from above. The underlying number can be a whole number, and there could be comma separator as well. So far I tried below : > library(stringr) > str_extract("\"cm_ffm\":\"563.77\"",
2012 Mar 16
4
How to start R in maximized size???
Dear all, when I start R, I want that the console window should be in the Maximized size automatically. Can somebody help me how to achieve that? Thanks and regards,
2011 Nov 10
5
A question on Programming
Dear all. Let say I have a group of codes which will be used in many places in my overall R-code files. These group of codes will be used within a for-loop (with a big length, like 10000 times) and also many other places outside of that for loop. As this group of codes are being used in many places, I thought to put them within a user-defined function. Here my question is, is there any speed
2018 Mar 04
0
Change Function based on ifelse() condtion
Hi Christofer, You cannot assign to list(...). You can do the following myList <- list(...)[!names(list(...)) %in% 'mc.cores'] HTH, Eric On Sun, Mar 4, 2018 at 6:38 PM, Christofer Bogaso < bogaso.christofer at gmail.com> wrote: > Hi, > > As an example, I want to create below kind...
2018 Mar 04
2
Change Function based on ifelse() condtion
...However when Apply_MC = FALSE it generates below error saying : '...' used in an incorrect context Appreciate if you can help me with the correct approach. Thanks, On Sun, Mar 4, 2018 at 9:34 PM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote: > On 04/03/2018 10:39 AM, Christofer Bogaso wrote: >> >> Hi again, >> >> I am looking for some way to alternately use 2 related functions, >> based on some ifelse() condition. >> >> For example, I have 2 functions mclapply() and lapply() >> >> However, mclapply() function has one...
2013 Mar 28
4
How to replace '$' sign?
Hello again, I want to remove "$" sign and replace with nothing in my text. Therefore I used following code: > gsub("$|,", "", "$232,685.35436") [1] "$232685.35436" However I could not remove '$' sign. Can somebody help me why is it so? Thanks and regards
2012 Aug 14
3
self-starter functions for y = a + b * c^x
...(y0 - plateau)*exp(-k*x) + plateau from http://stats.stackexchange.com/questions/17126/how-can-i-make-my-r-nls-model-more-stable works fine, too. But now I search a self-starter for y = a + b * c^x Do you know a package that implement such self-starter or is there a easy way to do it myself? thx Christof
2012 Jun 13
4
lme: extract result-function
...in summary(mod)$coeff B C D E F G (Intercept) b c d e f g i Now I'm interested in the function f <- function(B,C,D,E,F,G) <- { return(i + b*B + c*C + d*D + e*E + f*F + g*G) } Is there a easier way to create such function with flexible number of coefficient, than do it by hand? thx Christof