Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in obj_is_vector(limits) : could not find function "obj_is_vector" #1918

Closed
Serendipity31 opened this issue Mar 11, 2024 · 2 comments
Closed

Comments

@Serendipity31
Copy link

Issue

I'm exploring the use of various plotting packages that extend the functionality of ggplot2. In trying to replicate various examples from function help files, I keep getting an error related to the obj_is_vector function. Can someone help?

Example 1 (from the cowplot package help files)

library(ggplot2)
library(cowplot)

df <- data.frame(
  x = 1:10, y1 = 1:10, y2 = (1:10)^2, y3 = (1:10)^3, y4 = (1:10)^4
)

p1 <- ggplot(df, aes(x, y1)) + geom_point()
p2 <- ggplot(df, aes(x, y2)) + geom_point()
p3 <- ggplot(df, aes(x, y3)) + geom_point()

cowplot::plot_grid(p1, p2, p3,
  nrow = 3,
  labels = "AUTO",
  label_size = 12,
  align = "v"
)

Example 2 (from the ggbreak package help files)

library(ggplot2)
library(ggbreak)

set.seed(2019-01-19)
d <- data.frame(
  x = 1:20,
  y = c(rnorm(5) + 4, rnorm(5) + 20, rnorm(5) + 5, rnorm(5) + 22)
)
p <- ggplot(d, aes(x, y)) + geom_col()
p + ggbreak::scale_y_cut(breaks=c(7, 18), which=c(1, 3), scales=c(3, 0.5))

Error

In both these examples I get the following error message:

Error in obj_is_vector(limits) : could not find function "obj_is_vector"

Additionally, when I try to update the vctrs package, I get the following message (despite the fact that I've not directly loaded the package):

Warning in install.packages :
  package ‘vctrs’ is in use and will not be installed

I cannot detach or unload the package, and so cannot seem to update it.

Environment

  • Windows 11
  • R v. 4.2.3
  • vctrs v. 0.5.2
  • ggplot2 v. 3.5.0
  • ggbreak v. 0.1.2
  • cowplot v. 1.1.3
@DavisVaughan
Copy link
Member

It does look like you need to update vctrs. Completely shut down R/RStudio, and then open it back up and try install.packages("vctrs") again, or pak::pak("vctrs").

@Serendipity31
Copy link
Author

@DavisVaughan - the second option worked. I hadn't seen that before. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants