0

Reprex

install.packages("tidyverse") ## general use and data cleaning
library(tidyverse)
library(purrr)
library(lubridate)
library(here)
library(hms)
library(scales)
library(rstudioapi)
install.packages("ggmap")
library(ggmap)

ggplot(data = bikeshare_v8) +
  geom_point(mapping = aes(x = ride_id,
                           y = ride_length))

Task

Analyzing the divvy bikeshare data for the google data analytics course, finding differences between members and casuals.

Problem

Though previously the data could be plotted without incident, ggplot will no longer work. The code chunk still has the left side green bar, and the spinning progress circle is still present in the Rmarkdown output below the code chunk. While this is happening, RAM use keeps accumulating, but even after minutes nothing displayed and the code does not complete.

Solutions Attempted

  • running with only tidyverse installed and loaded - no change
  • running without the project being loaded - just markdown - no change
  • making sure windows defender is excluded from R files - no change

Why did this work before, but not now? How can I get ggplot to work again?

5
  • Sometimes with various packages and updates not everything is compatible. You may try deleting and redownloading R or downloading the previous version of R or the tidyverse package. Commented Nov 22, 2021 at 19:33
  • 1
    if it is a very large dataset, it can take a long time to render. Try something like ggplot(data = slice(bikeshare_v8, 100)) to see the first part of the data and check everything is working Commented Nov 22, 2021 at 19:41
  • 1
    Although you start the question with the word "REPREX", this question is NOT reproducible, as we do not have access to the "bikeshare_8" dataset. Please share it as code with dput(bikeshare_v8) Commented Nov 22, 2021 at 19:42
  • 2
    My first step would be to check whether this only occurs in rmarkdown. Commented Nov 22, 2021 at 20:10
  • 1
    A very common issue is related to having intermediate objects with the same name in the rmarkdown file AND the global environment. Running the code in a fresh session solves many similar cases Commented Nov 22, 2021 at 20:14

1 Answer 1

1

Found the solution - wrong datatype

Lubridate was used to convert the time information to the duration datatype, which ggplot did not like.

Converting to numeric datatype using as.numeric solved the issue.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.