Displaying 20 results from an estimated 6000 matches similar to: "round and trailing zero"
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
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,
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,
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]]
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 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>
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
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
2024 Apr 05
1
duplicated() on zero-column data frames returns empty
(I do not know how to make Outlook send plain text, so I avoid apostrophes.)
For what it is worth, I agree with Mark Webster. The discussion by Ivan Krylov is interesting, but if duplicated really treated a row name as part of the row then any(duplicated(data.frame(?))) would always be FALSE. My expectation is that if key1 is a subset of key2 then all(duplicated(df[key1]) >=
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 Apr 07
1
duplicated() on zero-column data frames returns empty
? Fri, 5 Apr 2024 16:08:13 +0000
Jorgen Harmse <JHarmse at roku.com> ?????:
> if duplicated really treated a row name as part of the row then
> any(duplicated(data.frame(?))) would always be FALSE. My expectation
> is that if key1 is a subset of key2 then all(duplicated(df[key1]) >=
> duplicated(df[key2])) should always be TRUE.
That's a good argument, thank you!
Would
2024 May 12
1
duplicated() on zero-column data frames returns empty
(Sorry for only getting back to this more than a month later.)
? Mon, 8 Apr 2024 17:03:00 +0000
Jorgen Harmse <JHarmse at roku.com> ?????:
> 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.
First of all, quantify the
2023 Nov 06
0
I need to create new variables based on two numeric variables and one dichotomize conditional category
Avi: Thank you for checking. I think the optimization is limited. If test is all TRUE or all FALSE then at most one vector is evaluated. Anything beyond that would be very complicated. (Inspect the two expressions and verify that both specify elementwise computations. Then use indexing to shrink the input properly. Take into account all recycling rules for binary operations.)
> ifelse(0:1,
2024 Mar 20
1
Building Packages.
Hmm, looks platform-specific. Under Linux both RStudio and external
R console return
a0b52513622c41c11e3ef57c7a485767
for digest::digest(install.packages)
On 2024-03-20 1:20 p.m., Duncan Murdoch wrote:
> On 20/03/2024 1:07 p.m., Duncan Murdoch wrote:
>> On 20/03/2024 12:37 p.m., Ben Bolker wrote:
>>> ???? Ivan, can you give more detail on this? I've heard this issue
2024 Mar 20
2
Building Packages.
On 20/03/2024 1:07 p.m., Duncan Murdoch wrote:
> On 20/03/2024 12:37 p.m., Ben Bolker wrote:
>> Ivan, can you give more detail on this? I've heard this issue
>> mentioned, but when I open RStudio and run find("install.packages") it
>> returns "utils::install.packages", and running dump() from within
>> RStudio console and from an external
2024 Mar 21
1
Building Packages.
Yes, you're right. The version found in the search list entry for
"package:utils" is the RStudio one; the ones found with two or three
colons are the original.
Duncan Murdoch
On 21/03/2024 5:48 a.m., peter dalgaard wrote:
> Um, what's with the triple colon? At least on my install, double seems to suffice:
>
>> identical(utils:::install.packages,
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
2024 Mar 21
1
Building Packages.
> Turns out that RStudio replaces the install.packages object in the utils
> package.
> Duncan Murdoch
So RStudio unlocks the bindings and alters the exported environment? That seems like another reason to stick to the terminal interface.
>> Thank you. tools:::.install_packages works.
> I'm glad it works, but it shouldn't be necessary to use (and is not
> part of
2018 Aug 03
0
glm Argument-Evaluation Does Not Match Documentation.
Details in documentation: "All of ?weights?, ?subset?, ?offset?, ?etastart? and ?mustart? are evaluated in the same way as variables in ?formula?, that is first in ?data? and then in the environment of ?formula?."
In fact, `data` is usually not an environment, and I have not seen arguments evaluated in `environment(formula)` when `data` is provided. (Information in `environment(formula)`