aes_string()` was deprecated in ggplot2 3.0.0

Hello,

Super new to Rstudio and R programming in general. Learning to analysis data using the GeoMxTools and NanostringNCTools ( Analyzing GeoMx-NGS RNA Expression Data with GeomxTools (bioconductor.org)).

Been getting this error:
Warning: aes_string() was deprecated in ggplot2 3.0.0.
Please use tidy evaluation ideoms with aes()Error in .standalone_types_check_dot_call(ffi_standalone_check_number_1.0.7, :
object 'ffi_standalone_check_number_1.0.7' not found

What's the simplest way to get over this hurdle?
It can't seem to find 'ffi_standalone_check_number_1.0.7' which wasn't an issue a month ago.

Is there another ggplot version I should try to install instead that will work?
Thank you in advance.

Hi, welcome to the forum.
We are now up to ggplot2 v3.4.3. It looks like aes_string() is no longer supported and likely has been superseded by something new.

Probably the best thing to do is provide some code and sample data that will show us what you are trying to do. Someone should be able to show you the new or alternative way to get the some results

Have a look at FAQ Asking Questions.

A handy way to supply some sample data is the dput() function. In the case of a large dataset something like dput(head(mydata, 100)) should supply the data we need. Just do dput(mydata) where mydata is your data. Copy the output and paste it here.

Hi, they're 'soft-deprecated' so can be used:

from Define aesthetic mappings programmatically — aes_ • ggplot2 (tidyverse.org)

All these functions are soft-deprecated. Please use tidy evaluation idioms instead. Regarding aes_string(), you can replace it with .data pronoun. For example, the following code can achieve the same mapping as aes_string(x_var, y_var).

x_var <- "foo"
y_var <- "bar"
aes(.data[[x_var]], .data[[y_var]])

Regarding the function:

QC_histogram <- function(assay_data = NULL,
                         annotation = NULL,
                         fill_by = NULL,
                         thr = NULL,
                         scale_trans = NULL) {
  plt <- ggplot(assay_data,
                aes_string(x = paste0("unlist(`", annotation, "`)"),
                           fill = fill_by)) +
    geom_histogram(bins = 50) +
    geom_vline(xintercept = thr, lty = "dashed", color = "black") +
    theme_bw() + guides(fill = "none") +
    facet_wrap(as.formula(paste("~", fill_by)), nrow = 4) +
    labs(x = annotation, y = "Segments, #", title = annotation)
  if(!is.null(scale_trans)) {
    plt <- plt +
      scale_x_continuous(trans = scale_trans)
  }
  plt
}


QC_histogram(sData(demoData), "Trimmed (%)", col_by, 80)

Can you provide an example of what demoData looks like? Perhaps using the info in @jrkrideau 's post?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.