Пожалуйста, посмотрите этот вопрос Stackoverflow , чтобы узнать об этой проблеме. Основываясь на комментариях от @jangorecki
, я внес следующие изменения в **exploit_url.R**
примерно так: '
#' @export
#' @import data.table
exploit_url <- function(df, href, target, anchor, new_col) {
return(df[, (new_col) := paste0("<a href='", df[[href]], "' target='", target, "'>", df[[anchor]], "</a>", "<br>")][, c(1, 3:6, 8)])
}
Выполните шаги 1 и 2, и все позаботится в NAMESPACE
и DESCRIPTION
. Я получаю предупреждение с правильным выводом.
NAMESPACE:
# Generated by roxygen2: do not edit by hand
import(data.table)
ОПИСАНИЕ:
Package: poweR
Title: What the Package Does (One Line, Title Case)
Version: 0.0.0.9000
Authors@R:
person(given = "First",
family = "Last",
role = c("aut", "cre"),
email = "first.last@example.com",
comment = c(ORCID = "YOUR-ORCID-ID"))
Description: What the package does (one paragraph).
License: What license it uses
Encoding: UTF-8
LazyData: true
Imports:
data.table
RoxygenNote: 6.1.1.9000
Выход:
Новое предупреждение:
Warning message:
In `[.data.table`(df, , `:=`((new_col), paste0("<a href='", df[[href]], :
Invalid .internal.selfref detected and fixed by taking a (shallow) copy of the data.table so that := can add this new column by reference. At an earlier point, this data.table has been copied by R (or was created manually using structure() or similar). Avoid names<- and attr<- which in R currently (and oddly) may copy the whole data.table. Use set* syntax instead to avoid copying: ?set, ?setnames and ?setattr. If this message doesn't help, please report your use case to the data.table issue tracker so the root cause can be fixed or this message improved.