Displaying 20 results from an estimated 38 matches for "xtfrm".
Did you mean:
xterm
2024 Jul 12
1
xftrm is more than 100x slower for AsIs than for character vectors
...combining multiple data frames
derived from DataFrame and base::data.frame. I observed that the index
column of intermediate tables was of class <AsIs> (automatically
converted from character). The problem occurred mainly when using the
sorted = T option in base::merge.
This can be traced to xtfrm.AsIs being more than 100 times slower than
the comparable function for character vectors.
x = paste0("A_", 1:1e5)
system.time({o <- xtfrm(x)})
#? user? system elapsed
#? 0.325?? 0.005?? 0.332
x <- I(x)
system.time({o <- xtfrm(x)}) # this calls xtfrm.AsIs
# user? system elapse...
2024 Jul 14
2
xftrm is more than 100x slower for AsIs than for character vectors
? Fri, 12 Jul 2024 17:35:19 +0200
Hilmar Berger via R-devel <r-devel at r-project.org> ?????:
> This can be finally traced to base::rank() (called from
> xtfrm.default), where I found that
>
> "NB: rank is not itself generic but xtfrm is, and rank(xtfrm(x), ....)
> will have the desired result if there is a xtfrm method. Otherwise,
> rank will make use of ==, >, is.na and extraction methods for classed
> objects, possibly rather sl...
2008 Sep 09
1
'xtfrm' performance (influences 'order' performance) in R devel
Hello everybody,
it looks like the presense of some (do know know which) S4 methods for a
given S4 class degrades the performance of xtfrm (used in 'order' in new
R-devel) by a factor of millions. This is for classes that ARE derived
from numeric directly and thus should be quite trivial to convert to
numeric.
Consider the following example:
setClass("TimeDateBase",
representation("numeric", mode=&qu...
2009 May 30
2
degraded performance with rank()
...that creates an object that is essentially a
classed version of numeric. I updated recently from 2.7.1 to 2.9.0,
and merges involving my class suddenly took a huge performance hit.
I've traced the problem to something near rank(). From NEWS, it seems
rank() etc. changed in 2.8.0. Methods for xtfrm() are supposed to
help, but I've had no success. There was some chatter about this in
the archives back in Sept 08 (though apparently regarding S4), with a
suggestion that it is related to `[.` methods. That has been my
experience. In the toy example below, the problem disappears if
`[.my` i...
2024 Apr 27
1
max on numeric_version with long components
...000000", "1.0.3.10000000",
> "1.0.2.10000000")))
> [1] ?1.0.3.10000000?
Thank you Jon for spotting this!
This is an unintended consequence of
https://bugs.r-project.org/show_bug.cgi?id=18697.
The old behaviour of max(<numeric_version>) was to call
which.max(xtfrm(x)), which first produced a permutation that sorted the
entire .encode_numeric_version(x). The new behavioiur is to call
which.max directly on .encode_numeric_version(x), which is faster (only
O(length(x)) instead of a sort).
What do the encoded version strings look like?
x <- numeric_version(...
2017 Oct 15
2
Function 'factor' issues
In R devel, function 'factor' has been changed, allowing and merging duplicated 'labels'.
Issue 1: Handling of specified 'labels' without duplicates is slower than before.
Example:
x <- rep(1:26, 40000)
system.time(factor(x, levels=1:26, labels=letters))
Function 'factor' is already rather slow because of conversion to character. Please don't add slowdown.
2009 Nov 27
0
Long execution time for quantile() and difftime objects (PR#14092)
...this is not implemented.
There is no claim that it works (let alone works well) for class
"difftime". If you follow the link to 'sort' it says
The default ?sort? method makes use of ?order? for objects with
classes, which in turn makes use of the generic function ?xtfrm?.
and from ?xtfrm
The default method will make use of ?==? and ?>? methods for the
class of ?x[i]? (for integers ?i?), and the ?is.na? method for the
class of ?x?, but might be rather slow when doing so.
So, if you want this to be fast, you need to write an xtfrm method.
Th...
2014 Sep 08
2
Problem with order() and I()
I have found that order() fails in a rather arcane circumstance, as in
this example:
> foo <- I( c('x','\265g') )
> order(foo)
Error in if (xi > xj) 1L else -1L : missing value where TRUE/FALSE needed
> foo <-c('x','\265g')
> order(foo)
[1] 1 2
> sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: x86_64-apple-darwin13.1.0 (64-bit)
2009 Nov 27
1
Long execution time for quantile() and difftime objects (PR#14091)
Full_Name: Hong Ooi
Version: 2.10.0
OS: Windows XP
Submission from: (NULL) (203.110.235.1)
While trying to get summary statistics on a duration variable (the difference
between a start and end date), I ran into the following issue. Using summary or
quantile (which summary calls) on a difftime object takes an extremely long time
if the object is even moderately large.
A reproducible example:
2024 Apr 27
1
max on numeric_version with long components
I've noticed something in R devel which seems a little off and not the
behavior I see in 4.4.0 or earlier versions. With numeric_versions that
have long (>8 digit) final components max and min return the first element
and not the max or min:
In devel:
> max(numeric_version(c("1.0.1.100000000", "1.0.3.100000000",
"1.0.2.100000000")))
[1] ?1.0.1.100000000?
2017 Oct 18
0
Function 'factor' issues
...r in factor construction.
> Another thing: Function 'factor' in R devel uses 'order' instead of 'sort.list'.
This has been by a change on purpose --- well documented as new
feature in NEWS --- to allow using *methods* for order(),
i.e. for the workhorse of order, xtfrm() so that factor(OB)
works for more general objects OB.
> The case of as.factor(x) for
> x <- as.data.frame(character(0))
> in tests/isas-tests.Rout.save reveals that 'order' on data frame is strange.
> x <- as.data.frame(character(0))
> y <-...
2017 Oct 21
0
Function 'factor' issues
...r in factor construction.??
? ? > Another thing: Function 'factor' in R devel uses 'order' instead of 'sort.list'.
This has been by a change on purpose --- well documented as new
feature in NEWS --- to allow using *methods* for order(),
i.e. for the workhorse of order, xtfrm()? so that factor(OB)
works for more general objects OB.
? ? > The case of as.factor(x) for
? ? > x <- as.data.frame(character(0))
? ? > in tests/isas-tests.Rout.save reveals that 'order' on data frame is strange.
? ? > x <- as.data.frame(character(0))
? ? > y <-...
2010 Jan 16
1
order() fails on a chr object of class "AsIs" with "\265" in it
Here's an example (session info at the end).
> tmpv <- c('\265g/L','Bq/L')
> order(tmpv)
[1] 2 1
> tmpv <- I(tmpv)
> order(tmpv)
Error in if (xi > xj) 1L else -1L : missing value where TRUE/FALSE needed
> foov <- gsub('\265','',tmpv)
> order(foov)
[1] 2 1
> str(tmpv)
Class 'AsIs' chr [1:2] "\265g/L"
2024 Jul 14
1
xftrm is more than 100x slower for AsIs than for character vectors
...w.names which is I(row.names(x)) to the corresponding input table (using I() since revision 39026 to avoid conversion of character to factor). When this column is used for sorting (sort=TRUE by default in merge; should happen at least if all.x=T or all.y=T), this will result in slower execution.
xtfrm.AsIs is unchanged since its addition in r50992 (likely unrelated to the former).
So I guess that this just went unnoticed since it will not cause problems on small data frames.
Best regards
Hilmar
[[alternative HTML version deleted]]
2011 Jan 11
1
sorting question
Hi,
I have a data frame with variables a, b, c (character vars) and t (time var,
could be represented as POSIXct or character, depending on which is most useful.
The format is "yyyy-mm-dd hh:mm:ss CET"). Now, I want to sort the data frame in
ascending order by a, b, c and then in descending order by t.
Here's what I've got, but I'm not sure how to put the
2013 Oct 03
1
version comparison puzzle
...max(pp2 <- package_version(c("1.0.3","1.0.4","1.0.5")))
## [1] ?1.0.5?
I've looked at ?package_version , to no avail.
Since max() goes to .Primitive("max")
I'm having trouble figuring out where it goes from there:
I **think** this is related to ?xtfrm , which goes to
.encode_numeric_version, which is doing something I really
don't understand (it's in base/R/version.R ...)
.encode_numeric_version(pp1)
## [1] 1 1 1
## attr(,"base")
## [1] 99999912
## attr(,"lens")
## [1] 3 3 3
## attr(,".classes")
## [1] &quo...
2010 May 05
1
testInstalledBasic question
...;
[78] "seq.int" "sign" "signif" "sin" "sinh"
"sqrt" "sum"
[85] "tan" "tanh" "trigamma" "trunc" "xtfrm"
"|"
Which confuses me, because the calling code in tests\\primitives.R removes
the first 15 elements, which includes ">=" which the test is failing on.
To check (and because testInstalledBasic is calling out to a separate, new R
process), I repea...
2024 Jul 16
1
I() in merge (was: Re: xftrm is more than 100x slower for AsIs than for character vectors)
...which is I(row.names(x)) to the corresponding input table (using I() since revision 39026 to avoid conversion of character to factor). When this column is used for sorting (sort=TRUE by default in merge; should happen at least if all.x=T or all.y=T), this will result in slower execution.
>
> xtfrm.AsIs is unchanged since its addition in r50992 (likely unrelated to the former).
>
> So I guess that this just went unnoticed since it will not cause problems on small data frames.
>
> Best regards
>
> Hilmar
>
> [[alternative HTML version deleted]]
>
> ______________...
2009 Mar 27
2
Sorting problem
Hi, everyone,
I was trying to sort a data frame by two columns, one increasing, the other
decreasing and got an error.
"Error in FUN(left) : invalid argument to unary operator",
The command is "BA[order(BA[1],-BA[2]),]". BA is the data frame. It was
working if I used increasing on both columns.
Why the decreasing symbol "-" is not working here? Thanks.
--
Jun
2008 Oct 22
1
R 2.8.0 qqnorm produces error with object of class zoo?
...ets[1:10, "DAX"])
daxr <- diff(log(dax))
identical(as.vector(qnorm(daxr)), qnorm(coredata(daxr)))
qqnorm(coredata(daxr))
qqnorm(daxr)
qqnorm() produces an error:
> qqnorm(daxr)
Fehler in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
Argument hat L?nge 0
Calls: qqnorm ... xtfrm.default -> as.vector -> rank -> switch -> .gt
Ausf?hrung angehalten
However, this is not witnessed by running the script through R 2.7.2 (attached are the two output files). Incidentally, the QQ-plot is produced if one uses "qqnorm(coredata(daxr))" under R version 2.8.0. Aft...