Package 'vizsurvey'

Title: Visualisation And Analysis During a Survey Field
Description: vizsurvey is an R package designed to streamline the quality assessment of survey data by providing intuitive visual diagnostics through an interactive dashboard. vizsurvey is especially useful for institutions or researchers conducting large-scale surveys with multiple interviewers, enabling a fast and systematic overview of data quality over time.
Authors: Thomas Delclite [aut, cre], Adrien Mierop [aut]
Maintainer: Thomas Delclite <[email protected]>
License: GPL (>= 3)
Version: 0.2.1
Built: 2026-05-15 09:46:51 UTC
Source: https://github.com/tdelc/vizsurvey

Help Index


Classify all variable of a data.frame

Description

Classify all variable of a data.frame

Usage

classify_df(df, threhold = 15)

Arguments

df

A data frame

threhold

Maximum number of modalities to classify variable as modal

Value

a data frame

Examples

classify_df(iris)

corrections of each df of a list

Description

corrections of each df of a list

Usage

correct_list_df(list_df)

Arguments

list_df

list of df

Value

list


Create a template of configuration file

Description

Create a template of configuration file

Usage

create_config(
  folder_path,
  file_name = "config.txt",
  name_survey = NULL,
  vars_discretes = NULL,
  vars_continous = NULL,
  var_wave = NULL,
  var_zone = NULL,
  var_group = NULL
)

Arguments

folder_path

folder where create the file

file_name

Name of the config file (config.txt by default)

name_survey

Name of the survey (not used)

vars_discretes

(optional) preset discretes variables name (VAR1,VAR2,...)

vars_continous

(optional) preset continous variables name (VAR1,VAR2,...)

var_wave

(optional) variable name of wave

var_zone

(optional) variable name of zone

var_group

variable name of group

Examples

create_config(".") # creation of config.txt in working directory

Create statistics from database

Description

Create statistics from database

Usage

create_df_stats(df_, configs, var_calculs, zone_filter = NULL)

Arguments

df_

database

configs

configs

var_calculs

variable to create stats

zone_filter

(optional) zone modality to filter data

Value

df


Simulate EU-SILC dataset with injected errors

Description

Simulate EU-SILC dataset with injected errors

Usage

create_eusilc_sim()

Value

data.frame from laeken::eusilc with ids and errors

Examples

# create_eusilc_sim()

Use PUF files for SILC example

Description

Use PUF files for SILC example

Usage

create_fake_silc(
  vec_country = c("BE", "RO"),
  path_out = "inst/shiny-examples/complete/data/SILC/"
)

Arguments

vec_country

Vector of country to import

path_out

Path to export csv

Value

nothing, but creation of csv datasets

Examples

# create_fake_silc()

Replace empty by na

Description

Replace empty by na

Usage

empty_as_na(vec)

Arguments

vec

Vector of values

Value

Vector

Examples

airquality[which(is.na(airquality$Ozone)), "Ozone"] <- ""
empty_as_na(airquality$Ozone)

extract a config from key (config from load_config)

Description

extract a config from key (config from load_config)

Usage

extract_config(config, key_)

Arguments

config

df of configuration

key_

key to extract

Value

string


tranform data from folder to config and df

Description

tranform data from folder to config and df

Usage

folder_to_df(folder, file_pattern = "*.csv", file_config = "config.txt")

Arguments

folder

folder of databases

file_pattern

pattern of the databases (*.csv by default)

file_config

name of the configuration file (config.txt by default)

Value

list(df,configs)

Examples

## Not run: 
folder_to_df("ESS10")

## End(Not run)

Create a heatmap

Description

Create a heatmap

Usage

heatmap_group(df_stats, threshold = 5, color = "red2")

Arguments

df_stats

data frame from prepa_stats function

threshold

threshold to show difference

color

color of the cells

Value

heatmap (ggplot)

Examples

library(laeken)
data(eusilc)

df_stats <- prepa_stats(eusilc, "db040")
heatmap_group(df_stats, 5)

Check if value is integer64

Description

Check if value is integer64

Usage

is.integer64(x)

Arguments

x

Value

Value

Boolean

Examples

is.integer64(c(1:100)) # FALSE

List distribution of discrete variables

Description

List distribution of discrete variables

Usage

list_dist(df, vars_vd)

Arguments

df

data.frame

vars_vd

vector of discrete variables

Value

list

Examples

list_dist(mtcars,c("cyl","vs","gear"))

load a config file for prepare data

Description

load a config file for prepare data

Usage

load_config(file_path)

Arguments

file_path

path of the configuration file

Value

df


Loop of stats creation by zone

Description

Loop of stats creation by zone

Usage

loop_stats(df, configs, var_calculs)

Arguments

df

database

configs

configs

var_calculs

variable to create stats

Value

df


Specific chisq test to NA and Other modality

Description

Specific chisq test to NA and Other modality

Usage

my_chisq_test(x, varname, ldist)

Arguments

x

value to procede chisq test

varname

name of the variable

ldist

named list of expected probability

Value

chisq value

Examples

ldist <- list_dist(mtcars,c("cyl","gear"))
sub_mtcars <- subset(mtcars,vs == 1)
my_chisq_test(sub_mtcars$cyl,"cyl",ldist)

Create a summarise of all the difference

Description

Create a summarise of all the difference

Usage

prepa_stats(df, var_group, vars_vd = NULL, vars_vc = NULL)

Arguments

df

data frame for the summary

var_group

Name of group variable

vars_vd

(optional) Vector of discrete variables

vars_vc

(optional) Vector of continuous variables

Value

data frame

Examples

library(laeken)
data(eusilc)

info_vars <- classify_df(eusilc)
vars_vd <- info_vars[info_vars$type == "Modal", ]$variable
vars_vc <- info_vars[info_vars$type == "Continuous", ]$variable
prepa_stats(eusilc, "db040", vars_vd, vars_vc)

Preparation of a survey

Description

Preparation of a survey

Usage

prepa_survey(folder_path, file_pattern = "*.csv", file_config = "config.txt")

Arguments

folder_path

folder of survey

file_pattern

pattern of the databases (*.csv by default)

file_config

name of the configuration file (config.txt by default)

Value

NULL (creation of rds)

Examples

## Not run: 
prepa_survey("shiny-examples/complete/ESS10")

## End(Not run)

Preparation of all surveys from a folder

Description

Preparation of all surveys from a folder

Usage

prepa_surveys(
  folder_path,
  depth_folder = 1,
  file_pattern = "*.csv",
  file_config = "config.txt"
)

Arguments

folder_path

folder of the folders of survey

depth_folder

level of depth for the tree structure

file_pattern

pattern of the databases (*.csv by default)

file_config

name of the configuration file (config.txt by default)

Value

NULL (creation of rds)

Examples

## Not run: 
prepa_surveys("inst/extdata/SILC/HFILE")

## End(Not run)

Shiny Example of vizsurvey

Description

Shiny Example of vizsurvey

Usage

runExample()

Value

shinyapp

Examples

# runExample()

Shiny vizsurvey

Description

Shiny vizsurvey

Usage

runVizsurvey()

Value

shinyapp

Examples

## Not run: runVizsurvey()

Shiny vizsurvey from a csv/tsv

Description

Shiny vizsurvey from a csv/tsv

Usage

runVizsurvey_from_file(
  path,
  vars_discretes = NULL,
  vars_continous = NULL,
  var_wave = NULL,
  var_zone = NULL,
  var_group = NULL
)

Arguments

path

path of a data.frame (can be readed by fread)

vars_discretes

(optional) preset of discretes variables

vars_continous

(optional) preset of continous variables

var_wave

(optional) name of wave variable

var_zone

(optional) name of zone variable

var_group

(optional) name of group variable

Value

shinyapp

Examples

path <- "inst/extdata/SILC/HFILE/BE_2012h_EUSILC.csv"
## Not run: runVizsurvey_from_file(path,var_group = "NR_ITW",var_zone = "db040")

Shiny vizsurvey with already prepared data

Description

Shiny vizsurvey with already prepared data

Usage

runVizsurvey_from_folder(link, data_rds_pattern = "global", depth_folder = 1)

Arguments

link

link to directory of data

data_rds_pattern

name of the rds file contains all the data

depth_folder

level of depth for the tree structure

Value

shinyapp

Examples

# We assume that config.txt, and prepa_surveys are already done here.
## Not run: runVizsurvey_from_folder("inst/extdata",depth_folder = 3)

Shiny vizsurvey from a R data.frame

Description

Shiny vizsurvey from a R data.frame

Usage

runVizsurvey_from_r(
  df,
  vars_discretes = NULL,
  vars_continous = NULL,
  var_wave = NULL,
  var_zone = NULL,
  var_group = NULL
)

Arguments

df

data.frame

vars_discretes

(optional) preset of discretes variables

vars_continous

(optional) preset of continous variables

var_wave

(optional) name of wave variable

var_zone

(optional) name of zone variable

var_group

(optional) name of group variable

Value

shinyapp

Examples

library(laeken)
data(eusilc)
set.seed(123)
eusilc$NR_ITW <- paste(eusilc$db040,sample(1:5,nrow(eusilc),replace = TRUE),sep="-")
## Not run: runVizsurvey_from_r(eusilc,var_group = "NR_ITW",var_zone = "db040")

Robust Scale of a varible with IQR

Description

Robust Scale of a varible with IQR

Usage

scale_IQR(x)

Arguments

x

vector

Value

vector

Examples

head(scale_IQR(iris$Sepal.Length))

calculate isoforest score from df

Description

calculate isoforest score from df

Usage

score_isoforest(df)

Arguments

df

database

Value

vector

Examples

score_isoforest(iris[sapply(iris, is.numeric)])