fishvice
Needed stuff for R communication with MFRI Oracle
This space has some instructions that really should be somewhere else
This directory where R-packages are stored
Within R one can get information about where packages are stored. On my Windows I get this:
> .libPaths()
[1] "C:/Users/einarhj/AppData/Local/R/win-library/4.4"
[2] "C:/Program Files/R/R-4.4.1/library"
This means that when I install a package, e.g. “stringr” by:
install.packages("stringr")
it gets intalled in the first listed path, i.e. the AppData directory within the user root. There are two problems I have come accross with this:
- the AppData directory is hidden from user. So if e.g. something goes wrong in the installation of a package from the web the user may need to access this directory outside R and remove some files (typically temporary 00_LOCK*** directories that may get generated). There is of course way around getting into the AppData directory for people that know, but the average user does not and should not know such stuff.
- The directories within the AppData may be locked when the user gets the computer from the IT. And hence the package installation fails. Again, the average user should not have to be confronted with such problems.
By the way, the second path “C:/Program Files/R/R-4.4.1/library” contains the “base”-packages that come with R.
The setup on linux is a bit different, e.g. I have on the central computer this:
> .libPaths()
[1] "/home/haf/einarhj/R/x86_64-pc-linux-gnu-library/4.2"
[2] ....
Now here packages that the user installs are in the R directory of the user´s root. Question is similar setup should not be considered for Windows. At least, getting it out of the “AppData” path should be considered in the setup of R.
The {ROracle}-package
Windose users can not install {ROracle} from cran - do this:
pth <- "https://r.hafro.is/bin/windows/contrib/4.2/ROracle_1.3-1.1.zip"
download.file(pth, destfile = "ROracle_1.3-1.1.zip")
install.packages("ROracle_1.3-1.1.zip", repos = NULL, type = "win.binary")
file.remove("ROracle_1.3-1.1.zip")
The {mar}-package
devtools::install_git(
"https://gitlab.hafogvatn.is/dev/mar.git",
dependencies = TRUE)
The old-faithful {geo}-package
remotes::install_github('hafro/geo')
The {tidypax}-package
The ass people use this a lot:
devtools::install_git(
url="https://gitlab.hafogvatn.is/demersal-division/tidypax.git",
quiet=FALSE,
)
Do I get a connection to oracle?
Try via:
library(mar)
connect_mar()
If you get this:
> mar::connect_mar()
User name: ops$einarhj
Connect string: sjor
Server version: 19.0.0.0.0
Server type: Oracle RDBMS
Results processed: 0
OCI prefetch: FALSE
Bulk read: 1000
Bulk write: 1000
Statement cache size: 0
Open results: 0
you are good to go.
If you get something about username and password the oracle-wallet has not been “activated”. Type this in the terminal:
oracle-wallet
Then you hopefully get something like:
Please provide the password for Oracle user ops$yourusername. The
database access credentials will stored in the wallet.
Enter your Oracle database password:
Enter your password and hopefully you are ready to go.
The git-program
Downstream you may need the git-program. It does not come as default in Windows and may not have been installed by Þekking. You can check if you have git by typing the following in a terminal window:
git --version
You get the git-program here, use the point-and-mouse-click method.