could not find function "ggplot" -Rstudio cloud

Why does trying out the Rstudio cloud Getting Started Data Visualization Basics 'ggplot(data = mpg) +
geom_point(mapping = aes(x = displ, y = hwy))' give 'Error in ggplot(data = mpg) : could not find function "ggplot"'?

Why does getting started fail, the first tutorial mislead those getting started...?

Did you begin with


Thanks for providing the right specific solution.

No, I didn't begin with library(ggplot2)

The tutorial didn't cover that command before covering using ggplot.

Subsequently, I did use library(ggplot2) after a later tutorial indirectly covered it.

I think that the tutorial should cover the need to use library(ggplot2) before ggplot commands, because it's not unusual for the learner to be practising tutorial commands on Rstudio from the beginning..

This is one of those things that you learn by experience. When R can't find a function that is spelled correctly, think about whether that function may come from a package, and whether that package has not yet been loaded. And of course the package also needs to have been installed. Yes, a tutorial may overlook these things.

Yes there are things you learn from experience.

The first 'Getting started' tutorial should start from the beginning, without assuming prior experience for running what is demonstrated in the tutorial...

by trying out, do you mean that you copy and pasted code from there into a local R studio session ?
That would explain the disconnect I suppose.
The Welcome page does say

this tutorial, we will use the core tidyverse packages, including ggplot2 . I’ve already loaded the packages for you, so let’s begin!

By trying out, i mean trying to run the code in an R session - whether that be a local or cloud R session.

The FIRST GETTING STARTED tutorial does not demonstrate how to load the packages needed to run the tutorial demonstrated R code.

The FIRST GETTING STARTED tutorial demonstrates running code that can't be run by the learners without prior experience, without them already knowing how to load libraries.

The FIRST GETTING STARTED tutorial should cover how to load the libraries needed to run the tutorial R code, or at least a link like there's a link to 'core tidyverse packages' to loading libraries, or at least include the library loading code - rather than only covering how to load libraries in later tutorials.

First things should come first ...

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