Skip to content

Commit b2cf318

Browse files
author
Omar Giorgetti
committed
init
0 parents  commit b2cf318

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1101
-0
lines changed

.RData

14 KB
Binary file not shown.

.Rhistory

Lines changed: 512 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"debugBreakpointsState" : {
3+
"breakpoints" : [
4+
]
5+
}
6+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"path" : "~/Documenti/R/progetti",
3+
"sortOrder" : [
4+
{
5+
"ascending" : true,
6+
"columnIndex" : 2
7+
}
8+
]
9+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"installOptions" : {
3+
"installDependencies" : true,
4+
"installFromRepository" : true,
5+
"libraryPath" : "/home/userregtosc/R/x86_64-pc-linux-gnu-library/3.4"
6+
}
7+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"activeTab" : 0
3+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"left" : {
3+
"panelheight" : 795,
4+
"splitterpos" : 222,
5+
"topwindowstate" : "NORMAL",
6+
"windowheight" : 834
7+
},
8+
"right" : {
9+
"panelheight" : 795,
10+
"splitterpos" : 497,
11+
"topwindowstate" : "NORMAL",
12+
"windowheight" : 834
13+
}
14+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"TabSet1" : 0,
3+
"TabSet2" : 0,
4+
"TabZoom" : {
5+
}
6+
}

.Rproj.user/E09E942C/persistent-state

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
build-last-errors="[]"
2+
build-last-errors-base-dir=""
3+
build-last-outputs="[]"
4+
compile_pdf_state="{\"errors\":[],\"output\":\"\",\"running\":false,\"tab_visible\":false,\"target_file\":\"\"}"
5+
files.monitored-path=""
6+
find-in-files-state="{\"handle\":\"\",\"input\":\"\",\"path\":\"\",\"regex\":false,\"results\":{\"file\":[],\"line\":[],\"lineValue\":[],\"matchOff\":[],\"matchOn\":[]},\"running\":false}"
7+
imageDirtyState="1"
8+
saveActionState="-1"

.Rproj.user/E09E942C/rmd-outputs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
3+
4+
5+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"active_set":"","sets":[]}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"collab_server" : "",
3+
"contents" : "",
4+
"created" : 1553263052861.000,
5+
"dirty" : false,
6+
"encoding" : "UTF-8",
7+
"folds" : "",
8+
"hash" : "3385366581",
9+
"id" : "176B90B9",
10+
"lastKnownWriteTime" : 1555681406,
11+
"last_content_update" : 1555681406467,
12+
"path" : "~/Documenti/R/progetti/pivot/app.R",
13+
"project_path" : "app.R",
14+
"properties" : {
15+
"cursorPosition" : "22,22",
16+
"scrollLine" : "22",
17+
"tempName" : "Untitled1"
18+
},
19+
"relative_order" : 4,
20+
"source_on_save" : false,
21+
"source_window" : "",
22+
"type" : "r_source"
23+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#library(dplyr)
2+
#library(readr)
3+
library(shiny)
4+
#library(openxlsx)
5+
#library(shinyjs)
6+
#library(rvest)
7+
8+
source("function.R")
9+
#ui
10+
ui = fluidPage(
11+
downloadButton("downloadData", "Salva csv"),
12+
fluidRow( rpivotTable::rpivotTableOutput("pivot")))
13+
14+
15+
#server
16+
server = function(input, output) {
17+
output$pivot <- rpivotTable::renderRpivotTable(
18+
rpivotTable::rpivotTable(mtcars
19+
, aggregatorName = "Sum"
20+
, rendererName = "Table"
21+
#,rows=c("vs","cyl"),cols=c("am","gear"),vals="mpg"
22+
, width="50%"
23+
, height="550px"
24+
,onRefresh=htmlwidgets::JS("
25+
function() {
26+
27+
var rend = document.getElementsByClassName('pvtRenderer')['0'].value;
28+
var misura = document.getElementsByClassName('pvtAttrDropdown')['0'].value;
29+
var aggr = document.getElementsByClassName('pvtAggregator')['0'].value;
30+
var source = document.getElementsByClassName('pvtTable')['0'];
31+
var r=0;
32+
var data='[{\"data\":{';
33+
var nrow=source.rows.length
34+
var lastc;
35+
while(row=source.rows[r++])
36+
{
37+
var rowt='\"row'+r+'\":{';
38+
var col;
39+
var c=0;
40+
41+
42+
var ncol=row.cells.length
43+
while(cell=row.cells[c++])
44+
{
45+
col='\"col'+c+'\":{\"tagName\":\"'+cell.tagName+'\",\"innerhtml\":\"'+cell.innerHTML+'\",\"cellIndex\":'+cell.cellIndex+',\"rowSpan\":'+cell.rowSpan+',\"colSpan\":'+cell.colSpan+'}'
46+
if (c<ncol){col=col+','}
47+
rowt=rowt+col;
48+
}
49+
50+
if (r<nrow){
51+
rowt=rowt+'},';
52+
}
53+
else{
54+
rowt=rowt+'}}';
55+
}
56+
data=data+rowt;
57+
}
58+
data=data+'}]';
59+
60+
Shiny.onInputChange('misura', misura);
61+
Shiny.onInputChange('aggr', aggr);
62+
Shiny.onInputChange('data',data);
63+
Shiny.onInputChange('rend',rend);
64+
}"
65+
)
66+
)
67+
)
68+
69+
output$downloadData <- downloadHandler(
70+
filename = function() {
71+
paste("pivot.csv", sep = "")
72+
},
73+
content = function(file) {
74+
ris<-createcsv(input$misura,input$aggr,input$data)
75+
print(ris)
76+
write.csv(ris, file, row.names = FALSE)
77+
}
78+
)
79+
}
80+
shinyApp(ui = ui, server = server)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"collab_server" : "",
3+
"contents" : "",
4+
"created" : 1553863134764.000,
5+
"dirty" : false,
6+
"encoding" : "UTF-8",
7+
"folds" : "",
8+
"hash" : "900127405",
9+
"id" : "D096A255",
10+
"lastKnownWriteTime" : 1555679781,
11+
"last_content_update" : 1555679781161,
12+
"path" : "~/Documenti/R/progetti/pivot/function.R",
13+
"project_path" : "function.R",
14+
"properties" : {
15+
"cursorPosition" : "12,21",
16+
"scrollLine" : "0",
17+
"tempName" : "Untitled1"
18+
},
19+
"relative_order" : 2,
20+
"source_on_save" : false,
21+
"source_window" : "",
22+
"type" : "r_source"
23+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
createcsv<-function(misura,aggr,data){
2+
#misura<-'mpg'
3+
#aggr<-'Sum'
4+
intest<-paste0(aggr,"(",misura,")")
5+
#a<-readr::read_lines('data.json')
6+
data<-jsonlite::fromJSON(data)
7+
ref<-data$data
8+
nrow<-length(ref)
9+
10+
# compute numero of col
11+
ncol<-0
12+
13+
w<-ref["row1"][[1]]
14+
for(j in colnames(w)){
15+
ncol<-ncol+unlist(ref["row1"][[1]][j][[1]]["colSpan"])
16+
}
17+
18+
ris<-list()
19+
for(i in 1:nrow)
20+
ris<-c(ris,list(replicate(ncol,"")))
21+
idrow<-1
22+
for(i in colnames(ref)){
23+
#lista di liste con attributi celle
24+
#i<-"row1"
25+
attribs<-ref[i][[1]]
26+
27+
# col<-ref[i][[1]]
28+
# ncolcur<-length(col)
29+
30+
#init row span max
31+
idcol<-1
32+
33+
for(j in colnames(attribs)){
34+
#attributi cella
35+
attrib<-attribs[j][[1]]
36+
rspan<-as.integer(attrib["rowSpan"])
37+
cspan<-as.integer(attrib["colSpan"])
38+
while(ris[[idrow]][idcol]!=""){
39+
idcol<-idcol+1
40+
}
41+
42+
43+
for(ktmp in 1:rspan){
44+
for(stmp in 1:cspan){
45+
ris[[ktmp+idrow-1]][stmp+idcol-1]<-"#"
46+
}
47+
}
48+
val<-as.character(attrib["innerhtml"])
49+
ris[[idrow]][idcol]<-val
50+
idcol<-idcol+cspan
51+
52+
53+
}
54+
idrow<-idrow+1
55+
}
56+
ris[[1]][1]<-intest
57+
risa<-lapply(ris,function(x){stringr::str_replace(x,"#","")})
58+
59+
tocsv<-as.data.frame(matrix(unlist(risa),ncol=ncol,byrow=TRUE),optional=TRUE)
60+
createcsv<-tocsv
61+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"cursorPosition" : "25,0",
3+
"scrollLine" : "0",
4+
"tempName" : "Untitled1"
5+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"cursorPosition" : "0,35",
3+
"scrollLine" : "0"
4+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"cursorPosition" : "22,22",
3+
"scrollLine" : "22",
4+
"tempName" : "Untitled1"
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"cursorPosition" : "12,21",
3+
"scrollLine" : "0",
4+
"tempName" : "Untitled1"
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"cursorPosition" : "14,34",
3+
"scrollLine" : "0",
4+
"tempName" : "Untitled1"
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"cursorPosition" : "0,4291",
3+
"scrollLine" : "0",
4+
"tempName" : "Untitled1"
5+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"cursorPosition" : "10,6",
3+
"scrollLine" : "0"
4+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"cursorPosition" : "17,0",
3+
"scrollLine" : "0",
4+
"tempName" : "Untitled1"
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"cursorPosition" : "2,0",
3+
"scrollLine" : "0",
4+
"tempName" : "Untitled2"
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"cursorPosition" : "13,20",
3+
"scrollLine" : "0",
4+
"tempName" : "Untitled3"
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"cursorPosition" : "1,0",
3+
"scrollLine" : "0",
4+
"tempName" : "Untitled1"
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"cursorPosition" : "0,4291",
3+
"scrollLine" : "0",
4+
"tempName" : "Untitled1"
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"cursorPosition" : "0,0",
3+
"scrollLine" : "0",
4+
"tempName" : "Untitled1"
5+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"cursorPosition" : "0,4168",
3+
"scrollLine" : "1"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"cursorPosition" : "0,0",
3+
"scrollLine" : "0"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"cursorPosition" : "0,11",
3+
"scrollLine" : "0"
4+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
~%2FDocumenti%2FR%2Fprogetti%2Fpivot%2Fapp.R="47562A60"
2+
~%2FDocumenti%2FR%2Fprogetti%2Fpivot%2Fdata.csv="F84841F2"
3+
~%2FDocumenti%2FR%2Fprogetti%2Fpivot%2Fdata.json="C7512D26"
4+
~%2FDocumenti%2FR%2Fprogetti%2Fpivot%2Fdata_.json="73FF8F4E"
5+
~%2FDocumenti%2FR%2Fprogetti%2Fpivot%2Fdataprova.R="A538DEBD"
6+
~%2FDocumenti%2FR%2Fprogetti%2Fpivot%2Fdataprova.txt="6DEA4B4C"
7+
~%2FDocumenti%2FR%2Fprogetti%2Fpivot%2FdraculaR.R="8575F4D8"
8+
~%2FDocumenti%2FR%2Fprogetti%2Fpivot%2Ffunction.R="4D544256"
9+
~%2FDocumenti%2FR%2Fprogetti%2Fpivot%2Fglobal.R="C63D55B4"
10+
~%2FDocumenti%2FR%2Fprogetti%2Fpivot%2Fp.R="618977B2"
11+
~%2FDocumenti%2FR%2Fprogetti%2Fpivot%2Fpivot.R="2D23674B"
12+
~%2FDocumenti%2FR%2Fprogetti%2Fpivot%2Fpivot.csv="DE69D3E5"
13+
~%2FDocumenti%2FR%2Fprogetti%2Fpivot%2Fpivot_extract.js="9C31A40F"
14+
~%2FDocumenti%2FR%2Fprogetti%2Fpivot%2Frr.R="79DA5E03"
15+
~%2FDocumenti%2FR%2Fprogetti%2Fpivot%2Fshinyjqui.R="8D8CBEA0"
16+
~%2FDocumenti%2FR%2Fprogetti%2Fpivot%2Fwww%2Fpivot_extract.js="30AACC4C"

.Rproj.user/shared/notebooks/patch-chunk-names

Whitespace-only changes.

0 commit comments

Comments
 (0)