R Shiny Summary Statistics and Boxplot
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I'm very new to R and i need some help on getting an output for summary statistics and boxplot from a csv file. I tried the following ui.R and server.R file but it had an error message of not being able to find the csv file for the output. But i did reference the data to be read in the ui.R file.
Appreciate any advice or help on this as i'm really lost at why the error is happening. Thanks.
data <-read.csv("sample_finaldata.csv", stringsAsFactors = FALSE)
ui.R
library(shiny)
library(ggplot2)
library(dplyr)
data <-read.csv("sample_finaldata.csv", stringsAsFactors = FALSE)
shinyUI(fluidPage(
titlePanel("Anime Selection"),
sidebarLayout(
sidebarPanel(
selectInput("var",label="Choose a variable",choice=c("user_days_spent_watching"=1,
"score"=2,
"age"=3,
"user_days"=4,
"stats_mean_score"=5,
"user_days"=6
), selectize=FALSE)),
mainPanel(
h2("Summary of the variable"),
verbatimTextOutput("sum"),
plotOutput("box")
)
))
)
server.R
library(shiny)
library(datasets)
shinyServer(function(input,output)
output$sum <- renderPrint(
summary(data[,as.numeric(input$var)])
)
output$box <- renderPlot(
x<-summary(data[,as.numeric(input$var)])
boxplot(x,col="sky blue",border="purple",main=names(data[as.numeric(input$var)]))
)
)
r shiny statistics boxplot
add a comment |
I'm very new to R and i need some help on getting an output for summary statistics and boxplot from a csv file. I tried the following ui.R and server.R file but it had an error message of not being able to find the csv file for the output. But i did reference the data to be read in the ui.R file.
Appreciate any advice or help on this as i'm really lost at why the error is happening. Thanks.
data <-read.csv("sample_finaldata.csv", stringsAsFactors = FALSE)
ui.R
library(shiny)
library(ggplot2)
library(dplyr)
data <-read.csv("sample_finaldata.csv", stringsAsFactors = FALSE)
shinyUI(fluidPage(
titlePanel("Anime Selection"),
sidebarLayout(
sidebarPanel(
selectInput("var",label="Choose a variable",choice=c("user_days_spent_watching"=1,
"score"=2,
"age"=3,
"user_days"=4,
"stats_mean_score"=5,
"user_days"=6
), selectize=FALSE)),
mainPanel(
h2("Summary of the variable"),
verbatimTextOutput("sum"),
plotOutput("box")
)
))
)
server.R
library(shiny)
library(datasets)
shinyServer(function(input,output)
output$sum <- renderPrint(
summary(data[,as.numeric(input$var)])
)
output$box <- renderPlot(
x<-summary(data[,as.numeric(input$var)])
boxplot(x,col="sky blue",border="purple",main=names(data[as.numeric(input$var)]))
)
)
r shiny statistics boxplot
add a comment |
I'm very new to R and i need some help on getting an output for summary statistics and boxplot from a csv file. I tried the following ui.R and server.R file but it had an error message of not being able to find the csv file for the output. But i did reference the data to be read in the ui.R file.
Appreciate any advice or help on this as i'm really lost at why the error is happening. Thanks.
data <-read.csv("sample_finaldata.csv", stringsAsFactors = FALSE)
ui.R
library(shiny)
library(ggplot2)
library(dplyr)
data <-read.csv("sample_finaldata.csv", stringsAsFactors = FALSE)
shinyUI(fluidPage(
titlePanel("Anime Selection"),
sidebarLayout(
sidebarPanel(
selectInput("var",label="Choose a variable",choice=c("user_days_spent_watching"=1,
"score"=2,
"age"=3,
"user_days"=4,
"stats_mean_score"=5,
"user_days"=6
), selectize=FALSE)),
mainPanel(
h2("Summary of the variable"),
verbatimTextOutput("sum"),
plotOutput("box")
)
))
)
server.R
library(shiny)
library(datasets)
shinyServer(function(input,output)
output$sum <- renderPrint(
summary(data[,as.numeric(input$var)])
)
output$box <- renderPlot(
x<-summary(data[,as.numeric(input$var)])
boxplot(x,col="sky blue",border="purple",main=names(data[as.numeric(input$var)]))
)
)
r shiny statistics boxplot
I'm very new to R and i need some help on getting an output for summary statistics and boxplot from a csv file. I tried the following ui.R and server.R file but it had an error message of not being able to find the csv file for the output. But i did reference the data to be read in the ui.R file.
Appreciate any advice or help on this as i'm really lost at why the error is happening. Thanks.
data <-read.csv("sample_finaldata.csv", stringsAsFactors = FALSE)
ui.R
library(shiny)
library(ggplot2)
library(dplyr)
data <-read.csv("sample_finaldata.csv", stringsAsFactors = FALSE)
shinyUI(fluidPage(
titlePanel("Anime Selection"),
sidebarLayout(
sidebarPanel(
selectInput("var",label="Choose a variable",choice=c("user_days_spent_watching"=1,
"score"=2,
"age"=3,
"user_days"=4,
"stats_mean_score"=5,
"user_days"=6
), selectize=FALSE)),
mainPanel(
h2("Summary of the variable"),
verbatimTextOutput("sum"),
plotOutput("box")
)
))
)
server.R
library(shiny)
library(datasets)
shinyServer(function(input,output)
output$sum <- renderPrint(
summary(data[,as.numeric(input$var)])
)
output$box <- renderPlot(
x<-summary(data[,as.numeric(input$var)])
boxplot(x,col="sky blue",border="purple",main=names(data[as.numeric(input$var)]))
)
)
r shiny statistics boxplot
r shiny statistics boxplot
asked Nov 15 '18 at 9:04
SvendSvend
1
1
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You should put the data <-read.csv("sample_finaldata.csv", stringsAsFactors = FALSE)
inside the server.R
. (And also make sure that the file exists in the working directory)
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53315760%2fr-shiny-summary-statistics-and-boxplot%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You should put the data <-read.csv("sample_finaldata.csv", stringsAsFactors = FALSE)
inside the server.R
. (And also make sure that the file exists in the working directory)
add a comment |
You should put the data <-read.csv("sample_finaldata.csv", stringsAsFactors = FALSE)
inside the server.R
. (And also make sure that the file exists in the working directory)
add a comment |
You should put the data <-read.csv("sample_finaldata.csv", stringsAsFactors = FALSE)
inside the server.R
. (And also make sure that the file exists in the working directory)
You should put the data <-read.csv("sample_finaldata.csv", stringsAsFactors = FALSE)
inside the server.R
. (And also make sure that the file exists in the working directory)
answered Nov 15 '18 at 9:11
annhakannhak
1967
1967
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53315760%2fr-shiny-summary-statistics-and-boxplot%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown