@@ -1452,33 +1452,13 @@ output$attrtbl_sm <- renderPrint({
14521452 attrname <- input $ attrcols
14531453 tbl_list <- list ()
14541454 if (ntbl == 1 ){
1455- lvls <- length(unique(nwdf()[[attrname ]]))
1456- if (attrname %in% numattr() & lvls > 9 ){
1457- tab <- hist(nwdf()[[attrname ]], breaks = 10 , plot = FALSE )
1458- barname <- paste(tab $ breaks [1 : 2 ], collapse = " -" )
1459- for (i in seq(length(tab $ breaks ) - 2 )){
1460- barname <- append(barname , paste(tab $ breaks [i + 1 ]+ 1 , tab $ breaks [i + 2 ], sep = " -" ))
1461- }
1462- tab <- tab $ counts
1463- names(tab ) <- barname
1464- } else {
1465- tab <- table(nwdf()[[attrname ]])
1466- }
1455+ tab <- attr.info(df = nwdf(), colname = attrname ,
1456+ numattrs = numattr(), breaks = 10 )
14671457 tbl_list [[attrname ]] <- tab
14681458 } else {
14691459 for (a in attrname ){
1470- lvls <- length(unique(nwdf()[[a ]]))
1471- if (a %in% numattr() & lvls > 9 ){
1472- tab <- hist(nwdf()[[a ]], breaks = 10 , plot = FALSE )
1473- barname <- paste(tab $ breaks [1 : 2 ], collapse = " -" )
1474- for (i in seq(length(tab $ breaks ) - 2 )){
1475- barname <- append(barname , paste(tab $ breaks [i + 1 ]+ 1 , tab $ breaks [i + 2 ], sep = " -" ))
1476- }
1477- tab <- tab $ counts
1478- names(tab ) <- barname
1479- } else {
1480- tab <- table(nwdf()[[a ]])
1481- }
1460+ tab <- attr.info(df = nwdf(), colname = a ,
1461+ numattrs = numattr(), breaks = 10 )
14821462 tbl_list [[a ]] <- tab
14831463 }
14841464 }
@@ -1496,12 +1476,8 @@ output$attrhist <- renderPlot({
14961476 plot(density(nwdf()[[attrname ]]), main = attrname ,
14971477 col = " #076EC3" , lwd = 2 )
14981478 } else {
1499- if (attrname %in% numattr() & lvls > 9 ){
1500- out <- hist.info(nwdf()[[attrname ]], breaks = 10 )
1501- tab <- out $ counts
1502- } else {
1503- tab <- table(nwdf()[[attrname ]])
1504- }
1479+ tab <- attr.info(df = nwdf(), colname = attrname ,
1480+ numattrs = numattr(), breaks = 10 )
15051481 if (input $ attrhistaxis == " percent" ){
15061482 tab <- tab / sum(tab )
15071483 }
@@ -1515,15 +1491,12 @@ output$attrhist <- renderPlot({
15151491 if (input $ attrhistaxis == " density" & a %in% numattr() & lvls > 9 ){
15161492 plot(density(nwdf()[[a ]]), main = a , col = " #076EC3" , lwd = 2 )
15171493 } else {
1518- if (a %in% numattr() & lvls > 9 ){
1519- tab <- hist.info(nwdf()[[a ]], breaks = 10 )
1520- } else {
1521- tab <- table(nwdf()[[a ]])
1522- }
1523- if (input $ attrhistaxis == " percent" ){
1524- tab <- tab / sum(tab )
1525- }
1526- barplot(tab , main = a , col = histblue )
1494+ tab <- attr.info(df = nwdf(), colname = a ,
1495+ numattrs = numattr(), breaks = 10 )
1496+ if (input $ attrhistaxis == " percent" ){
1497+ tab <- tab / sum(tab )
1498+ }
1499+ barplot(tab , main = a , col = histblue )
15271500 }
15281501 }
15291502 }
0 commit comments