{"action":"opened","issue":{"url":"https://api.github.com/repos/joey711/phyloseq/issues/625","repository_url":"https://api.github.com/repos/joey711/phyloseq","labels_url":"https://api.github.com/repos/joey711/phyloseq/issues/625/labels{/name}","comments_url":"https://api.github.com/repos/joey711/phyloseq/issues/625/comments","events_url":"https://api.github.com/repos/joey711/phyloseq/issues/625/events","html_url":"https://github.com/joey711/phyloseq/issues/625","id":159759862,"number":625,"title":"error in sample()","user":{"login":"harryrana2003","id":19869534,"avatar_url":"https://avatars.githubusercontent.com/u/19869534?v=3","gravatar_id":"","url":"https://api.github.com/users/harryrana2003","html_url":"https://github.com/harryrana2003","followers_url":"https://api.github.com/users/harryrana2003/followers","following_url":"https://api.github.com/users/harryrana2003/following{/other_user}","gists_url":"https://api.github.com/users/harryrana2003/gists{/gist_id}","starred_url":"https://api.github.com/users/harryrana2003/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harryrana2003/subscriptions","organizations_url":"https://api.github.com/users/harryrana2003/orgs","repos_url":"https://api.github.com/users/harryrana2003/repos","events_url":"https://api.github.com/users/harryrana2003/events{/privacy}","received_events_url":"https://api.github.com/users/harryrana2003/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-06-11T06:58:07Z","updated_at":"2016-06-11T06:58:07Z","closed_at":null,"body":"Warning: Error in <Anonymous>: unable to find an inherited method for function ‘sample’ for signature ‘\"integer\", \"missing\", \"missing\"’\r\nStack trace (innermost first):\r\n    45: <Anonymous>\r\n    44: sample\r\n    43: [.data.frame\r\n    42: [ [/resources/FinalProject/server.R#83]\r\n    41: rst [/resources/FinalProject/server.R#83]\r\n    40: server [/resources/FinalProject/server.R#241]\r\n     1: shiny::runApp\r\nError in (function (classes, fdef, mtable)  : \r\n  unable to find an inherited method for function ‘sample’ for signature ‘\"integer\", \"missing\", \"missing\"’\r\n\r\nsource code:\r\n\r\nmyFile <- file.choose()\r\nno_col <- max(count.fields(myFile))\r\ndecision.table <-SF.read.DecisionTable(filename = myFile, decision.attr = no_col, indx.nominal = NULL, stringsAsFactors=FALSE)\r\n\r\nshinyServer(function(input, output) {\r\n  \r\n  rst<- function()({\r\n      \r\n    ## Shuffle the data with set.seed\r\n    set.seed(123)\r\n    decision.table <- decision.table[sample(nrow(decision.table)),]\r\n    \r\n       idx <- round(0.6 * nrow(decision.table))\r\n    table.tra <-SF.asDecisionTable(decision.table[1:idx,], decision.attr = ncol(decision.table), indx.nominal = NULL)\r\n    table.tst <- SF.asDecisionTable(decision.table[(idx+1):nrow(decision.table), -ncol(decision.table)])\r\n    \r\n    ## Discretization\r\n    cut.values <- D.discretization.RST(table.tra, type.method = \"unsupervised.quantiles\", nOfIntervals = 3)\r\n    d.tra <- SF.applyDecTable(table.tra, cut.values)\r\n    d.tst <- SF.applyDecTable(table.tst, cut.values)\r\n    \r\n   \r\n     reduct.1 <- FS.reduct.computation(d.tra, method = \"DAAR.heuristic\")\r\n     reduct.1\r\n    \r\n    ## generate rules\t\r\n    \r\n    rules.rst <- RI.indiscernibilityBasedRules.RST(d.tra, reduct.1)\r\n   \r\n    write.csv(as.character(rules.rst), \"MyfileRST.csv\")\r\n    \r\n    \r\n    pred.vals <- predict(rules.rst, d.tst)\r\n    pred.vals = na.omit(pred.vals)\r\n    \r\n    \r\n    \r\n    ## calculating error\r\n    real.val <- decision.table[(idx+1):nrow(decision.table),\r\n                               ncol(decision.table), drop = FALSE]\r\n    real.val = na.omit(real.val)\r\n    \r\n    summary(real.val)\r\n    summary(pred.vals)\r\n    levels(real.val$V10)\r\n    levels(pred.vals)<- c(\"2\", \"3\", \"4\")\r\n    levels(pred.vals)\r\n    \r\n    \r\n    err <- 100*sum(pred.vals!=real.val)/nrow(pred.vals)\r\n    ##cat(\"The percentage error = \", err, \"\\n\")\r\n    ##mean(pred.vals == real.val)\r\n    \r\n    (cconfmt <- confusionMatrix(data = pred.vals[[1]], reference = real.val$V10[1:201], positive=\"1\")$table)\r\n    \r\n    \r\n    result <- confusionMatrix(pred.vals[[1]], real.val$V10[1:201])\r\n    confusion<-melt(cconfmt)\r\n    \r\n    \r\n    \r\n    list(result=result, rules.rst=rules.rst, confusion=confusion)\r\n  })"}}
{"actor":{"display_login":"harryrana2003"}}