Skip to content

Commit

Permalink
more efficient fix for PR#14263 (via PR#18503)
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R/trunk@84182 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
smeyer committed Apr 6, 2023
1 parent 8120f50 commit 008cb90
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
9 changes: 5 additions & 4 deletions doc/NEWS.Rd
Expand Up @@ -272,10 +272,11 @@
free. Test statistics can be suppressed by giving argument
\code{test} a false logical value.

\item The performance of \code{write.table()} has been improved
for data frames with a large number of unclassed columns.
(Thanks to Gabriel Becker's \PR{18500}, prompted by a report from
Toby Dylan Hocking on the R-devel mailing list.)
\item The performance of \code{df[j] <- value} (including for
missing \code{j}) and \code{write.table(df)} has been improved for
data frames \code{df} with a large number of columns. (Thanks to
Gabriel Becker's \PR{18500}, \PR{18503} and discussants, prompted
by a report from Toby Dylan Hocking on the R-devel mailing list.)
\item The matrix multiply operator \code{\%*\%} is now an S3 generic,
belonging to new group generic \code{matrixOps}. From Tomasz
Expand Down
9 changes: 2 additions & 7 deletions src/library/base/R/dataframe.R
Expand Up @@ -15,7 +15,7 @@
# https://www.R-project.org/Licenses/

# Statlib code by John Chambers, Bell Labs, 1994
# Changes Copyright (C) 1998-2022 The R Core Team
# Changes Copyright (C) 1998-2023 The R Core Team


## As from R 2.4.0, row.names can be either character or integer.
Expand Down Expand Up @@ -1052,12 +1052,7 @@ data.frame <-
}
}
else if(p > 0L)
for(jjj in p:1L) { # we might delete columns with NULL
## ... and for that reason, we'd better ensure that jseq is increasing!
o <- order(jseq)
jseq <- jseq[o]
jvseq <- jvseq[o]

for(jjj in order(jseq)[p:1L]) { # we might delete columns with NULL
jj <- jseq[jjj]
v <- value[[ jvseq[[jjj]] ]]
## This is consistent with the have.i case rather than with
Expand Down

0 comments on commit 008cb90

Please sign in to comment.