Skip to content

Commit

Permalink
Merge pull request #40 from andrechalom/multilingual
Browse files Browse the repository at this point in the history
Multilingual
  • Loading branch information
andrechalom committed Jul 31, 2015
2 parents 48afdff + a9e319e commit 0cfd3ff
Show file tree
Hide file tree
Showing 7 changed files with 587 additions and 413 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,16 @@ runApp("<path to Rsampling-shiny>")
```
Remember that you need to install the shiny/shinyBS packages while you have internet access!

## Languages
The app is currently available in English (default) and Portuguese.
To use the version in Portuguese, run the following command
before running the app (runGitHub(...) or runApp(...))
```R
language <- "pt"
```
## Current features
* Access the Rsampling sample datafiles, or upload your own data in csv format
* Choose between a range of statistics, or write your own R function
* Select your randomization scheme, with or without replacement
* Optional stratified randomization
* Reactive graph showing the distribuion of the statistic of interest and estimated p-value
* Interactive tutorials on resampling statistics
30 changes: 30 additions & 0 deletions global.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
##################################################
### MULTILINGUAL VARIABLES AND FUNCTION ###
#################################################
# The default language is "en". To use the translated version, set the language such as
# > language <- "pt"
# before calling the app
language <- ifelse(exists("language"), language, "en")
dictionary <- read.csv('lang.csv', sep = ';', stringsAsFactors = FALSE, fileEncoding="UTF-8", header=TRUE)
# If the language is not recognized, does not attempt to run the app. Stop immediately:
if (! language %in% colnames(dictionary)[-1])
stop(paste0("Language is not recognized: ", language, "\n"))
## Main translation function. Uses "language" and "dictionary" as globals, defined above
# in this file.
tr <- function(text) {
for (i in 1:length(text)) {
id <- which(dictionary$value %in% text[i])
# Trying again:
if (length(id) == 0)
id <- which(dictionary$en %in% text[i])
# If still no matches, prints a warning:
if (length(id) == 0)
cat(paste('No matches for text:', text[i], '\n'))
if (length(id) == 1) {
text[i] <- ifelse(language == "pt", dictionary$pt[id], dictionary$en[id])
} else if (length(id) > 1) {
cat(paste('More than one match for text:', text[i], '\n'))
}
}
return(text)
}
2 changes: 1 addition & 1 deletion help.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</ul>
<p>The idea behind this package is to help students to understand the logic behind these tests,
with lots of flexibility on what is the statistic that will be calculated.</p>
<p>Rsampling and and this web interface were written by <a href="mailto:[email protected]">Andre Chalom</a>,
<p>Rsampling and this web interface were written by <a href="mailto:[email protected]">Andre Chalom</a>,
<a href="mailto:[email protected]">Alexandre Adalardo</a>, <a href="mailto:[email protected]">Ayana Martins</a>
and <a href="mailto:[email protected]">Paulo Prado</a>.</p>
<p>Please visit our <a href="https://github.com/andrechalom/Rsampling-shiny">project webpage</a>
Expand Down
31 changes: 31 additions & 0 deletions help_pt.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<div style="float: right; border:1px dashed #ccc; width:22%; text-align: center;">
<img src="chicken.png" align="none">
<p style="font-size: 75%;">A Galinha Esférica foi criada por
<a href="[email protected]">Luisa Novara</a> e pode ser utilizada sob a licença
<a href="https://creativecommons.org/licenses/by/3.0/">CC3-by</a>.</p>
</div>
<div style="float: left; width: 73%">
<p>Rsampling é uma pacote gratuito e de código aberto desenvolvido
com o objetivo de ajudar no aprendizado de métodos estatísticos
baseados em permutação.
O pacote foi baseado no programa
<a href="http://www.resample.com">Resampling Stats</a>.</p>
<p>Podemos pensar na lógica por trás de um teste de significância da seguinte forma:
<ul><li>Escolha a sua estatística de interesse</li>
<li>Determine qual é a sua hipótese nula</li>
<li>Obtenha a distribuição da estatísica de interesse sob a hipótese nula</li>
<li>Rejeite a hipótese nula se a probabilidade da estatística de interesse observada for
menor do que um certo limiar</li>
</ul>
<p>A ideia por trás deste pacote é auxiliar na compreensão desta lógica, com grande flexibilidade de estatísticas
que podem ser calculadas.</p>
<p>Rsampling e sua interface gráfica foram escritos por <a href="mailto:[email protected]">Andre Chalom</a>,
<a href="mailto:[email protected]">Alexandre Adalardo</a>, <a href="mailto:[email protected]">Ayana Martins</a>
e <a href="mailto:[email protected]">Paulo Prado</a>.</p>
<p>Visite nossa <a href="https://github.com/andrechalom/Rsampling-shiny">página de projeto</a>
e a página da <a href="https://github.com/lageIBUSP/Rsampling">biblioteca Rsampling </a> no
<a href="https://github.com">github</a>,
para aprender mais sobre o projeto e enviar sugestões ou reportar bugs.</p>
<p>Rsampling e Rsampling-shiny têm os poderes da Galinha Esférica.</p>
</div>
<div style="clear: both;"></div>
Loading

0 comments on commit 0cfd3ff

Please sign in to comment.