parallelsets: Quickly get a D3 js parallel sets plot

Description Usage Arguments Bugs Examples

View source: R/parallelsets.R

Description

This function will take 4 columns of data, format the data, then feed it to parsetR where it will be converted into a D3 plot.

Usage

1
2
parallelsets(dataframe, id, linename, linenumber, n_common = 5,
  return_data = F, ...)

Arguments

dataframe

the dataframe holding the data

id

grouping variable that links the long data. Most likely patient id.

linename

The name of the line - or whatever goes in the bars

linenumber

A column with the numeric line number.

n_common

The n most common treatments you want to include. Others will go into no treatment or other.

return_data

FALSE by default. If true, it will return the formatted data for you to pass to the plotting function yourself.

...

passdown options

Bugs

If you find an issue, post it here and we'll try and fix it: http://go.roche.com/RochePlotissue

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
## Not run: 
          ##### Get data from flatiron ##################
             library(dplyr)


             # data valid today
             valid_date <- Sys.Date()

             # If on Windows, life is no fun
             if (Sys.info()[["sysname"]] == "Windows"){
               Sys.setenv(JAVA_HOME="")  # for java - go to 64bit
             }

             # connect to data
             tdRWDSconnect(
               datalab = FALSE,
               type = "teradataR"
             )

             line.of.therapy <- tdQuery(paste0(
               "
               SELECT
               patientid
               ,LineName
               ,LineNumber
               ,IsMaintenanceTherapy
               FROM rwd_vdm_flatiron.v_cll_lineoftherapy
               WHERE
               VALID_START <= CAST('",paste0(valid_date," 00:00:00"),"' AS TIMESTAMP) AND
               VALID_END >= CAST('",paste0(valid_date," 00:00:00"),"' AS TIMESTAMP)
               ;"
             )) %>%
               filter(
                 # just do lines 1 to 3
                 LineNumber < 4 & LineNumber > 0 &
                   # and ignore maintenence
                   IsMaintenanceTherapy == "False"
               )

             ##### Use function ##################

             RWDSparallelsets(
               dataframe = line.of.therapy,
               id = "PatientID",
               linename = "LineName",
               linenumber = "LineNumber",
               n_common = 3
             )

          
## End(Not run)

epijim/PharmaPlots documentation built on Nov. 4, 2019, 11:54 a.m.