Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renv #65

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Renv #65

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .Rprofile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## 1 Renv activation
source("renv/activate.R")

### 2 Load Geospatial libraries
# Set environment variables to point to installations of geospatial libraries ----

## Amend 'LD_LIBRARY_PATH' ----

# Get the existing value of 'LD_LIBRARY_PATH'
old_ld_path <- Sys.getenv("LD_LIBRARY_PATH")

# Append paths to GDAL and PROJ to 'LD_LIBRARY_PATH'
Sys.setenv(LD_LIBRARY_PATH = paste(old_ld_path,
"/usr/gdal34/lib",
"/usr/proj81/lib",
sep = ":"))

rm(old_ld_path)

## Specify additional proj path in which pkg-config should look for .pc files ----

Sys.setenv("PKG_CONFIG_PATH" = "/usr/proj81/lib/pkgconfig")

## Specify the path to GDAL data ----

Sys.setenv("GDAL_DATA" = "/usr/gdal34/share/gdal")


dyn.load("/usr/gdal34/lib/libgdal.so")
dyn.load("/usr/geos310/lib64/libgeos_c.so", local = FALSE)
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,11 @@ In this respository you can find the code used to produce [ScotPHO's Online Prof
- ui scripts: collection of scripts controlling the user interface for various different tabs within the tool.For ease of navigation and code editing each tab of the dashboard has separate ui scripts
- server scripts: collection of scripts controlling server side actions of various tabs.For ease of navigation and code editing each tab of the dashboard has separate server scripts
- www: includes all the images and media used in the app.

##RENV
-The Project makes use of the RENV package to help create a reproducible environment for this repository
-The version of R and all current packages needed to run this project are recorded in the renv lockfile
-The lockfile, renv.lock, records the metadata about every package used for the project so that they can be re-installed in their correct versions as required by the project and also the repos to install from.
-Packages can still be installed as normal but would have quicker install times by using the source argument in the install.packages() function e.g install.packages("package name", type="source"). this will copy binaries from PHS posit package manager directly into your project package library
-Please remember to call renv::snapshot() after installing or updating packages and modifying code to use that new package. this will update the lock file to add data for this new package.Changes will be reflected when pushed to github
-Other users will be made aware of the changes after refreshing their local repo from github. they will have to run renv::restore() or install the packages manually.
1 change: 1 addition & 0 deletions data_preparation.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ prepare_andyp_data <- function(filename, indic_id) {

definition_table <- read.xlsx(paste0(lookups,"Technical_Document.xlsx"),sheet=1,sep.names = " ") %>%
mutate(indicator_number = as.factor(indicator_number)) %>%
#expect N/A to be introduced below as some dates are strings warning of TBC or not active indicators - probably safe to ignore warnings
mutate(across(c(source_last_updated,source_next_update,last_updated,next_update), ~ convertToDate(.)),
days_since_update=day(as.period(floor_date(last_updated, "month") %--% today(), unit="days")),
across(c(source_last_updated,source_next_update,last_updated,next_update), ~ strftime(.,'%b-%Y')))%>%
Expand Down
Loading