visualize: Visualize columns of the data set

Description Usage Arguments Examples

View source: R/visualize.r

Description

This function works with single or multiple columns. When given an array of multiple columns as columns argument, all nonnumeric columns are converted to numeric class in the plot. This function creates a combined plot with individual plots for each identified group (if the group_by was used) in the current data set. Any supplied arguments other than the ones described are passed on to the plotting functions.

Usage

1
visualize(av_state, columns, ...)

Arguments

av_state

an object of class av_state

columns

specifies the columns to be displayed. When given the name of a single column, the function behaves differently depending on the class of the column:

  • If the class of the column is factor, the column is seen as a nominal column, and the following arguments are accepted: visualize(column,type=c('PIE','BAR','DOT','LINE'),title="",...). All plots also accept the xlab argument, e.g., xlab='minuten'. Furthermore, when the type is 'BAR', an additional argument horiz can be supplied (horiz is FALSE by default), which will draw horizontal bar charts instead of vertical ones. To show values over time rather than total values, the 'LINE' type can be used. Example: visualize('PHQ1') (assuming 'PHQ1' is a factor column).

  • If the class of the column is numeric, the column is seen as a scale column, and the following arguments are accepted: visualize(column,type=c('LINE','BOX'),title="",...). Furthermore, when the type is 'LINE', an additional argument acc can be supplied (acc is FALSE by default), which will plot lines of accumulated values rather than the individual values. Example: visualize('minuten_sport',type='LINE',acc=TRUE) (assuming 'minuten_sport' is a numeric column).

When the columns argument is given a vector of column names, the columns are either shown as multiple lines in a line plot (when type='LINE'), or the sums of the columns are displayed in the plots (for any of the other types). When given a vector of column names as the columns argument, the function accepts the following arguments: visualize(columns,labels=columns,type=c('LINE','PIE','BAR','DOT'), title="",...). The arguments of this function work much like the ones described above for individual factor columns. The added optional labels argument should be a vector of the same length as the columns argument, specifying custom names for the columns. This argument is ignored when type='LINE'.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
av_state <- load_file("../data/input/RuwedataAngela.sav",log_level=3)
av_state <- add_derived_column(av_state,'sum_minuten_licht',
              c('minuten_woonwerk','minuten_werk_licht',
                'minuten_licht_huishouden'))
av_state <- add_derived_column(av_state,'sum_minuten_zwaar',
              c('minuten_zwaarhuishouden','minuten_zwaar_werk'))
visualize(av_state,c('sum_minuten_licht','sum_minuten_zwaar',
          'minuten_vrijetijd','minuten_sport'),
          labels=c('licht werk','zwaar werk','vrije tijd','sport'),
          type='BAR',horiz=TRUE)
visualize(av_state,c('sum_minuten_licht','sum_minuten_zwaar',
          'minuten_vrijetijd','minuten_sport'),
          type='DOT',xlab='minuten')
visualize(av_state,c('sum_minuten_licht','sum_minuten_zwaar',
          'minuten_vrijetijd','minuten_sport'))

## End(Not run)

roqua/autovar documentation built on July 25, 2018, 11:30 p.m.