forked from dreamRs/datamods
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
143 lines (94 loc) · 4.22 KB
/
README.Rmd
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# datamods
> Shiny modules to import and manipulate data into an application or addin.
<!-- badges: start -->
[](https://CRAN.R-project.org/package=datamods)
[](https://app.codecov.io/gh/dreamRs/datamods)
[](https://cran.r-project.org/package=datamods)
[](https://github.com/dreamRs/datamods/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
### Overview
This package provides custom shiny modules to import data from various sources, select, rename and convert variables in a dataset and validate content with [validate](https://github.com/data-cleaning/validate) package.
The modules can be used in any standard shiny application or RStudio add-in.
### Internationalization
```{r, include=FALSE}
i18n_flag <- function(code, language) {
code <- strsplit(code, split = "|", fixed = TRUE)[[1]]
flag <- sprintf("<img src=\"man/figures/i18n/%s.svg\" height=\"16\" style=\"height:16px\"/>", code)
paste(paste(flag, collapse = ""), language)
}
i18n_flags <- function(languages) {
mapply(
FUN = i18n_flag,
code = names(languages),
language = unlist(languages, use.names = FALSE),
USE.NAMES = FALSE
)
}
languages <- list(
gb = "english (default)",
fr = "french",
mk = "macedonian",
"br|pt" = "brazilian portuguese",
al = "albanian",
cn = "chinese",
es = "spanish",
de = "german",
tr = "turkish",
kr = "korean",
pl = "polish",
ja = "japanese"
)
```
Currently you can use {datamods} in the following language: `r i18n_flags(languages)`.
If you want another language to be supported, you can submit a Pull Request to add a CSV file like the one used for french (file is located in `inst/i18n` folder in the package, you can see it [here on GitHub](https://github.com/dreamRs/datamods/blob/master/inst/i18n/fr.csv)).
See the [online vignette](https://dreamrs.github.io/datamods/articles/i18n.html) for more on this topic.
### Installation
Install from [CRAN](https://CRAN.R-project.org/package=datamods) with:
```r
install.packages("datamods")
```
You can install the development version of datamods from [GitHub](https://github.com/dreamRs/datamods) with:
```r
remotes::install_github("dreamRs/datamods")
```
### Import
Import data from:
* **environment**: such as Global environment or from a package
* **file**: text files, Excel, SAS or SPSS format... anything that package [rio](https://github.com/gesistsa/rio#supported-file-formats) can handle
* **copy/paste**: paste data from an other source like Excel or text file
* **Google Sheet**: use the URL to import the Googlesheet
* **URL**: use a URL to import from a flat table
Each module is available in the form `import_file_ui()` / `import_file_server()` and can be use independently.
Or all modules can be launched together in a modal window via `import_modal()` / `import_server()`:

This module also allow to view imported data and to update variables.
### Update
Module `update_variables_ui()` / `update_variables_server()` allow to:
* **select** variables of interest in a dataset
* **rename** variables to be used in application after that
* **convert** variables to change their class, from character to numeric for example

### Validate
Define some validation rules with package [validate](https://github.com/data-cleaning/validate) and check whether data lives up to those expectations.

### Filter
Interactively filter a `data.frame`, this module also generates the code to reproduce the filters.

### Sample
Interactively sample a `data.frame`:

### Edit
Interactively edit a `data.frame`:
