...i am working on machine learning project for that need to divide data in training and test .
for that i have used caret package for data partition.
i tried the following code for partition but didnt worked , can anyone tell me what changes i have to make so i can solve and proceed further for same data.
Code i have tried
index <- reactive({
createDataPartition(new$student, p = .80,
list = FALSE,
times = 1)
train10 <- renderTable({ new[index,]
train10
})
test10 <-renderTable({ new[-index,]
test10
})
})
Although I don't know if the data in the variable new$student is valid, one mistake I see in the code is that you assign a reactive variable index, but when you call it, you don't call it as a reactive variable. You should use the brackets when calling them like so:
new[index(),]
I know it looks a bit weird, but in Shiny, reactive values are functions that store the value.
It's better next time to create a reprex (or create one if this didn't help), so we can more easily test the issue ourselves: