ggforestplot error: Error in assertAndRetrieveTidyValue(x, mean) : argument "x" is missing, with no default

Viewed 54

I'm trying to create a forest plot using ggforestplot, but am receiving the error message:

Error in assertAndRetrieveTidyValue(x, mean) : argument "x" is missing, with no default

library(ggforestplot)
library(tidyverse)
library(magrittr)

df_linear <-
  df_linear_associations %>%
  dplyr::arrange(name) %>%
  dplyr::filter(dplyr::row_number() <= 30)

# Forestplot
forestplot(
  df = df_linear,
  estimate = beta,
  logodds = FALSE,
  colour = trait,
  xlab = "1-SD increment in cardiometabolic trait
  per 1-SD increment in biomarker concentration"
)
1 Answers

As @Ilari Scheinin said complete right, this error happens when you have loaded the forestplot package and use the forestplot function. In the following reproducible code you can see that the error happens when doing that:

library(forestplot)
library(ggforestplot)
library(tidyverse)
library(magrittr)

df_linear <-
  df_linear_associations %>%
  dplyr::arrange(name) %>%
  dplyr::filter(dplyr::row_number() <= 30)

# Forestplot
forestplot::forestplot(
  df = df_linear,
  estimate = beta,
  logodds = FALSE,
  colour = trait,
  xlab = "1-SD increment in cardiometabolic trait
  per 1-SD increment in biomarker concentration"
)
#> Error in assertAndRetrieveTidyValue(x, mean): argument "x" is missing, with no default

Created on 2022-07-26 by the reprex package (v2.0.1)

Make sure to unloaded the forestplot!

Code when not loaded forestplot:

When I run your code, there is no error. Maybe try restarting your environment and clean and try again. Here is the reproducible code:

library(ggforestplot)
library(tidyverse)
library(magrittr)

df_linear <-
  df_linear_associations %>%
  dplyr::arrange(name) %>%
  dplyr::filter(dplyr::row_number() <= 30)

# Forestplot
forestplot(
  df = df_linear,
  estimate = beta,
  logodds = FALSE,
  colour = trait,
  xlab = "1-SD increment in cardiometabolic trait
  per 1-SD increment in biomarker concentration"
)

Created on 2022-07-26 by the reprex package (v2.0.1)

Related