Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions R/data.table.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@

if (!exists("trimws", "package:base")) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better as

with(R.version, sprintf('%s.%s', major, minor)) >= '3.2.0'

?

Copy link
Copy Markdown
Member Author

@mattdowle mattdowle Oct 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean if (getRversion() >= '3.2.0') I think. The comparison method for the package_version class does the right thing. But see comments in onLoad.R about why we don't switch on version number, but functionality instead. So much so that getRversion() is redefined to be stop() internally as a reminder.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good to know!

# trimws was new in R 3.2.0. Backport it for internal data.table use in R 3.1.0
trimws <- function(x) {
mysub <- function(re, x) sub(re, "", x, perl = TRUE)
mysub("[ \t\r\n]+$", mysub("^[ \t\r\n]+", x))
}
}

dim.data.table <- function(x)
{
.Call(Cdim, x)
Expand Down