Skip to content

Commit

Permalink
updated smaple module + translations
Browse files Browse the repository at this point in the history
  • Loading branch information
pvictor committed May 16, 2024
1 parent e9c8d64 commit ae3413b
Show file tree
Hide file tree
Showing 13 changed files with 68 additions and 42 deletions.
42 changes: 27 additions & 15 deletions R/sample-data.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ sample_ui <- function(id) {
radioGroupButtons(
inputId = ns("choice"),
label = i18n("Sample data by :"),
choices = c("number of rows", "proportion of rows"),
justified = FALSE,
size = "xs"
choiceNames = c(i18n("number of rows"), i18n("proportion of rows")),
choiceValues = c("number of rows", "proportion of rows"),
justified = TRUE,
size = "xs",
width = "100%"
),

conditionalPanel(
Expand All @@ -79,9 +81,12 @@ sample_ui <- function(id) {
sliderInput(
inputId = ns("proportion_rows"),
label = i18n("Choose a percentage :"),
min = 0, max = 100, value = 100,
post = " %"
),
min = 0,
max = 100,
value = 100,
post = " %",
width = "100%"
),
uiOutput(outputId = ns("feedback_proportion_rows"))
),

Expand All @@ -91,8 +96,11 @@ sample_ui <- function(id) {
sliderInput(
inputId = ns("number_rows"),
label = i18n("Choose a number of rows :"),
min = 0, max = 10, value = 10
),
min = 0,
max = 10,
value = 10,
width = "100%"
),
uiOutput(outputId = ns("feedback_number_rows"))
)
)
Expand Down Expand Up @@ -120,20 +128,24 @@ sample_server <- function(id, data_r = reactive(NULL)) {
updateSliderInput(
session,
inputId = "number_rows",
min = 0, max = nrow(data_r()), value = nrow(data_r())
min = 0,
max = nrow(data_r()),
value = nrow(data_r())
)
})

output$feedback_proportion_rows <- renderUI({
req(data_r())
value <- nrow(data_r()) * (input$proportion_rows/100)
tags$div(paste(input$proportion_rows, i18n("% of the total, i.e."), round(value), i18n("rows")))
sample <- req(sample_r())
tags$div(
paste(input$proportion_rows, i18n("% of the total, i.e."), nrow(sample), i18n("rows"))
)
})

output$feedback_number_rows <- renderUI({
req(data_r())
value <- input$number_rows / nrow(data_r()) * 100
tags$div(paste(input$number_rows, i18n("lines, i.e."), round(value, 1), i18n("% of the total")))
data <- req(data_r())
tags$div(
paste(input$number_rows, i18n("lines, i.e."), round(input$number_rows / nrow(data) * 100, 1), i18n("% of the total"))
)
})

sample_r <- reactive({
Expand Down
11 changes: 4 additions & 7 deletions examples/sample.R
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
library(shiny)
library(datamods)
library(reactable)

##### ui.R #####

ui <- fluidPage(

titlePanel("Sampling"),
tags$h2("Sampling"),

fluidRow(
column(
width = 4,
width = 3,
sample_ui("myID")
),
column(
width = 8,
width = 9,
reactableOutput("table")
)
)
)



##### server.R #####

server <- function(input, output, session) {

result_sample <- sample_server("myID", reactive(iris))
Expand Down
4 changes: 3 additions & 1 deletion inst/i18n/al.csv
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,7 @@
"if several use a comma ',' to separate them","nëse disa përdorin presje ',' për t'i ndarë","Automacally translated"
"lines, i.e.","vijat, d.m.th.","Automacally translated"
"rows","rreshtave","Automacally translated"
"to delete it.","për ta fshirë.","Automacally translated"
"then enter an expression before clicking on the button above to validate or on ","pastaj futni një shprehje përpara se të klikoni në butonin e mësipërm për të vërtetuar ose aktivizuar","Automacally translated"
"to delete it.","për ta fshirë.","Automacally translated"
"number of rows","numri i rreshtave","Automacally translated"
"proportion of rows","proporcioni i rreshtave","Automacally translated"
6 changes: 4 additions & 2 deletions inst/i18n/cn.csv
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"Dataset validation:","鏁版嵁闆嗛獙璇侊細","Automacally translated"
"Date format:","日期格式:",""
"Date to use as origin to convert date/datetime:","日期转换的起始时间:",""
"Decimal separator:","小数点:""""",""
"Decimal separator:","小数点:""""""""",""
"Delete","删除",""
"Do you want to delete the selected row ?","您要删除选定的行吗?",""
"Encoding:","文件编码:",""
Expand Down Expand Up @@ -136,5 +136,7 @@
"if several use a comma ',' to separate them","濡傛灉澶氫釜浣跨敤閫楀彿鈥�,鈥濆垎闅�","Automacally translated"
"lines, i.e.","绾匡紝鍗�","Automacally translated"
"rows","琛�","Automacally translated"
"to delete it.","鍒犻櫎瀹冦€�","Automacally translated"
"then enter an expression before clicking on the button above to validate or on ","鐒跺悗杈撳叆涓€涓〃杈惧紡锛岀劧鍚庡崟鍑讳笂闈㈢殑鎸夐挳杩涜楠岃瘉鎴�","Automacally translated"
"to delete it.","鍒犻櫎瀹冦€�","Automacally translated"
"number of rows","琛屾暟","Automacally translated"
"proportion of rows","琛岀殑姣斾緥","Automacally translated"
4 changes: 3 additions & 1 deletion inst/i18n/de.csv
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,7 @@
"if several use a comma ',' to separate them","Bei mehreren verwenden Sie zur Trennung ein Komma „,“.","Automacally translated"
"lines, i.e.","Linien, d.h.","Automacally translated"
"rows","Reihen","Automacally translated"
"to delete it.","um es zu löschen.","Automacally translated"
"then enter an expression before clicking on the button above to validate or on ","Geben Sie dann einen Ausdruck ein, bevor Sie zum Bestätigen oder Einschalten auf die Schaltfläche oben klicken","Automacally translated"
"to delete it.","um es zu löschen.","Automacally translated"
"number of rows","Anzahl der Reihen","Automacally translated"
"proportion of rows","Anteil der Reihen","Automacally translated"
4 changes: 3 additions & 1 deletion inst/i18n/es.csv
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,7 @@
"if several use a comma ',' to separate them","si son varios use una coma ',' para separarlos","Automacally translated"
"lines, i.e.","líneas, es decir","Automacally translated"
"rows","filas","Automacally translated"
"to delete it.","para borrarlo.","Automacally translated"
"then enter an expression before clicking on the button above to validate or on ","luego ingrese una expresión antes de hacer clic en el botón de arriba para validar o en","Automacally translated"
"to delete it.","para borrarlo.","Automacally translated"
"number of rows","número de filas","Automacally translated"
"proportion of rows","proporción de filas","Automacally translated"
8 changes: 5 additions & 3 deletions inst/i18n/fr.csv
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"Row has been saved","La ligne a été enregistrée",""
"Row was not deleted","La ligne n'a pas été supprimée",""
"Rows to skip before reading data:","Lignes à ignorer avant de lire les données :","Automacally translated"
"Sample data by :","Exemple de données par :","Automacally translated"
"Sample data by :","Echantillonner les données selon :",""
"Save","Enregistrer",""
"Select","Sélectionner",""
"Select a data.frame:","Sélectionner un data.frame :",""
Expand Down Expand Up @@ -135,6 +135,8 @@
"data has %s obs. of %s variables.","les données ont %s observations et %s colonnes.",""
"if several use a comma ',' to separate them","si plusieurs utilisent une virgule ',' pour les séparer","Automacally translated"
"lines, i.e.","lignes, c'est-à-dire","Automacally translated"
"rows","Lignes","Automacally translated"
"to delete it.","pour le supprimer.","Automacally translated"
"rows","lignes","Automacally translated"
"then enter an expression before clicking on the button above to validate or on ","puis saisissez une expression avant de cliquer sur le bouton ci-dessus pour valider ou sur","Automacally translated"
"to delete it.","pour le supprimer.","Automacally translated"
"number of rows","Nombre de lignes",""
"proportion of rows","Proportion de lignes",""
4 changes: 3 additions & 1 deletion inst/i18n/kr.csv
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,7 @@
"if several use a comma ',' to separate them","�щ윭 紐낆씠 �쇳몴 ','瑜� �ъ슜�섏뿬 援щ텇�섎뒗 寃쎌슦","Automacally translated"
"lines, i.e.","�쇱씤, 利�","Automacally translated"
"rows","��","Automacally translated"
"to delete it.","��젣�섎젮硫�","Automacally translated"
"then enter an expression before clicking on the button above to validate or on ","洹몃윴 �ㅼ쓬 �꾩쓽 踰꾪듉�� �대┃�섍린 �꾩뿉 �쒗쁽�앹쓣 �낅젰�섏뿬 �좏슚�깆쓣 寃€�ы븯嫄곕굹","Automacally translated"
"to delete it.","��젣�섎젮硫�","Automacally translated"
"number of rows","�� ��","Automacally translated"
"proportion of rows","�됱쓽 鍮꾩쑉","Automacally translated"
4 changes: 3 additions & 1 deletion inst/i18n/mk.csv
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,7 @@
"if several use a comma ',' to separate them","ако неколку користат запирка ',' за да ги разделат","Automacally translated"
"lines, i.e.","линии, т.е.","Automacally translated"
"rows","редови","Automacally translated"
"to delete it.","да го избришете.","Automacally translated"
"then enter an expression before clicking on the button above to validate or on ","потоа внесете израз пред да кликнете на копчето погоре за да потврдите или да го вклучите","Automacally translated"
"to delete it.","да го избришете.","Automacally translated"
"number of rows","број на редови","Automacally translated"
"proportion of rows","пропорција на редови","Automacally translated"
4 changes: 3 additions & 1 deletion inst/i18n/pl.csv
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,7 @@
"if several use a comma ',' to separate them","jeśli kilka z nich użyje przecinka „,” aby je oddzielić","Automacally translated"
"lines, i.e.","linie, tj.","Automacally translated"
"rows","wydziwianie","Automacally translated"
"to delete it.","aby go usunąć.","Automacally translated"
"then enter an expression before clicking on the button above to validate or on ","następnie wprowadź wyrażenie przed kliknięciem przycisku powyżej, aby zatwierdzić lub włączyć","Automacally translated"
"to delete it.","aby go usunąć.","Automacally translated"
"number of rows","Liczba rzędów","Automacally translated"
"proportion of rows","proporcja rzędów","Automacally translated"
4 changes: 3 additions & 1 deletion inst/i18n/pt.csv
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,7 @@
"if several use a comma ',' to separate them","se vários usarem uma vírgula ',' para separá-los","Automacally translated"
"lines, i.e.","linhas, ou seja,","Automacally translated"
"rows","linhas","Automacally translated"
"to delete it.","para excluí-lo.","Automacally translated"
"then enter an expression before clicking on the button above to validate or on ","em seguida, insira uma expressão antes de clicar no botão acima para validar ou em","Automacally translated"
"to delete it.","para excluí-lo.","Automacally translated"
"number of rows","numero de linhas","Automacally translated"
"proportion of rows","proporção de linhas","Automacally translated"
4 changes: 3 additions & 1 deletion inst/i18n/tr.csv
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,7 @@
"if several use a comma ',' to separate them","birkaç kişi onları ayırmak için ',' virgülünü kullanıyorsa","Automacally translated"
"lines, i.e.","çizgiler, yani","Automacally translated"
"rows","satırlar","Automacally translated"
"to delete it.","silmek için.","Automacally translated"
"then enter an expression before clicking on the button above to validate or on ","ardından doğrulamak için yukarıdaki düğmeye tıklamadan önce bir ifade girin veya","Automacally translated"
"to delete it.","silmek için.","Automacally translated"
"number of rows","satır sayısı","Automacally translated"
"proportion of rows","satırların oranı","Automacally translated"
11 changes: 4 additions & 7 deletions man/module-sample.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ae3413b

Please sign in to comment.