dewittpe / cpr

Control Polygon Reduction: Methods for quick and efficient placement of internal knots for B-splines and tensor products of B-splines.
http://www.peteredewitt.com/cpr/
2 stars 0 forks source link

local variable .data needs better name #35

Closed dewittpe closed 2 years ago

dewittpe commented 6 years ago

After #33, I'm importing .data from dplyr. There are several places in the code where I have a local object named .data. It would be preferable to use a different name for this object. A quick grep of the R directory yields the following (based on comit 662ef5f)

bsplines.R:  .data <- tidyr::gather_(cbind(as.data.frame(bmat), "x" = xvec),
bsplines.R:  .data$spline <- factor(as.numeric(gsub("V(\\d+)", "\\1", .data$spline)))
bsplines.R:  .data <- dplyr::tbl_df(.data)
bsplines.R:    ggplot2::ggplot(.data) +
cp.R:  .data <- dplyr::mutate_(dplyr::bind_rows(cps, .id = "row"),
cp.R:  .data <- dplyr::rename_(.data, .dots =
cp.R:  .data <- dplyr::bind_rows(.data, knot_data, spline_data, .id = 'object')
cp.R:  .data$object <- factor(.data$object, levels = 1:3, labels = c("cp", "knots", "spline"))
cp.R:    ggplot2::ggplot(.data) +
cpr-package.R:#' @importFrom rlang .data
generate_cp_formula_data.R:#' @param .data the data set containing the variables in the formula
generate_cp_formula_data.R:generate_cp_formula_data <- function(f, .data) {
generate_cp_formula_data.R:  # get a list of the variables and subset the .data
generate_cp_formula_data.R:  data_nobsplines_nobars <- dplyr::select_(.data, .dots = vars_nobsplines_nobars)
generate_cp_formula_data.R:                                     data = .data))[, -1]
generate_cp_formula_data.R:    dplyr::select_(.data, .dots = dplyr::setdiff(intersect(all.vars(lme4::subbars(f)), names(.data)),
generate_cp_formula_data.R:factors_characters_in_f <- function(f, .data) {
generate_cp_formula_data.R:  # get a list of the variables and subset the .data
generate_cp_formula_data.R:  data_nobsplines_nobars <- dplyr::select_(.data, .dots = vars_nobsplines_nobars)
influence_of.R:  .data <- lapply(plots, getElement, name = "data")
influence_of.R:  .data <- dplyr::bind_rows(.data, .id = "index")
influence_of.R:  .data$index <- factor(.data$index,
influence_of.R:  ggplot2::`%+%`(plots[[1]], .data) +
influence_weights.R:             dplyr::group_by(.data$iknots) %>%
influence_weights.R:             dplyr::summarize(max(.data$w))
plot.cpr_cn.R:  .data <- do.call(get_surface, get_surface_args)
plot.cpr_cn.R:            c(list(x = unique(.data$cn[[1]]),
plot.cpr_cn.R:                   y = unique(.data$cn[[2]]),
plot.cpr_cn.R:                   z = matrix(.data$cn[[3]],
plot.cpr_cn.R:                              nrow = dplyr::n_distinct(.data$cn[[1]]),
plot.cpr_cn.R:                              ncol = dplyr::n_distinct(.data$cn[[2]]))),
plot.cpr_cn.R:              c(list(x = unique(.data$surface[[1]]),
plot.cpr_cn.R:                     y = unique(.data$surface[[2]]),
plot.cpr_cn.R:                     z = matrix(.data$surface[[3]],
plot.cpr_cn.R:                                nrow = dplyr::n_distinct(.data$surface[[1]]),
plot.cpr_cn.R:                                ncol = dplyr::n_distinct(.data$surface[[2]]))),
plot.cpr_cn.R:              c(list(x = unique(.data$surface[[1]]),
plot.cpr_cn.R:                     y = unique(.data$surface[[2]]),
plot.cpr_cn.R:                     z = matrix(.data$surface[[3]],
plot.cpr_cn.R:                                nrow = dplyr::n_distinct(.data$surface[[1]]),
plot.cpr_cn.R:                                ncol = dplyr::n_distinct(.data$surface[[2]]))),
plot.cpr_cn.R:  invisible(.data)
dewittpe commented 2 years ago

done