Vous voici sur le Git Rural du CRAW

Skip to content
Snippets Groups Projects
user avatar
FrdVnW authored
51c1035d

Table of Contents

  1. The application for visualizing the data
    1. Installation and setup
    2. Usage
      1. Cleaning and loading libraries
      2. Importing data
      3. Launch the application
  2. The data base
    1. The meta-data
    2. The classing of the data in order to determine their status
    3. The public data
    4. The global data base
    5. The to-be-confirmed data
  3. Hosting the application on a server
  4. Screencast : tutorial for the usage of the application
  5. Licenses
    1. Application and scripts : GPL-3
    2. Open data : cc-by

img

img

This document is written for DiverIMPACTS partners. It aims to help them for (i) having access to the data base, and if needed (ii) configuring your computer and using the application for consulting the data collected during the first survey of the WP1 of the project DiverIMPACTS.

Globally, the application is running on R through a ShinyAPP via the R-package surveyvisualizr.

The goal of surveyvisualizr is to visualize data collected from surveys. This package is working in R and is completed by a shiny app. You will need a recent version of R. If you don't have any experience or preference, Rstudio can help you for starting (code editor). This package is in development and accessible on Gitlab.

We lead you through the installation and the configuration of your computer in the following sections.

The application for visualizing the data

In this section, you will find a tutorial for setting your computer up and using the application. All the scripts of this section are already present in the files you will download.

Installation and setup

The functions and the scripts that will run 'surveyvisualizr' for DiverIMPACTS project is hosted here : http://gitrural.cra.wallonie.be/diverimpacts/survey-app-data.

Start by downloading the zip file surveyviz_diverimpacts.zip and unzip it on your computer. It will clone the repository 1.

In the 'diverIMPACTS' folder, you will find two main files : 'init.R' and 'setup.R'.

For the first time, you will install and setup your system. Open 'setup.R' and source it in R (Rstudio, emacs, …), or run line by line. It will mainly install on your computer the R libraries that are required for the application. The main command will install the package 'surveyvisualizr' in itself 2.

You will need devtools in order to install the package, I propose a personal function for install it if you don't have it already. The 'setup.R' file is simple, here after is its content.

## =====
## SETUP
## =====

rm(list=ls())

## Personal functions
## ==================
install.if.not <- function(package) {
    if (!require(package, character.only=T, quietly=T)) {
	install.packages(package)
	library(package, character.only=T)
    }
}


## Install/Load devtools
## =====================
install.if.not('devtools')


install_git('https://gitlab.com/FrdVnW/surveyvisualizr', upgrade_dependencies = FALSE)

If you encounter some issues, you can contact me here.

Usage

After your computer is set up, you can open the 'init.R' file.

!!! Please check if the working directory of R is the path of this 'init.R' file 3.

Source this file, or more safetely run line by line. The various steps are :

Cleaning and loading libraries

rm(list=ls())

## Packages
## ========
library(surveyvisualizr)

library(tidyr)
library(dplyr)
library(shiny)
library(plotly)
library(DT)
library(RColorBrewer)

Importing data

The public data files are already in the 'data-raw' folder. So you can import directly these data.

source('R/load-di.R')
load.di()

If you have other data files, there are two possibilities :

  1. A - You have the two '*.csv' files, then :

    ##
    ## Copy the two data files :
    ##  - survey_438634_R_data_file.csv
    ##  - survey_438634_R_data_file-names.csv
    ## in the 'data-raw' folder of your working directory
    ##  and run :
    ##
    source('R/load-di.R')
    load.di()
  2. B (easier) - You have a '*.RData' file, then :

    ##
    ## This file can be :
    ## - di_variables_public.RData
    ## - di_variables_tbc.RData (internal, contains public data)
    ## - di_variables_restricted.RData (internal, contains all data)
    ##
    ## Copy the file you have in the 'data-raw' folder of
    ## your working directory. Run one of the  
    ## following command, depending of your file :
    ##
    ## load('./data-raw/di_variables_public.RData')
    ## load('./data-raw/di_variables_tbc.RData')
    ## load('./data-raw/di_variables_restricted.RData')

Launch the application

You can launch the application with the following command.

## Launch the application
## ======================
surveyvisualizr()

The data base

Public data are already present in the repository with the application and the scripts presented in the first section. In this section, you will have more information on the data base.

The meta-data

The meta-data linked to this survey are public. It is published on the survey-public-data repository : survey_438634_meta_data.csv. It is shared as a 'csv' file. The fields that can be consulted are the following ones 4

  • "full": The full question asked in the survey
  • "name": The code (id) of the variable in the data-base (a question, a sub-question of an item of a question)
  • "big.questions": The code (id) of a main question. Can be shared by different variables.
  • "big.questions.scales": For some questions, two opposing scales are linked to a question. Code of this question can be found here.
  • "big.questions.scales.info": For some questions, two opposing scales are linked to a question. Information on the scales can be found here.
  • "main": The main quesiton (text) linked to a variable or different variables
  • "item": The sub-question or the item of a main question
  • "class": The class of the variable : numeric, factor, text.
  • "levels": The levels that can be found as answers for a factor variable
  • "status.deliverable": The status of the variable for this deliverable (public - restricted or to be confirmed).

For information, at the end of November 2018, there are 330 'public' variables, 10 'restricted' variables and 70 'to be confirmed' variables.

The meta data were also edited in a table that is reproduced at Appendix B of this deliverable.

The classing of the data in order to determine their status

So far, the data of the first survey have been classed in three categories according to their internal characteristics and human check up. The Figure 35 presents the main criteria that have been used.

img

The classing of the variable is a continuous process that will aim to class the 'to be confirmed' variables as 'public' (mainly) or 'restricted'.

The public data

Lots of data collected during this survey are public (see here above). It is published on the repository : http://gitrural.cra.wallonie.be/diverimpacts/survey-public-data. Two '.csv' files were produced :

  • survey_438634_R_data_file.csv. This file is better for the data analyses as the factor data are 'coded' (e.g. [1, 0] for [TRUE, FALSE]). It can be easily import using the 'R Script' in the folder (read-data-files.R). The script is produced by Limesurvey and add labels to variables (the text of the asked questions/items) and labels to levels of factors (the selected answers).
  • survey_438634_R_data_file-names.csv. This file is better for 'human reading' as the factor data are reproduced as text in the data base, the same text selected in the survey by the interviewees. If needed, this file can be import using the 'R Script' in the folder (read-data-files-names.R).

The public data (open data) are also reproduced in the Appendix 3 of this deliverable, as tables. We used the data_file-name with more explicit answers.

The global data base

Some variables collected during the survey were considired as 'personal' data (names, ip adresses, emails, …) and are therefore not part of this deliverable. These data were removed from the public data base in an anonymisation process. The full data base will not be shared outside of the DiverIMPACTS project.

The to-be-confirmed data

A part of the variable could contain come personal information. They presently are considered as restricted data. A reviewing by WP-leaders and project coordinators is plan in order to class these last variables as public or restricted.

Hosting the application on a server

The application can be shared on server in order to facilitate its usage by a large public. First tries were made on the 'shinyapps.io' service and it is technically concluding. We are now evaluating the possibilities to have a secured and long term version of this kind of service. The link to the online application is : https://craw.shinyapps.io/diverimpacts/. We ask reader to use this link with parcimony as we have now a time-limited usage of this service.

Screencast : tutorial for the usage of the application

A screencast was produced in order to help partners of DiverIMPACTS and users of the application. Link to the screencast : https://youtu.be/DkSa78KmH2Y

img

Here are some other screenshots of the possibilities of the application : img img img img

Licenses

Two kind of licenses are used in the framework of this deliverable :

Application and scripts : GPL-3

## THIS SCRIPT is a program for configuring and using
## the surveyvisualizr package in the framework of the
## DiverIMPACTS project
## Copyright (c) 2018 Frédéric Vanwindekens
## Centre wallon de Recherches agronomiques
## Projet DiverIMPACTS
## License GPL-3

Open data : cc-by

## Copyright (c) 2018 Frédéric Vanwindekens, Dóra Drexler
## Centre wallon de Recherches agronomiques (CRA-W)
## Hungarian Research Institute of Organic Agriculture (ÖMKi),
## Projet DiverIMPACTS (https://www.diverimpacts.net/)
## License cc-by

Footnotes

1 if you know git, you can also use the git command : git clone http://gitrural.cra.wallonie.be/diverimpacts/survey-app-data.git

2 hosted on Gitlab. Using the package 'devtools', you can install it with the command : devtools::install_git('https://gitlab.com/FrdVnW/surveyvisualizr', upgrade_dependencies = FALSE)

3 In RStudio, when the file is open : click Session > Set working directory > … to source file location.

4 this table can be considered as the meta-data of the meta-data