Displaying 20 results from an estimated 2000 matches similar to: "An error message with the command fm<-1m"
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,
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 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
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
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)`
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 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
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>
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 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 May 21
0
Listing folders on One Drive
I would just use
fi <- file.info(dir(path, recursive=TRUE, include.dirs=TRUE))
path could be the OneDrive directory or Scotland (and is not needed if you're already in the directory you want).
Then rownames(subset(fi, isdir)) will contain all the directories. Maybe you want to use grep or other machinery to thin it out.
Regards,
Jorgen Harmse.?
2024 Jul 12
0
grep
which(grepl(....)) looks odd. Doesn't grep by itself return the correct vector of indices?
Regards,
Jorgen Harmse.?
Message: 5
Date: Fri, 12 Jul 2024 17:42:05 +0800
From: Steven Yen <styen at ntu.edu.tw <mailto:styen at ntu.edu.tw>>
To: Uwe Ligges <ligges at statistik.tu-dortmund.de <mailto:ligges at statistik.tu-dortmund.de>>, R-help Mailing List
<r-help at
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 Sep 06
0
BUG: atan(1i) / 5 = NaN+Infi ?
It seems to me that the documentation of R's complex class & R's atan function do not tell us what to expect, so (as others have suggested), some additional notes are needed. I think that mathematically atan(1i) should be NA_complex_, but R seems not to use any mathematically standard compactification of the complex plane (and I'm not sure that IEEE does either).
Incidentally, the
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 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