I am new to R studio

Hi Guys,
I am very new to data science, and even more new to R studio, unfrotunateley i am not being able to run my first script.
The downloaded binary packages are in
/var/folders/d4/n9lccmwn1w3dkk42c1ljqbh80000gn/T//RtmprAdHiG/downloaded_packages

murders %>%

  • ggplot(aes(population, total, label = abb, color = region)) +
  • geom_point()
    Error in murders %>% ggplot(aes(population, total, label = abb, color = region)) :
    could not find function "%>%"

murders %>%

  • ggplot(aes(population, total, label = abb, color = region)) +
  • geom_point() +
  • geom_text(check_overlap = TRUE)
    Error in murders %>% ggplot(aes(population, total, label = abb, color = region)) :
    could not find function "%>%"
    these are the errors i am getting, I am running a CATALINA OS 10.15.4
    I have installed the latest R studio in the beginning, but i uninstalled it , to re-install an earlier version and i am still facing the same issues , i need some help here.
    thanks

looks like you have not loaded the package where the %>% “pipe” operator comes from. The operator comes from magrittr. However I would recommend to load all the basic tidyverse packages with library(tidyverse)

On https://r4ds.had.co.nz/pipes.html you can find a short introduction how the %>% “pipe” operator works. If you are new to R, "R for Data Science" is a good start: https://r4ds.had.co.nz/

Hi Joel,
Thanks a lot, i have installed and loaded tidyverse packages, i have tried to res-install and re-load the packages endless times.

To get to the bottom of the problem:

  • First make sure that you are working in a new R Session: ctrl + shift + F10 (in windows) or .rs.restartR() in the command line.
  • Second if you load library(tidyverse), what output do you get in the console window?
    Does it look somehow like this?
library(tidyverse)
#> -- Attaching packages -------------------------------------------------------------------------------- tidyverse 1.3.0 --
#> v ggplot2 3.3.0     v purrr   0.3.3
#> v tibble  2.1.3     v dplyr   0.8.5
#> v tidyr   1.0.2     v stringr 1.4.0
#> v readr   1.3.1     v forcats 0.5.0
#> -- Conflicts ----------------------------------------------------------------------------------- tidyverse_conflicts() --
#> x dplyr::filter() masks stats::filter()
#> x dplyr::lag()    masks stats::lag()

Created on 2020-04-13 by the reprex package (v0.3.0)

that's what i get in the console window

Good.

And this is working as well?

library(tidyverse)
mpg %>% select(manufacturer)
#> # A tibble: 234 x 1
#>    manufacturer
#>    <chr>       
#>  1 audi        
#>  2 audi        
#>  3 audi        
#>  4 audi        
#>  5 audi        
#>  6 audi        
#>  7 audi        
#>  8 audi        
#>  9 audi        
#> 10 audi        
#> # ... with 224 more rows

If this is works as well. Could you post a reprex?

A reprex is the preferred way to show folks exactly what you're trying to do, and it'll reproduce any output or error messages you encounter along the way as well, FAQ: What's a reproducible example (`reprex`) and how do I do one?. (copied this sentence from a message by EconomiCurtis in another thread)

1 Like

I tried to Load the reprex package and i got an error as well
library(reprex)

library(reprex)
Error: package or namespace load failed for ‘reprex’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘fs’
that's why i was not able to produce a reprex to post it here

Looks like the packages are not installed in a proper way. I do not know a lot about problems with that. One package that seems to be missing is fs but maybe there are more.

You could try first:
install.packages("reprex")
and I guess dependecies (like fs) should be installed. If you want to make sure that fs is installed:
install.packages("fs")
to install these packages.

However, as I said, maybe there are further problems with the installation, and you would need help from somebody else on community.rstudio.com.

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