Giter Site home page Giter Site logo

arnfinn / dynamisktabellverk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mong/tmongr

0.0 2.0 0.0 26.88 MB

Dynamisk tabellverk (Rshiny)

Home Page: https://skde-analyse.github.io/dynamiskTabellverk/

License: GNU Lesser General Public License v3.0

R 74.85% Dockerfile 0.41% SAS 24.73%

dynamisktabellverk's Introduction

tmongr

Version R build status Codecov test coverage Coveralls test coverage GitHub open issues License: LGPL v3 Doc

This is a R package to produce dynamisk tabellverk web pages. The web page is hosted on www.shinyapps.io and can be found here: https://skde.shinyapps.io/tabellverk/ The data in itself is not included in this package.

How to install the package

remotes::install_github("mong/tmongr")

If behind proxy

Include the following in your ~/.Renviron file before you install the package:

http_proxy=<proxy-url>:<port>
https_proxy=<proxy-url>:<port>

Development

Functions from the shiny package that is not on cran are used when running tests. Thus, the github version of shiny has to be installed to be able to run the tests locally:

remotes::install_github("rstudio/shiny")

Docker

This R package can be added to a docker image together with all R and system dependencies needed to run the the tmongr web application from any docker host.

Build

Since the tmongr R package is to be installed into the image please make sure to build the source tarball first. From a system command terminal navigate into the tmongr-directory and run:

R CMD build .

Then, build the docker image:

docker build -t tmongr .

Run

To run the docker container from a system command terminal do:

docker run -p 80:80 tmongr

Then, open a web browser window and navigate to your localhost at port 80 to use the tmongr web application.

To stop the docker container hit Ctrl + c in the system comman terminal.

Running SAS code

Running the following SAS code will produce the aggregated data used by the shiny app:

%let sasfolder = <folder>\tmongr\sas;

%include "&sasfolder\formater.sas";
%include "&sasfolder\macroer.sas";
%include "&sasfolder\rater_og_aggr.sas";
%include "&sasfolder\tilrettelegging.sas";
%include "&sasfolder\tilretteleggInnbyggerfil.sas";

%include "&sasfolder\avd_tabell.sas";

The following data files will be produced:

<folder>\csv_filer\avd_behandlert19.csv
<folder>\csv_filer\avd_justoverft18.csv
<folder>\csv_filer\avd_fagt18.csv
<folder>\csv_filer\avd_icd10t18.csv

Convert the data to R

The csv files produced by SAS have to be converted to utf-8 and unix file ending format by git bash:

iconv.exe -f CP1252 -t UTF-8 <filename> | dos2unix.exe > unix_<filename>

Then saved as RDS files, as follows:

data <- read.table('../csv_filer/unix_avd_behandlert18.csv', 
                  sep = ",", 
                  header=T, 
                  encoding = 'UTF-8', 
                  stringsAsFactors = FALSE)

names(data) <- tolower(names(data))
saveRDS(data, "data/behandler.rds")

Running the app

# read the data
uten_overf <- readRDS("../tabellverk/data/behandler.rds")
med_overf <- readRDS("../tabellverk/data/justertoverf.rds")

# define `niva`
uten_overf$niva <- "Uten overf"
med_overf$niva <- "Med overf"

# bind the data together
datasett <- rbind(uten_overf, med_overf)

# run the app
run_app()

dynamisktabellverk's People

Contributors

arnfinn avatar dependabot[bot] avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.