0

I'm new to Rstudio programming and I got problem with creating a PDF, R show error that 'can't find scatterplot function' and can't process with PDF creation. I've been able to create test PDF, though.

The problematic chunk looks like this:

scatterplot(tablica$kurs, tablica$stopa_procentowa,
             smoother=NULL, 
             reg.line = lm,
             boxplots=FALSE, 
             main="Wykres rozrzutu dla zmiennych kursy i stopy procentowej")

I have installed packeges:

library("readxl")
library("magrittr")
library("dplyr")
library("plotly")
library("tinytex")
library("gridExtra")
library("reshape2")
library("kableExtra")
library("stargazer")
library("tseries")
library("stats")
library("knitr")

And also car.

camille
  • 16,432
  • 18
  • 38
  • 60
Ilona
  • 1
  • 1
    This doesn't seem to actually be about rmarkdown, just a matter of whether you remembered to load the packages you want to use. Loading a package and installing a package aren't the same thing – camille Feb 11 '23 at 03:49
  • They are installed and loaded. – Ilona Feb 11 '23 at 16:45
  • Is the package you need loaded within the markdown document, not just within your session? Knitting generally sets up a temporary environment separate from your session. Within the 2 chunks of code you posted, you haven't loaded `car`, assuming that's the package `scatterplot` comes from – camille Feb 12 '23 at 16:34

1 Answers1

0

The scatterplot() function is from the car package. You must load the package using

library(car)
Raniere Silva
  • 2,527
  • 1
  • 18
  • 34