I'm using package ncdf4 to read .nc file. After extracting the data, the .nc file stays open by RStudio, so I can't delete or rename the file in windows (I receive the error: "the action can´t be completed because the folder is open in RStudio R session"). There are no connections open. unlink
doesn't solve the problem. The only thing that solves the issue is restarting R session. Any ideas for solution without restarting R?
library(ncdf4)
nc_data <- nc_open("DYsim.nc")
Tcalc <- ncvar_get(nc_data, "dyresmTEMPTURE_Var")
remove(nc_data)