The same plot always shows up

Hi everybody

In my R Studio, I once plotted a certain function. I deleted R and R Studio and reinstalled it. I made a new Working Directory, cleared the session, looked out for unwanted things in the WD, inspected search paths, checked for auto loading scripts and searched for hidden files. If im plotting a function now, still the once plotted functions shows up. I don't know how this is possible and need help.

Thanks
Mike

Is there any chance you are loading an .Rdata file?

In RStudio try going to
Tools -> Global Options and de-selecting
Workplace
Restore .RData

1 Like

No im really sorry I have tried too. But thanks for your response.

Just guessing now but have a look at Resetting RStudio Desktop's State

1 Like

Im not sure if I've fully understood this guide but I've tried and the problem is still there :frowning:

  • I've tried and the problem is still there *

Blast, I had some hope.

What does

sessionInfo()

give us?

Also can you post any code that you are running when you get that recurring plot?

A handy way to post output is to enclose it in within
```

```

1 Like

Yeah surely
This is the used code, very simple...

hudoc <- hudoc_mb_Kopie
regression1 <- lm(hudoc$cost_exp~hudoc$npd_award)
summary(regression1)
plot(regression1)
sessionInfo()

here is the output of sessionInfo()

R version 4.3.2 (2023-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.2

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: xxx
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices
[4] utils     datasets  methods  
[7] base     

other attached packages:
[1] readxl_1.4.3

loaded via a namespace (and not attached):
 [1] compiler_4.3.2    magrittr_2.0.3   
 [3] cli_3.6.1         tools_4.3.2      
 [5] pillar_1.9.0      glue_1.6.2       
 [7] rstudioapi_0.15.0 tibble_3.2.1     
 [9] utf8_1.2.4        fansi_1.0.5      
[11] cellranger_1.1.0  vctrs_0.6.4      
[13] lifecycle_1.0.4   pkgconfig_2.0.3  
[15] rlang_1.1.2      

Btw the output given is this one

> hudoc <- hudoc_mb_Kopie
> regression1 <- lm(hudoc$cost_exp~hudoc$npd_award)
> summary(regression1)

Call:
lm(formula = hudoc$cost_exp ~ hudoc$npd_award)

Residuals:
    Min      1Q  Median      3Q     Max 
-1160.6  -259.6  -158.6    67.6  7471.9 

Coefficients:
                 Estimate Std. Error t value Pr(>|t|)    
(Intercept)     110.49010   54.26984   2.036   0.0426 *  
hudoc$npd_award   0.05966    0.01105   5.401 1.29e-07 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 697.9 on 321 degrees of freedom
  (6 observations deleted due to missingness)
Multiple R-squared:  0.08331,	Adjusted R-squared:  0.08046 
F-statistic: 29.17 on 1 and 321 DF,  p-value: 1.29e-07

> plot(regression1)
Hit <Return> to see next plot: 
Hit <Return> to see next plot: 
Hit <Return> to see next plot: 
Hit <Return> to see next plot: 

and I think the graph refers to a Shapiro Wilks test I once performed

Ive tried it with a simplified version and its still showing up

my_data <- data.frame(
  variable1= c(1,2,3,4,5),
  variable2= c(2,6,3,9,12)
)
regression <- lm(my_data)
plot(regression)

In the console it is

> my_data <- data.frame(
+   variable1= c(1,2,3,4,5),
+   variable2= c(2,6,3,9,12)
+ )
> regression <- lm(my_data)
> plot(regression)
Hit <Return> to see next plot: 
Hit <Return> to see next plot: 
Hit <Return> to see next plot: 
Hit <Return> to see next plot: 

and the output are four graphs

Im really sorry ive confused myself a lot its clear now I used the wrong function

Okay, do you think the problem is resolved?

Nothing like laying out the problem for someone else to help you cure the problem.

No Than you so much for your effort, it was a complete fault of me, I don't know how I could get so confused. Unfortunately im a beginner.

Thank you very much

It's possible that the previously plotted function is still showing up in your R Studio environment because it's cached or stored in a temporary location. This can happen even if you've deleted R and R Studio and reinstalled them, as the caching mechanism may still retain the function data.

Affordable SEO Services for Small Businesses

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.