Shiny multi class classification

...hello everyone i am working on machine learning project.i am doing Multi class classification sing UBL package. when i tried

ab<-RandOverClassif(ID~ ., rov1, C.perc="balance")

in R studio console it worked,but when i am implementing same code in shiny format i got error saying

incorrect number of dimensions

i tried following code

#oversampling using UBL package 
over_samp<-reactive({
  rov<-smotenew()
  # RandOverClassif(ID ~ ., rov, C.perc="balance")
  rov<-na.omit(rov)
   rov
     })
   output$rob<-renderTable({
     over_samp()
   })
   
   over_samp1<-reactive({
     rov1<-over_samp()
      RandOverClassif(ID~ ., rov1, C.perc="balance")
     #rov<-na.omit(rov)
     over_samp1
   })
   output$rob1<-renderTable({
     over_samp1()
   })

i thought error caused due to NA values therefore i removed NA and Used that data set.
what is meaning of error and How to solve this error.

Hi, welcome!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one for a shiny app

1 Like

what is smotenew() and what have you done to guarantee that it looks like the rov1 in your original code that works in console ?

also it would be good to put req() around inputs to your downstream reactives* and renders* so that they dont try to run with missing inputs.

1 Like

smotenew() is original data set, i copied in rov .
can you elaborate about what are you trying to explain about req() for reactivve and render.

i tried and make it simple .


    #oversampling using UBL package 
 over_samp<-reactive({
   rov<-smotenew()
  RandOverClassif(ID ~ ., rov, C.perc="balance")
  over_samp
      })
    output$rob<-renderTable({
      over_samp()
    })

You haven't provided us code that we could even attempt to run so it's very hard to help you. Because we are just looking for odd things with our eyes....

This doesn't make sense. You wouldn't make a reactive and have it's return value be an unassigned matching name

over_samp<-reactive({ 
rov<-smotenew() 
RandOverClassif(ID ~ ., rov, C.perc="balance")  
})

If you want it to hold the value returned from RandOver... Then that should be the last statement in the reactive

i tried but still got same error

Hi, can you write the code, in the normal non-shiny way. (working)
I should be able to put it into shiny compatible form for you.

this is the non shiny working code.
rob<- RandOverClassif(ID~ ., rov, C.perc="balance")

Sorry but that's incomplete. I can't copy it to my RStudio IDE and run that. If you are unsure, open up a fresh RStudio and paste it in to test it.

1 Like

smote2 - Copy.csv.pdf (7.0 KB)
i have attached small part of my data base and also performed code for the same. Capture
for reference i am showing the part of R studio what i have done .

I can't copy and paste an image into Rstudio either...

Please try the dput() function

in the above f2 would represent rov ?

1 Like

f2<-read.csv("smote2 - Copy.csv")
str(f2)
m2<-RandOverClassif(id ~ ., f2, C.perc="balance")
str(m2)

Yes f2 represent rov.

thanks but can you try this and put the results in your next post:

f2<-read.csv("smote2 - Copy.csv")
dput(f2)

result of dput(f2)

structure(list(id = c(4L, 7L, 4L, 6L, 3L, 7L, 3L, 3L, 1L, 6L, 
3L, 7L, 3L, 10L, 4L, 6L, 3L, 3L, 7L, 8L, 7L, 8L, 7L, 6L, 10L, 
3L, 7L, 6L, 8L, 3L, 4L, 4L, 3L, 4L, 4L, 4L, 3L, 4L, 6L, 9L, 8L, 
7L, 4L, 7L, 4L, 7L, 4L, 10L, 3L, 10L, 8L, 3L, 6L, 7L, 3L, 4L, 
8L, 7L, 4L, 4L, 8L, 8L, 7L, 3L, 4L, 3L, 4L, 3L, 4L, 3L, 6L, 7L, 
5L, 8L, 8L, 6L, 7L, 8L, 3L, 4L, 3L, 7L, 4L, 3L, 3L, 2L, 4L, 7L, 
6L, 7L, 4L, 4L, 7L, 8L, 10L, 3L, 4L, 6L, 7L, 10L, 3L, 8L, 6L, 
3L, 3L, 3L, 3L, 10L, 4L, 3L, 3L, 4L, 3L, 4L, 4L, 1L, 8L, 3L, 
4L, 9L, 6L, 7L, 8L, 4L, 10L, 3L, 6L, 7L, 4L, 3L, 4L, 2L, 8L, 
7L, 8L, 8L, 9L, 3L, 7L, 3L, 4L, 3L, 7L, 3L, 8L, 6L, 3L, 7L, 4L, 
8L, 4L, 4L, 10L, 4L, 3L, 7L, 8L, 4L, 1L, 4L, 4L, 6L, 3L, 3L, 
8L, 4L, 7L, 7L, 8L, 8L, 3L, 3L, 3L, 4L, 10L, 8L, 3L, 6L, 7L, 
3L, 8L, 3L, 3L, 8L, 7L, 3L, 8L, 4L, 3L, 9L, 3L, 10L, 3L, 4L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, 5L, 5L, 7L, 5L, 7L, 7L, 5L, 5L, 15L, 
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 13L, 3L, 5L, 7L, 5L, 7L, 7L, 
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 7L, 7L, 5L, 5L, 5L, 5L, 5L, 
5L, 5L, 5L, 7L, 5L, 7L, 5L, 5L, 5L, 5L, 7L, 5L, 7L, 5L, 7L, 5L, 
7L, 3L, 5L, 3L, 7L, 5L, 5L, 5L, 5L, 5L, 7L, 5L, 5L, 5L, 5L, 5L, 
5L, 5L, 5L, 5L, 3L, 5L, 5L), b = c(39L, 52L, 265L, 697L, 337L, 
702L, 8L, 381L, 532L, 255L, 414L, 723L, 122L, 272L, 350L, 200L, 
367L, 330L, 152L, 457L, 194L, 247L, 1386L, 0L, 638L, 16L, 277L, 
271L, 722L, 81L, 265L, 1330L, 560L, 108L, 367L, 30L, 239L, 218L, 
36L, 73L, 141L, 39L, 378L, 226L, 719L, 33L, 73L, 78L, 395L, 59L, 
146L, 3L, 16L, 492L, 774L, 1627L, 285L, 65L, 83L, 58L, 74L, 273L, 
1675L, 520L, 80L, 26L, 83L, 391L, 346L, 89L, 169L, 814L, 75L, 
321L, 65L, 482L, 2020L, 339L, 346L, 56L, 295L, 567L, 354L, 281L, 
789L, 839L, 328L, 13L, 555L, 111L, 51L, 135L, 67L, 67L, 166L, 
178L, 287L, 1503L, 120L, 57L, 137L, 593L, 211L, 1059L, 177L, 
483L, 73L, 216L, 180L, 454L, 87L, 181L, 54L, 975L, 470L, 704L, 
205L, 419L, 487L, 187L, 911L, 315L, 542L, 874L, 553L, 44L, 587L, 
138L, 507L, 185L, 435L, 123L, 192L, 121L, 676L, 46L, 352L, 406L, 
210L, 219L, 56L, 122L, 8L, 96L, 45L, 43L, 1223L, 120L, 336L, 
274L, 658L, 670L, 627L, 319L, 1270L, 91L, 158L, 556L, 341L, 1070L, 
561L, 284L, 209L, 365L, 119L, 250L, 0L, 959L, 361L, 597L, 941L, 
673L, 128L, 303L, 4L, 1L, 46L, 227L, 200L, 73L, 428L, 75L, 141L, 
105L, 13L, 74L, 370L, 429L, 139L, 307L, 145L, 101L, 28L, 174L, 
517L, 1190L, 491L, 123L, 579L, 169L, 1238L, 396L, 158L, 89L, 
1310L, 223L, 373L, 182L, 295L, 31L, 107L, 65L, 328L, 584L, 417L, 
332L, 1669L, 936L, 160L, 455L, 589L, 1016L, 0L, 78L, 682L, 648L, 
243L, 263L, 37L, 108L, 1215L, 189L, 209L, 1222L, 166L, 123L, 
445L, 97L, 379L, 58L, 159L, 199L, 576L, 457L, 94L, 78L, 148L, 
232L, 38L, 292L, 63L, 398L, 406L, 235L, 1294L, 329L, 144L, 231L, 
40L, 73L, 210L, 47L, 587L, 853L, 53L, 252L, 71L, 256L, 828L, 
111L, 140L, 353L, 365L, 107L, 862L, 467L, 349L, 1325L, 38L, 252L, 
496L, 57L, 39L, 1645L, 156L, 20L, 47L, 112L, 19L, 991L, 390L, 
295L, 129L, 175L, 0L, 58L, 144L, 890L, 46L, 672L, 188L, 183L, 
934L, 153L, 1604L, 458L, 58L, 512L, 500L, 133L, 72L, 152L, 58L, 
114L, 738L, 236L, 388L, 188L, 305L, 248L, 890L, 109L, 128L, 244L, 
19L, 280L, 679L, 450L, 461L, 68L, 532L, 48L, 30L, 262L, 433L, 
118L, 352L, 101L, 67L, 275L, 430L, 50L, 576L, 867L, 327L, 234L, 
156L, 1405L, 107L, 419L, 162L, 232L, 42L, 96L, 345L, 372L, 220L, 
143L, 244L, 302L, 682L, 75L, 184L, 95L, 77L, 1098L, 81L, 160L, 
148L, 1621L, 336L, 431L, 113L, 112L, 627L, 191L, 457L, 710L, 
232L, 77L, 626L, 625L, 898L, 675L, 1131L, 228L, 145L, 70L, 248L, 
800L, 260L, 46L, 190L, 50L, 409L, 29L, 174L, 45L, 68L, 432L, 
66L, 156L, 294L, 1104L, 49L, 642L, 131L, 44L, 67L, 87L, 1132L, 
160L, 214L, 269L, 276L, 631L, 105L, 348L, 95L, 56L, 293L, 319L, 
272L, 728L, 370L, 26L, 179L, 681L, 382L, 210L, 59L, 210L, 845L, 
37L, 418L, 537L, 347L, 145L, 636L, 565L, 487L, 1779L, 371L, 542L, 
185L, 157L, 565L, 585L, 554L, 713L, 99L, 481L, 35L, 149L, 244L, 
162L, 172L, 464L, 222L, 1905L, 562L, 172L, 162L, 278L, 173L, 
273L, 40L, 751L, 38L, 83L, 174L, 72L, 980L, 736L, 922L, 108L, 
110L, 1686L, 360L, 71L, 301L, 195L, 684L, 367L, 102L, 485L, 285L, 
543L, 365L, 266L, 404L, 179L, 1267L, 244L, 337L, 470L, 720L, 
434L, 359L, 156L, 312L, 422L, 133L, 577L, 157L, 214L, 598L, 111L, 
469L, 246L, 936L, 48L, 140L, 75L), c = c(59L, 74L, 65L, 76L, 
75L, 66L, 60L, 74L, 65L, 64L, 65L, 73L, 72L, 70L, 65L, 59L, 72L, 
67L, 59L, 71L, 69L, 74L, 54L, 48L, 61L, 67L, 71L, 65L, 70L, 42L, 
68L, 53L, 63L, 65L, 51L, 65L, 77L, 65L, 64L, 60L, 75L, 72L, 74L, 
74L, 66L, 65L, 79L, 63L, 61L, 70L, 58L, 68L, 79L, 59L, 62L, 68L, 
76L, 71L, 81L, 71L, 65L, 78L, 56L, 50L, 63L, 65L, 72L, 79L, 59L, 
72L, 56L, 70L, 64L, 74L, 45L, 63L, 62L, 72L, 70L, 68L, 60L, 46L, 
51L, 70L, 73L, 41L, 69L, 65L, 59L, 59L, 59L, 84L, 51L, 53L, 75L, 
68L, 64L, 78L, 50L, 61L, 72L, 71L, 67L, 60L, 52L, 76L, 67L, 74L, 
77L, 81L, 69L, 72L, 69L, 72L, 85L, 56L, 77L, 72L, 74L, 51L, 59L, 
69L, 87L, 54L, 51L, 45L, 75L, 68L, 60L, 84L, 80L, 55L, 62L, 74L, 
51L, 70L, 76L, 74L, 65L, 74L, 66L, 86L, 77L, 69L, 60L, 75L, 63L, 
68L, 66L, 66L, 77L, 61L, 42L, 72L, 69L, 73L, 68L, 65L, 57L, 51L, 
58L, 70L, 65L, 38L, 76L, 65L, 77L, 65L, 56L, 58L, 88L, 39L, 75L, 
65L, 49L, 59L, 61L, 73L, 61L, 75L, 61L, 63L, 77L, 74L, 58L, 70L, 
49L, 74L, 67L, 76L, 58L, 71L, 66L, 60L, 61L, 53L, 71L, 64L, 62L, 
75L, 55L, 55L, 56L, 53L, 44L, 69L, 75L, 72L, 59L, 60L, 76L, 41L, 
72L, 54L, 70L, 75L, 81L, 56L, 66L, 75L, 72L, 73L, 71L, 48L, 75L, 
73L, 62L, 78L, 65L, 82L, 62L, 72L, 52L, 47L, 65L, 80L, 65L, 75L, 
50L, 71L, 66L, 74L, 73L, 72L, 61L, 64L, 76L, 65L, 55L, 59L, 65L, 
67L, 76L, 52L, 77L, 64L, 73L, 81L, 65L, 78L, 52L, 61L, 52L, 58L, 
54L, 60L, 81L, 65L, 54L, 55L, 76L, 71L, 41L, 81L, 72L, 69L, 70L, 
77L, 74L, 69L, 52L, 69L, 66L, 51L, 64L, 80L, 55L, 60L, 65L, 53L, 
69L, 64L, 67L, 67L, 62L, 70L, 70L, 81L, 82L, 68L, 70L, 56L, 64L, 
82L, 58L, 56L, 52L, 69L, 65L, 65L, 84L, 65L, 58L, 72L, 50L, 55L, 
59L, 64L, 71L, 61L, 59L, 71L, 52L, 77L, 65L, 84L, 58L, 79L, 68L, 
75L, 58L, 54L, 75L, 87L, 78L, 45L, 69L, 73L, 69L, 65L, 54L, 80L, 
72L, 47L, 64L, 66L, 73L, 56L, 67L, 67L, 72L, 77L, 57L, 78L, 69L, 
62L, 72L, 42L, 65L, 71L, 52L, 70L, 65L, 80L, 73L, 41L, 62L, 65L, 
57L, 71L, 76L, 76L, 75L, 59L, 79L, 65L, 55L, 59L, 68L, 67L, 46L, 
60L, 71L, 60L, 65L, 60L, 69L, 79L, 64L, 61L, 68L, 49L, 65L, 65L, 
73L, 72L, 67L, 70L, 72L, 56L, 52L, 69L, 76L, 61L, 63L, 67L, 62L, 
43L, 63L, 59L, 65L, 84L, 67L, 76L, 61L, 62L, 85L, 72L, 75L, 79L, 
61L, 42L, 70L, 58L, 62L, 65L, 42L, 57L, 73L, 67L, 67L, 54L, 65L, 
70L, 48L, 83L, 70L, 60L, 63L, 49L, 54L, 69L, 60L, 60L, 68L, 59L, 
60L, 60L, 59L, 58L, 71L, 64L, 64L, 68L, 57L, 53L, 49L, 62L, 71L, 
68L, 74L, 65L, 63L, 61L, 76L, 77L, 85L, 79L, 56L, 65L, 57L, 70L, 
40L, 59L, 70L, 85L, 62L, 57L, 59L, 77L, 57L, 63L, 65L, 50L, 61L, 
59L, 70L, 70L, 68L, 58L, 62L, 70L, 47L, 65L, 78L, 60L, 65L, 67L, 
40L, 57L, 63L, 61L, 63L, 61L, 65L, 45L, 60L, 66L, 57L, 73L, 70L, 
78L, 67L, 64L), d = c(7L, 8L, 7L, 8L, 7L, 7L, 7L, 7L, 7L, 7L, 
8L, 8L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 7L, 8L, 7L, 7L, 7L, 7L, 7L, 
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 
7L, 7L, 7L, 8L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 7L, 7L, 7L, 8L, 
7L, 8L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 7L, 7L, 7L, 
7L, 7L, 7L, 7L, 7L, 8L, 8L, 7L, 7L, 7L, 8L, 7L, 7L, 7L, 7L, 7L, 
7L, 7L, 7L, 8L, 7L, 7L, 8L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 7L, 7L, 8L, 7L, 7L, 7L, 8L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, 7L, 7L, 7L, 7L, 
7L, 8L, 7L, 7L, 8L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 7L, 7L, 7L, 7L, 
7L, 7L, 7L, 8L, 7L, 7L, 7L, 7L, 8L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 
8L, 7L, 8L, 7L, 8L, 7L, 7L, 7L, 7L, 7L, 8L, 7L, 7L, 7L, 7L, 7L, 
7L, 7L, 7L, 7L, 8L, 7L, 8L, 7L, 8L, 7L, 8L, 7L, 7L, 7L, 8L, 7L, 
8L, 8L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 7L, 7L, 
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 7L, 7L, 7L, 7L, 7L, 8L, 7L, 
7L, 7L, 7L, 7L, 8L, 7L, 7L, 7L, 7L, 7L, 8L, 7L, 7L, 7L, 8L, 7L, 
7L, 7L, 7L, 7L, 7L, 7L, 8L, 7L)), class = "data.frame", row.names = c(NA, 
-514L))```
1 Like

Heres a working starting point for you.

library(shiny)
library(tidyverse)
library(UBL)
example_df <- structure(list(id = c(
  4L, 7L, 4L, 6L, 3L, 7L, 3L, 3L, 1L, 6L,
  3L, 7L, 3L, 10L, 4L, 6L, 3L, 3L, 7L, 8L, 7L, 8L, 7L, 6L, 10L,
  3L, 7L, 6L, 8L, 3L, 4L, 4L, 3L, 4L, 4L, 4L, 3L, 4L, 6L, 9L, 8L,
  7L, 4L, 7L, 4L, 7L, 4L, 10L, 3L, 10L, 8L, 3L, 6L, 7L, 3L, 4L,
  8L, 7L, 4L, 4L, 8L, 8L, 7L, 3L, 4L, 3L, 4L, 3L, 4L, 3L, 6L, 7L,
  5L, 8L, 8L, 6L, 7L, 8L, 3L, 4L, 3L, 7L, 4L, 3L, 3L, 2L, 4L, 7L,
  6L, 7L, 4L, 4L, 7L, 8L, 10L, 3L, 4L, 6L, 7L, 10L, 3L, 8L, 6L,
  3L, 3L, 3L, 3L, 10L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5L, 5L,
  5L, 11L, 5L, 5L, 5L, 7L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
  5L, 5L, 5L, 5L, 3L, 5L, 5L, 5L, 5L, 5L, 9L, 5L, 5L, 5L, 5L, 5L,
  5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
  5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 11L, 5L, 5L, 5L, 3L,
  3L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 7L, 5L, 5L, 5L, 5L,
  7L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 7L, 5L, 7L, 7L, 5L, 5L, 15L,
  5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 13L, 3L, 5L, 7L, 5L, 7L, 7L,
  5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 7L, 7L, 5L, 5L, 5L, 5L, 5L,
  5L, 5L, 5L, 7L, 5L, 7L, 5L, 5L, 5L, 5L, 7L, 5L, 7L, 5L, 7L, 5L,
  7L, 3L, 5L, 3L, 7L, 5L, 5L, 5L, 5L, 5L, 7L, 5L, 5L, 5L, 5L, 5L,
  5L, 5L, 5L, 5L, 3L, 5L, 5L
), b = c(
  39L, 52L, 265L, 697L, 337L,
  702L, 8L, 381L, 532L, 255L, 414L, 723L, 122L, 272L, 350L, 200L,
  367L, 330L, 152L, 457L, 194L, 247L, 1386L, 0L, 638L, 16L, 277L,
  271L, 722L, 81L, 265L, 1330L, 560L, 108L, 367L, 30L, 239L, 218L,
  36L, 73L, 141L, 39L, 378L, 226L, 719L, 33L, 73L, 78L, 395L, 59L,
  146L, 3L, 16L, 492L, 774L, 1627L, 285L, 65L, 83L, 58L, 74L, 273L,
  1675L, 520L, 80L, 26L, 83L, 391L, 346L, 89L, 169L, 814L, 75L,
  321L, 65L, 482L, 2020L, 339L, 346L, 56L, 295L, 567L, 354L, 281L,
  789L, 839L, 328L, 13L, 555L, 111L, 51L, 135L, 67L, 67L, 166L,
  178L, 287L, 1503L, 120L, 57L, 137L, 593L, 211L, 1059L, 177L,
  483L, 73L, 216L, 180L, 454L, 87L, 181L, 54L, 975L, 470L, 704L,
  205L, 419L, 487L, 187L, 911L, 315L, 542L, 874L, 553L, 44L, 587L,
  138L, 507L, 185L, 435L, 123L, 192L, 121L, 676L, 46L, 352L, 406L,
  210L, 219L, 56L, 122L, 8L, 96L, 45L, 43L, 1223L, 120L, 336L,
  274L, 658L, 670L, 627L, 319L, 1270L, 91L, 158L, 556L, 341L, 1070L,
  561L, 284L, 209L, 365L, 119L, 250L, 0L, 959L, 361L, 597L, 941L,
  673L, 128L, 303L, 4L, 1L, 46L, 227L, 200L, 73L, 428L, 75L, 141L,
  105L, 13L, 74L, 370L, 429L, 139L, 307L, 145L, 101L, 28L, 174L,
  517L, 1190L, 491L, 123L, 579L, 169L, 1238L, 396L, 158L, 89L,
  1310L, 223L, 373L, 182L, 295L, 31L, 107L, 65L, 328L, 584L, 417L,
  332L, 1669L, 936L, 160L, 455L, 589L, 1016L, 0L, 78L, 682L, 648L,
  243L, 263L, 37L, 108L, 1215L, 189L, 209L, 1222L, 166L, 123L,
  445L, 97L, 379L, 58L, 159L, 199L, 576L, 457L, 94L, 78L, 148L,
  232L, 38L, 292L, 63L, 398L, 406L, 235L, 1294L, 329L, 144L, 231L,
  40L, 73L, 210L, 47L, 587L, 853L, 53L, 252L, 71L, 256L, 828L,
  111L, 140L, 353L, 365L, 107L, 862L, 467L, 349L, 1325L, 38L, 252L,
  496L, 57L, 39L, 1645L, 156L, 20L, 47L, 112L, 19L, 991L, 390L,
  295L, 129L, 175L, 0L, 58L, 144L, 890L, 46L, 672L, 188L, 183L,
  934L, 153L, 1604L, 458L, 58L, 512L, 500L, 133L, 72L, 152L, 58L,
  114L, 738L, 236L, 388L, 188L, 305L, 248L, 890L, 109L, 128L, 244L,
  19L, 280L, 679L, 450L, 461L, 68L, 532L, 48L, 30L, 262L, 433L,
  118L, 352L, 101L, 67L, 275L, 430L, 50L, 576L, 867L, 327L, 234L,
  156L, 1405L, 107L, 419L, 162L, 232L, 42L, 96L, 345L, 372L, 220L,
  143L, 244L, 302L, 682L, 75L, 184L, 95L, 77L, 1098L, 81L, 160L,
  148L, 1621L, 336L, 431L, 113L, 112L, 627L, 191L, 457L, 710L,
  232L, 77L, 626L, 625L, 898L, 675L, 1131L, 228L, 145L, 70L, 248L,
  800L, 260L, 46L, 190L, 50L, 409L, 29L, 174L, 45L, 68L, 432L,
  66L, 156L, 294L, 1104L, 49L, 642L, 131L, 44L, 67L, 87L, 1132L,
  160L, 214L, 269L, 276L, 631L, 105L, 348L, 95L, 56L, 293L, 319L,
  272L, 728L, 370L, 26L, 179L, 681L, 382L, 210L, 59L, 210L, 845L,
  37L, 418L, 537L, 347L, 145L, 636L, 565L, 487L, 1779L, 371L, 542L,
  185L, 157L, 565L, 585L, 554L, 713L, 99L, 481L, 35L, 149L, 244L,
  162L, 172L, 464L, 222L, 1905L, 562L, 172L, 162L, 278L, 173L,
  273L, 40L, 751L, 38L, 83L, 174L, 72L, 980L, 736L, 922L, 108L,
  110L, 1686L, 360L, 71L, 301L, 195L, 684L, 367L, 102L, 485L, 285L,
  543L, 365L, 266L, 404L, 179L, 1267L, 244L, 337L, 470L, 720L,
  434L, 359L, 156L, 312L, 422L, 133L, 577L, 157L, 214L, 598L, 111L,
  469L, 246L, 936L, 48L, 140L, 75L
), c = c(
  59L, 74L, 65L, 76L,
  75L, 66L, 60L, 74L, 65L, 64L, 65L, 73L, 72L, 70L, 65L, 59L, 72L,
  67L, 59L, 71L, 69L, 74L, 54L, 48L, 61L, 67L, 71L, 65L, 70L, 42L,
  68L, 53L, 63L, 65L, 51L, 65L, 77L, 65L, 64L, 60L, 75L, 72L, 74L,
  74L, 66L, 65L, 79L, 63L, 61L, 70L, 58L, 68L, 79L, 59L, 62L, 68L,
  76L, 71L, 81L, 71L, 65L, 78L, 56L, 50L, 63L, 65L, 72L, 79L, 59L,
  72L, 56L, 70L, 64L, 74L, 45L, 63L, 62L, 72L, 70L, 68L, 60L, 46L,
  51L, 70L, 73L, 41L, 69L, 65L, 59L, 59L, 59L, 84L, 51L, 53L, 75L,
  68L, 64L, 78L, 50L, 61L, 72L, 71L, 67L, 60L, 52L, 76L, 67L, 74L,
  77L, 81L, 69L, 72L, 69L, 72L, 85L, 56L, 77L, 72L, 74L, 51L, 59L,
  69L, 87L, 54L, 51L, 45L, 75L, 68L, 60L, 84L, 80L, 55L, 62L, 74L,
  51L, 70L, 76L, 74L, 65L, 74L, 66L, 86L, 77L, 69L, 60L, 75L, 63L,
  68L, 66L, 66L, 77L, 61L, 42L, 72L, 69L, 73L, 68L, 65L, 57L, 51L,
  58L, 70L, 65L, 38L, 76L, 65L, 77L, 65L, 56L, 58L, 88L, 39L, 75L,
  65L, 49L, 59L, 61L, 73L, 61L, 75L, 61L, 63L, 77L, 74L, 58L, 70L,
  49L, 74L, 67L, 76L, 58L, 71L, 66L, 60L, 61L, 53L, 71L, 64L, 62L,
  75L, 55L, 55L, 56L, 53L, 44L, 69L, 75L, 72L, 59L, 60L, 76L, 41L,
  72L, 54L, 70L, 75L, 81L, 56L, 66L, 75L, 72L, 73L, 71L, 48L, 75L,
  73L, 62L, 78L, 65L, 82L, 62L, 72L, 52L, 47L, 65L, 80L, 65L, 75L,
  50L, 71L, 66L, 74L, 73L, 72L, 61L, 64L, 76L, 65L, 55L, 59L, 65L,
  67L, 76L, 52L, 77L, 64L, 73L, 81L, 65L, 78L, 52L, 61L, 52L, 58L,
  54L, 60L, 81L, 65L, 54L, 55L, 76L, 71L, 41L, 81L, 72L, 69L, 70L,
  77L, 74L, 69L, 52L, 69L, 66L, 51L, 64L, 80L, 55L, 60L, 65L, 53L,
  69L, 64L, 67L, 67L, 62L, 70L, 70L, 81L, 82L, 68L, 70L, 56L, 64L,
  82L, 58L, 56L, 52L, 69L, 65L, 65L, 84L, 65L, 58L, 72L, 50L, 55L,
  59L, 64L, 71L, 61L, 59L, 71L, 52L, 77L, 65L, 84L, 58L, 79L, 68L,
  75L, 58L, 54L, 75L, 87L, 78L, 45L, 69L, 73L, 69L, 65L, 54L, 80L,
  72L, 47L, 64L, 66L, 73L, 56L, 67L, 67L, 72L, 77L, 57L, 78L, 69L,
  62L, 72L, 42L, 65L, 71L, 52L, 70L, 65L, 80L, 73L, 41L, 62L, 65L,
  57L, 71L, 76L, 76L, 75L, 59L, 79L, 65L, 55L, 59L, 68L, 67L, 46L,
  60L, 71L, 60L, 65L, 60L, 69L, 79L, 64L, 61L, 68L, 49L, 65L, 65L,
  73L, 72L, 67L, 70L, 72L, 56L, 52L, 69L, 76L, 61L, 63L, 67L, 62L,
  43L, 63L, 59L, 65L, 84L, 67L, 76L, 61L, 62L, 85L, 72L, 75L, 79L,
  61L, 42L, 70L, 58L, 62L, 65L, 42L, 57L, 73L, 67L, 67L, 54L, 65L,
  70L, 48L, 83L, 70L, 60L, 63L, 49L, 54L, 69L, 60L, 60L, 68L, 59L,
  60L, 60L, 59L, 58L, 71L, 64L, 64L, 68L, 57L, 53L, 49L, 62L, 71L,
  68L, 74L, 65L, 63L, 61L, 76L, 77L, 85L, 79L, 56L, 65L, 57L, 70L,
  40L, 59L, 70L, 85L, 62L, 57L, 59L, 77L, 57L, 63L, 65L, 50L, 61L,
  59L, 70L, 70L, 68L, 58L, 62L, 70L, 47L, 65L, 78L, 60L, 65L, 67L,
  40L, 57L, 63L, 61L, 63L, 61L, 65L, 45L, 60L, 66L, 57L, 73L, 70L,
  78L, 67L, 64L
), d = c(
  7L, 8L, 7L, 8L, 7L, 7L, 7L, 7L, 7L, 7L,
  8L, 8L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 7L, 8L, 7L, 7L, 7L, 7L, 7L,
  7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
  7L, 7L, 7L, 7L, 7L, 7L, 7L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, 7L, 7L, 8L, 7L, 7L, 7L, 8L, 7L, 7L, 7L, 7L, 7L, 7L,
  7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 7L, 7L, 7L, 7L,
  7L, 7L, 8L, 8L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
  7L, 7L, 8L, 7L, 7L, 7L, 7L, 7L, 8L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
  7L, 7L, 7L, 7L, 7L, 7L, 8L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 7L, 7L,
  8L, 8L, 7L, 7L, 7L, 8L, 8L, 7L, 7L, 8L, 7L, 7L, 7L, 7L, 7L, 7L,
  7L, 8L, 7L, 7L, 8L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 7L, 7L, 7L, 7L,
  7L, 7L, 7L, 8L, 7L, 7L, 7L, 7L, 8L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
  8L, 7L, 8L, 7L, 8L, 7L, 7L, 7L, 7L, 7L, 8L, 7L, 7L, 7L, 7L, 7L,
  7L, 7L, 7L, 7L, 8L, 7L, 8L, 7L, 8L, 7L, 8L, 7L, 7L, 7L, 8L, 7L,
  8L, 8L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 7L, 7L,
  7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 7L, 7L, 7L, 7L, 7L, 8L, 7L,
  7L, 7L, 7L, 7L, 8L, 7L, 7L, 7L, 7L, 7L, 8L, 7L, 7L, 7L, 8L, 7L,
  7L, 7L, 7L, 7L, 7L, 7L, 8L, 7L
)), class = "data.frame", row.names = c(
  NA,
  -514L
))

ui <- fluidPage(
  splitLayout(
    div( style="border:1px solid",
    tags$h3("Loaded Data"),
    shiny::dataTableOutput("loaded_dt")
    ),
    div(),
    div(style="border:1px solid",
      tags$h3("Resampled Data"),
      shiny::dataTableOutput("resampled_dt")
    ),
    cellWidths = c(500, 20, 500)
  )
)

server <- function(input, output, session) {
  rov <- reactive({
    example_df
  })
  rob <- reactive({
    RandOverClassif(id ~ ., rov(), C.perc = "balance")
  })

  output$loaded_dt <- renderDataTable({
    req(rov())
  })

  output$resampled_dt <- renderDataTable({
    req(rob())
  })
}

shinyApp(ui, server)
1 Like

Thank you very much for your all efforts . when i tried same (just by changing variable name according to my code) still got same error saying
incorrect number of dimension

   rov <- reactive({
            smotenew()
          })
          rob <- reactive({
            RandOverClassif(tumor_stage ~ ., rov(), C.perc = "balance")
          })
          output$resampled_dt <- renderDataTable({
            rob()
          })

As you described i ran above code.
Could please tell me whats going wrong?
And what does error mean?

how have you defined this ? I have no idea of the contents...
Your problem is certainly on this mysterious smotenew() issue.
why is it with brackets?... its another reactive you defined ?
its defined by a-non reactive function?

i tried without () also ,then got error object of type 'closure' is not subsettable.

where did it come from, how are you providing it content....
i cant see what you dont share. I cant diagnose a patient when they are invisible to me.

What edits to my example did you make to bring you were you are now ?
better still, just provide it, like I provided mine to you...

thank you..

             
          #SMOTE
          smotenew<-reactive({
            smotenew2<-new1()
            smotenew2$id <- as.factor(smotenew2$id)
            smotenew2
          })
          
          output$smote_data<-renderPrint({
            str(smotenew())
          })
          
            #oversampling using UBL package 
          rov <- reactive({
            smotenew
          })
          rob <- reactive({
            RandOverClassif(id ~ ., rov(), C.perc = "balance")
          })
          output$resampled_dt <- renderDataTable({
            rob()
          })
      

this from where smote comes in code