When I'm running the following R code in RStudio I get suitable results/plots:
# Load Libraries
library(maptools)
library(spatstat)
library(gstat)
library(rgdal)
# Define File Paths
path_data <- file.path(getwd(), "Data")
path_export <- file.path(getwd(), "Export")
# Read Data
file_oil <- file.path(path_data, "OilCont.shp")
points_oil <- readOGR(file_oil)
# Variograms
kwges_vgm <- variogram(log_Kwges~1, data = points_oil)
plot(kwges_vgm)
estimated_model <- vgm(1, "Sph", 80, 0.1)
plot(kwges_vgm, model = estimated_model)
But when I run the same code in VSCode I get the following error message for the second plot():
2: In plot.window(...) : "model" is no graphic parameter
3: In plot.xy(xy, type, ...) : "model" ist kein Grafikparameter
4: In axis(side = side, at = at, labels = labels, ...) :
"model" ist kein Grafikparameter
5: In axis(side = side, at = at, labels = labels, ...) :
"model" ist kein Grafikparameter
6: In box(...) : "model" ist kein Grafikparameter
7: In title(...) : "model" ist kein Grafikparameter
it's in german so I translated the first line in english
It seems like the plot.gstatVariogram() is not working properly in VSCode. I'm running VSCode with the R Extension for Visual Studio Code and all the suggested optional extensions.
Does anyone have the same issue or a solution for this?
Ok, now I got a solution for me: when I'm running the code in single lines (Ctrl + Enter) respectively (Ctrl + Shift + Enter) for all the code instead of Run Source (Ctrl + Shift + S) the plots are generated properly in VSCode.