Skip to content

Tibble error  #1566

Closed
Closed
@amaraftery

Description

@amaraftery

I keep getting this error and tried various ways of fixing it without luck.
The x argument of as_tibble.matrix() must have unique column names if .name_repair is
omitted as of tibble 2.0.0.
ℹ Using compatibility .name_repair.
ℹ The deprecated feature was likely used in the tidyr package.
Please report the issue at https://github.com/tidyverse/tidyr/issues.
This warning is displayed once every 8 hours.
Call lifecycle::last_lifecycle_warnings() to see where this warning was generated.
Called from: FUN(X[[i]], ...)

#Fun
function (gdef, theme, gglayout)
{
if (inherits(gdef, "colorbar")) {
gdef$key <- gdef$key[!is.na(gdef$key$.value), ]
decor <- gdef$decor %||% gdef$bar
rng <- range(decor$value)
decor$value <- scales::rescale(decor$value, from = rng)
if (!"decor" %in% names(gdef)) {
gdef$key$.value <- scales::rescale(gdef$key$.value,
from = rng)
}
vals <- lapply(gglayout[c("xaxis", "yaxis")], function(ax) {
if (identical(ax$tickmode, "auto"))
ax$ticktext
else ax$tickvals
})
list(x = vals[[1]][[1]], y = vals[[2]][[1]], name = gdef$hash,
type = "scatter", mode = "markers", opacity = 0,
hoverinfo = "skip", showlegend = FALSE, marker = list(color = c(0,
1), colorscale = setNames(decor[c("value", "colour")],
NULL), colorbar = list(bgcolor = toRGB(theme$legend.background$fill),
bordercolor = toRGB(theme$legend.background$colour),
borderwidth = unitConvert(theme$legend.background[[linewidth_or_size(theme$legend.background)]],
"pixels", "width"), thickness = unitConvert(theme$legend.key.width,
"pixels", "width"), title = gdef$title, titlefont = text2font(gdef$title.theme %||%
theme$legend.title), tickmode = "array", ticktext = gdef$key$.label,
tickvals = gdef$key$.value, tickfont = text2font(gdef$label.theme %||%
theme$legend.text), ticklen = 2, len = 1/2)))
}
else {
NULL
}
}
#I think this function is causing the error

percX.withinY.argTest <- function(df, groupVar, xVar) {
keepGoing <- TRUE # Assume no problems initially.

Check if 'df' is a dataframe

if (!is.data.frame(df)) {
warning("The first argument must be a dataframe.")
keepGoing <- FALSE
} else if (nrow(df) == 0) {
warning("The dataframe has zero rows.")
keepGoing <- FALSE
}

Check if 'groupVar' and 'xVar' are character strings

if (!is.character(groupVar)) {
warning(sprintf(""%s" is not a character string. The second argument must be a character string name of a column in the dataframe.", groupVar))
keepGoing <- FALSE
}

if (!is.character(xVar)) {
warning(sprintf(""%s" is not a character string. The third argument must be a character string name of a column in the dataframe.", xVar))
keepGoing <- FALSE
}

Check if the dataframe contains the specified columns

if (keepGoing) {
dfHasGroupVar <- groupVar %in% names(df)
dfHasXVar <- xVar %in% names(df)

if (!dfHasGroupVar || !dfHasXVar) {
  missingVars <- c()
  if (!dfHasGroupVar) missingVars <- c(missingVars, groupVar)
  if (!dfHasXVar) missingVars <- c(missingVars, xVar)
  warning(sprintf("The following variables are not columns in the dataframe: %s", paste(missingVars, collapse = " and ")))
  keepGoing <- FALSE
}

}

return(keepGoing) # Return FALSE if any checks fail.
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions