similar to: Building Packages.

Displaying 20 results from an estimated 5000 matches similar to: "Building Packages."

2023 Nov 03
1
[EXTERNAL] RE: I need to create new variables based on two numeric variables and one dichotomize conditional category variables.
Yes, that will halve the number of multiplications. If you?re looking for such optimisations then you can also consider ifelse(G=='male', 65L, 58L). That will definitely use less time & memory if WC is integer, but the trade-offs are more complicated if WC is floating point. Regards, Jorgen Harmse. From: avi.e.gross at gmail.com <avi.e.gross at gmail.com> Date: Friday,
2025 Jan 06
2
Extracting specific arguments from "..."
Bert and other on this Chain, The original question asked by Bert Gunter, highlights one of my long standing wishes. Perhaps my wish has already been fulfilled (if it has, please let me know where I can look of fulfill my wish), if it hasn't perhaps someone can grant me my wish. I have tried to understand how to write a function (beyond a basic function), get values of the parameters, and
2025 Jan 06
1
Extracting specific arguments from "..."
Thanks Jorgen. I thought your approach to getting the argument expressions was clever, but somewhat convoluted. I think the usual simple way is to use match.call() (or sys.call() )to get the unevaluated argument expressions; e.g. ... f <- function(...){ match.call() } > f(a = 'red', b = sin(zzz)) f(a = "red", b = sin(zzz)) The return value is an object of class call
2023 Nov 03
2
I need to create new variables based on two numeric variables and one dichotomize conditional category variables.
Just a minor point in the suggested solution: df$LAP <- with(df, ifelse(G=='male', (WC-65)*TG, (WC-58)*TG)) since WC and TG are not conditional, would this be a slight improvement? df$LAP <- with(df, TG*(WC - ifelse(G=='male', 65, 58))) -----Original Message----- From: R-help <r-help-bounces at r-project.org> On Behalf Of Jorgen Harmse via R-help Sent: Friday,
2023 Nov 04
2
I need to create new variables based on two numeric variables and one dichotomize conditional category variables.
I might have factored the gender. I'm not sure it would in any way be quicker. But might be to some extent easier to develop variations of. And is sort of what factors should be doing... # make dummy data gender <- c("Male", "Female", "Male", "Female") WC <- c(70,60,75,65) TG <- c(0.9, 1.1, 1.2, 1.0) myDf <- data.frame( gender, WC, TG ) #
2024 Mar 20
1
Building Packages.
I have a source file with oxygen-style comments (and description & licence files), and I?m trying to build a package. oxygen & devtools seem to work, and the tarball exists, but install.packages balks. Does anyone know what?s happening? Regards, Jorgen Harmse. > roxygenise(package.dir,clean=TRUE) Setting `RoxygenNote` to "7.3.1" ? roxygen2 requires "Encoding:
2024 May 13
1
duplicated() on zero-column data frames returns empty
>?If you would like to try your hand at developing a patch and make a > case for it at R-devel or the Bugzilla, the resources at > <https://contributor.r-project.org/> can be helpful. I am attempting to get admitted onto the Bugzilla at the moment for the data frame cases, fingers crossed! Best Regards,Mark Webster [[alternative HTML version deleted]]
2025 Jan 06
1
Extracting specific arguments from "..."
I think Bert Gunter is right, but do you want partial matches (not found by match), and how robust do you want the code to be? f <- function(?) { pos <- match('a', ...names()) if (is.na(pos)) stop("a is required.") ?elt(pos) } Incidentally, what is the best way to extract the expression without evaluating it? g <- function(...) { pos <-
2024 Apr 08
1
duplicated() on zero-column data frames returns empty
I appreciate the compliment from Ivan and still share the puzzlement at the empty return. What is the policy for changing something that is wrong? There is a trade-off between breaking old code that worked around a problem and breaking new code written by people who make reasonable assumptions. Mathematically, it seems obvious to me that duplicated.matrix(A) should do something like this: v
2025 Jan 07
1
Extracting specific arguments from "..."
It is a pretty tricky topic, but IMO Advanced R [1] steps you through it systematically... you just have to be prepared to follow along in R with the examples as you read it. In particular, the chapter on Functions goes through this. The subtleties of how base R gives you control over these topics is what lead to the tidyverse creating new packages to build such function interfaces. Manipulating
2025 Jan 07
1
Extracting specific arguments from "..."
Jeff: Would you care to offer an example of: "String literals are surprisingly simple alternatives that don't bite you in the butt nearly so often as NSE does." "No" is a perfectly acceptable answer. I would generally agree with you about NSE, but my original query was motivated by something simple. I like to use lattice graphics when I fool around with graphing data, as
2024 Mar 21
1
Building Packages.
I posted a description of their changes this morning. Duncan Murdoch On 21/03/2024 11:37 a.m., avi.e.gross at gmail.com wrote: > With all this discussion, I shudder to ask this. I may have missed the > answers but the discussion seems to have been about identifying and solving > the problem rapidly rather than what maybe is best going forward if all > parties agree. > > What
2025 Jan 07
2
Extracting specific arguments from "..."
Colleagues, My interest is not in writing ad hoc functions (which I might use once to analyze my data), but rather what I will call a system function that might be part of a package. The lm function is a paradigm of what I call a system function. The lm function begins by processing the arguments passed to the function (represented in the function as parameters, see code below.) Much of this
2024 Jul 30
1
round and trailing zero
Duncan Murdoch answered your question, but I have another. Are you going to do some computation with the rounded numbers, or are they just for display? (One thing I like about Excel is that I can change the display format of a cell without changing answers that depend on that cell.) In the latter case, why stash them in a variable? For more control of the display, consider sprintf (or a wrapper
2025 Jan 07
1
Extracting specific arguments from "..."
Interesting discussion. A few things occurred to me. Apologies to Iris Simmons: I mixed up his answer with Bert's question. Bert raises questions about promises, and I think they are related to John Sorkin's question. A big difference between R and most other languages is that function arguments are computed lazily. match.call & substitute tell us what expressions will be evaluated
2024 Mar 21
1
Building Packages.
With all this discussion, I shudder to ask this. I may have missed the answers but the discussion seems to have been about identifying and solving the problem rapidly rather than what maybe is best going forward if all parties agree. What was the motivation for what RSTUDIO did for their version and the decision to replace what came with utils unless someone very explicitly over-rode them by
2023 Nov 05
1
I need to create new variables based on two numeric variables and one dichotomize conditional category variables.
There are many techniques Callum and yours is an interesting twist I had not considered. Yes, you can specify what integer a factor uses to represent things but not what I meant. Of course your trick does not work for some other forms of data like real numbers in double format. There is a cost to converting a column to a factor that is recouped best if it speeds things up multiple times. The
2023 Nov 03
1
I need to create new variables based on two numeric variables and one dichotomize conditional category variables.
df$LAP <- with(df, ifelse(G=='male', (WC-65)*TG, (WC-58)*TG)) That will do both calculations and merge the two vectors appropriately. It will use extra memory, but it should be much faster than a 'for' loop. Regards, Jorgen Harmse. ------------------------------ Message: 8 Date: Fri, 3 Nov 2023 11:10:49 +1030 From: "Md. Kamruzzaman" <mkzaman.m at gmail.com>
2025 Jan 07
1
Extracting specific arguments from "..."
There's an ancient (2003) document on the CRAN "developers' page" https://developer.r-project.org/model-fitting-functions.html that is sort of (but not exactly) what you're looking for ... On 2025-01-07 5:03 p.m., Sorkin, John wrote: > Colleagues, > > My interest is not in writing ad hoc functions (which I might use once to analyze my data), but rather what I
2024 Mar 21
1
Building Packages.
>>>>> Ben Bolker >>>>> on Wed, 20 Mar 2024 13:25:33 -0400 writes: > Hmm, looks platform-specific. Under Linux both RStudio > and external R console return > a0b52513622c41c11e3ef57c7a485767 > for digest::digest(install.packages) Well, platform-specific maybe, notably probably the *RStudio*-version matters (for once). One one