How to extract info from imported data in shiny and use it as textInput?
I want to create an app with R shiny where I load data, display it and then I can make some operations on the data in another tibble/data frame and have the original data displayed in a tab. Additionally I would like to use the data in tibble cells to be used as the value for textInput. Thus far I have come up with this for the UI:
ui <-
dashboardPage(
dashboardHeader(title="NGS library quantification app", titleWidth=500),
dashboardSidebar(
menuItem(text = "Raw Data", tabName = "r_data", icon=icon("clipboard")),
menuItem(text = "User Data", tabName = "u_data", icon=icon("clipboard")),
menuItem(text = "Analysis", tabName = "analysis", icon=icon("cog", lib = "glyphicon")),
menuItem(text = "Summary", tabName = "summary", icon=icon("book")),
collapsed=TRUE),
dashboardBody(
tags$head(
tags$style(HTML(".main-sidebar font-size: 30px; ")) #change the font size to 30
),
tags$script(
HTML(
"
$(document).ready(function()
// Bind classes to menu items, easiet to fill in manually
var ids = ['r_data','u_data','analysis', 'summary'];
for(i=0; i<ids.length; i++)
$('a[data-value='+ids[i]+']').addClass('my_subitem_class');
// Register click handeler
$('.my_subitem_class').on('click',function()
// Unactive menuSubItems
$('.my_subitem_class').parent().removeClass('active');
)
)
"
)
),
tabItems(
#Raw data tab
tabItem(tabName = "r_data", fileInput(inputId = "file", label = "Choose file"), tableOutput("info"), tableOutput("raw_data")),
#user data tab
tabItem(tabName = "u_data",
column(textInput("ID1", "Sample ID", value = ""),
textInput("ID2", "", value = ""),
textInput("ID3", "", value = ""),
textInput("ID4", "", value = ""),
textInput("ID5", "", value = ""),
textInput("ID6", "", value = ""),
textInput("ID7", "", value = ""),
textInput("ID8", "", value = ""),
width=1),
column(numericInput("size1", "library size (bp)", value = NULL, step=1),
numericInput("size2", "", value = NULL, step=1),
numericInput("size3", "", value = NULL, step=1),
numericInput("size4", "", value = NULL, step=1),
numericInput("size5", "", value = NULL, step=1),
numericInput("size6", "", value = NULL, step=1),
numericInput("size7", "", value = NULL, step=1),
numericInput("size8", "", value = NULL, step=1),
width = 2),
column(numericInput("dil1", "First dilution", value = 100000, step=10000),
numericInput("dil2", "", value = 100000, step=10000),
numericInput("dil3", "", value = 100000, step=10000),
numericInput("dil4", "", value = 100000, step=10000),
numericInput("dil5", "", value = 100000, step=10000),
numericInput("dil6", "", value = 100000, step=10000),
numericInput("dil7", "", value = 100000, step=10000),
numericInput("dil8", "", value = 100000, step=10000),
width = 2),
column(numericInput("dil9", "Second dilution", value = 250000, step=10000),
numericInput("dil10", "", value = 250000, step=10000),
numericInput("dil11", "", value = 250000, step=10000),
numericInput("dil12", "", value = 250000, step=10000),
numericInput("dil13", "", value = 250000, step=10000),
numericInput("dil14", "", value = 250000, step=10000),
numericInput("dil15", "", value = 250000, step=10000),
numericInput("dil6", "", value = 250000, step=10000),
width = 2),
column(numericInput("dil17", "Third dilution", value = 500000, step=10000),
numericInput("dil18", "", value = 500000, step=10000),
numericInput("dil19", "", value = 500000, step=10000),
numericInput("dil20", "", value = 500000, step=10000),
numericInput("dil21", "", value = 500000, step=10000),
numericInput("dil22", "", value = 500000, step=10000),
numericInput("dil23", "", value = 500000, step=10000),
numericInput("dil24", "", value = 500000, step=10000),
width = 2),
column(textInput("check1", "Sample Detected?", "YES"),
textInput("check2", "", "YES"),
textInput("check3", "", "YES"),
textInput("check4", "", "YES"),
textInput("check5", "", "YES"),
textInput("check6", "", "YES"),
textInput("check7", "", "YES"),
textInput("check8", "", "YES"),
width = 2)
)
and then for the server:
server <- function(input, output, session)
# Reading data from CFX exported file
data <- reactive(
inFile <- input$file
if(is.null(inFile))
return(NULL)
data <- read_excel(paste(inFile$datapath), sheet=1, skip=18, col_types = c("text", "text", "text",
"text", "numeric", "numeric", "numeric",
"numeric", "numeric"))
)
ID1 <- reactive(data()[12, 2])
updateTextInput(session, "ID1", value = reactive(ID1()))
Those are just snippets that I hope will be helpful with evaluating this problem. The problem is that when I then go back to the user data and look at the sample ID rather than seeing the ID of the sample I see what appears to be the code of the ID1 variable? I have no idea what I am doing wrong. I am new to Shiny and can't really troubleshoot this. you can find the app here
And this is the output in the textInput("ID1", "Sample ID", value = "")
:
structure(function () ,, .dependents$register(), if (.invalidated , observable = <environment>)
but I was expecting the value in the cell. Any help will be greatly appreciated. Thank you everyone
r shiny
add a comment |
I want to create an app with R shiny where I load data, display it and then I can make some operations on the data in another tibble/data frame and have the original data displayed in a tab. Additionally I would like to use the data in tibble cells to be used as the value for textInput. Thus far I have come up with this for the UI:
ui <-
dashboardPage(
dashboardHeader(title="NGS library quantification app", titleWidth=500),
dashboardSidebar(
menuItem(text = "Raw Data", tabName = "r_data", icon=icon("clipboard")),
menuItem(text = "User Data", tabName = "u_data", icon=icon("clipboard")),
menuItem(text = "Analysis", tabName = "analysis", icon=icon("cog", lib = "glyphicon")),
menuItem(text = "Summary", tabName = "summary", icon=icon("book")),
collapsed=TRUE),
dashboardBody(
tags$head(
tags$style(HTML(".main-sidebar font-size: 30px; ")) #change the font size to 30
),
tags$script(
HTML(
"
$(document).ready(function()
// Bind classes to menu items, easiet to fill in manually
var ids = ['r_data','u_data','analysis', 'summary'];
for(i=0; i<ids.length; i++)
$('a[data-value='+ids[i]+']').addClass('my_subitem_class');
// Register click handeler
$('.my_subitem_class').on('click',function()
// Unactive menuSubItems
$('.my_subitem_class').parent().removeClass('active');
)
)
"
)
),
tabItems(
#Raw data tab
tabItem(tabName = "r_data", fileInput(inputId = "file", label = "Choose file"), tableOutput("info"), tableOutput("raw_data")),
#user data tab
tabItem(tabName = "u_data",
column(textInput("ID1", "Sample ID", value = ""),
textInput("ID2", "", value = ""),
textInput("ID3", "", value = ""),
textInput("ID4", "", value = ""),
textInput("ID5", "", value = ""),
textInput("ID6", "", value = ""),
textInput("ID7", "", value = ""),
textInput("ID8", "", value = ""),
width=1),
column(numericInput("size1", "library size (bp)", value = NULL, step=1),
numericInput("size2", "", value = NULL, step=1),
numericInput("size3", "", value = NULL, step=1),
numericInput("size4", "", value = NULL, step=1),
numericInput("size5", "", value = NULL, step=1),
numericInput("size6", "", value = NULL, step=1),
numericInput("size7", "", value = NULL, step=1),
numericInput("size8", "", value = NULL, step=1),
width = 2),
column(numericInput("dil1", "First dilution", value = 100000, step=10000),
numericInput("dil2", "", value = 100000, step=10000),
numericInput("dil3", "", value = 100000, step=10000),
numericInput("dil4", "", value = 100000, step=10000),
numericInput("dil5", "", value = 100000, step=10000),
numericInput("dil6", "", value = 100000, step=10000),
numericInput("dil7", "", value = 100000, step=10000),
numericInput("dil8", "", value = 100000, step=10000),
width = 2),
column(numericInput("dil9", "Second dilution", value = 250000, step=10000),
numericInput("dil10", "", value = 250000, step=10000),
numericInput("dil11", "", value = 250000, step=10000),
numericInput("dil12", "", value = 250000, step=10000),
numericInput("dil13", "", value = 250000, step=10000),
numericInput("dil14", "", value = 250000, step=10000),
numericInput("dil15", "", value = 250000, step=10000),
numericInput("dil6", "", value = 250000, step=10000),
width = 2),
column(numericInput("dil17", "Third dilution", value = 500000, step=10000),
numericInput("dil18", "", value = 500000, step=10000),
numericInput("dil19", "", value = 500000, step=10000),
numericInput("dil20", "", value = 500000, step=10000),
numericInput("dil21", "", value = 500000, step=10000),
numericInput("dil22", "", value = 500000, step=10000),
numericInput("dil23", "", value = 500000, step=10000),
numericInput("dil24", "", value = 500000, step=10000),
width = 2),
column(textInput("check1", "Sample Detected?", "YES"),
textInput("check2", "", "YES"),
textInput("check3", "", "YES"),
textInput("check4", "", "YES"),
textInput("check5", "", "YES"),
textInput("check6", "", "YES"),
textInput("check7", "", "YES"),
textInput("check8", "", "YES"),
width = 2)
)
and then for the server:
server <- function(input, output, session)
# Reading data from CFX exported file
data <- reactive(
inFile <- input$file
if(is.null(inFile))
return(NULL)
data <- read_excel(paste(inFile$datapath), sheet=1, skip=18, col_types = c("text", "text", "text",
"text", "numeric", "numeric", "numeric",
"numeric", "numeric"))
)
ID1 <- reactive(data()[12, 2])
updateTextInput(session, "ID1", value = reactive(ID1()))
Those are just snippets that I hope will be helpful with evaluating this problem. The problem is that when I then go back to the user data and look at the sample ID rather than seeing the ID of the sample I see what appears to be the code of the ID1 variable? I have no idea what I am doing wrong. I am new to Shiny and can't really troubleshoot this. you can find the app here
And this is the output in the textInput("ID1", "Sample ID", value = "")
:
structure(function () ,, .dependents$register(), if (.invalidated , observable = <environment>)
but I was expecting the value in the cell. Any help will be greatly appreciated. Thank you everyone
r shiny
add a comment |
I want to create an app with R shiny where I load data, display it and then I can make some operations on the data in another tibble/data frame and have the original data displayed in a tab. Additionally I would like to use the data in tibble cells to be used as the value for textInput. Thus far I have come up with this for the UI:
ui <-
dashboardPage(
dashboardHeader(title="NGS library quantification app", titleWidth=500),
dashboardSidebar(
menuItem(text = "Raw Data", tabName = "r_data", icon=icon("clipboard")),
menuItem(text = "User Data", tabName = "u_data", icon=icon("clipboard")),
menuItem(text = "Analysis", tabName = "analysis", icon=icon("cog", lib = "glyphicon")),
menuItem(text = "Summary", tabName = "summary", icon=icon("book")),
collapsed=TRUE),
dashboardBody(
tags$head(
tags$style(HTML(".main-sidebar font-size: 30px; ")) #change the font size to 30
),
tags$script(
HTML(
"
$(document).ready(function()
// Bind classes to menu items, easiet to fill in manually
var ids = ['r_data','u_data','analysis', 'summary'];
for(i=0; i<ids.length; i++)
$('a[data-value='+ids[i]+']').addClass('my_subitem_class');
// Register click handeler
$('.my_subitem_class').on('click',function()
// Unactive menuSubItems
$('.my_subitem_class').parent().removeClass('active');
)
)
"
)
),
tabItems(
#Raw data tab
tabItem(tabName = "r_data", fileInput(inputId = "file", label = "Choose file"), tableOutput("info"), tableOutput("raw_data")),
#user data tab
tabItem(tabName = "u_data",
column(textInput("ID1", "Sample ID", value = ""),
textInput("ID2", "", value = ""),
textInput("ID3", "", value = ""),
textInput("ID4", "", value = ""),
textInput("ID5", "", value = ""),
textInput("ID6", "", value = ""),
textInput("ID7", "", value = ""),
textInput("ID8", "", value = ""),
width=1),
column(numericInput("size1", "library size (bp)", value = NULL, step=1),
numericInput("size2", "", value = NULL, step=1),
numericInput("size3", "", value = NULL, step=1),
numericInput("size4", "", value = NULL, step=1),
numericInput("size5", "", value = NULL, step=1),
numericInput("size6", "", value = NULL, step=1),
numericInput("size7", "", value = NULL, step=1),
numericInput("size8", "", value = NULL, step=1),
width = 2),
column(numericInput("dil1", "First dilution", value = 100000, step=10000),
numericInput("dil2", "", value = 100000, step=10000),
numericInput("dil3", "", value = 100000, step=10000),
numericInput("dil4", "", value = 100000, step=10000),
numericInput("dil5", "", value = 100000, step=10000),
numericInput("dil6", "", value = 100000, step=10000),
numericInput("dil7", "", value = 100000, step=10000),
numericInput("dil8", "", value = 100000, step=10000),
width = 2),
column(numericInput("dil9", "Second dilution", value = 250000, step=10000),
numericInput("dil10", "", value = 250000, step=10000),
numericInput("dil11", "", value = 250000, step=10000),
numericInput("dil12", "", value = 250000, step=10000),
numericInput("dil13", "", value = 250000, step=10000),
numericInput("dil14", "", value = 250000, step=10000),
numericInput("dil15", "", value = 250000, step=10000),
numericInput("dil6", "", value = 250000, step=10000),
width = 2),
column(numericInput("dil17", "Third dilution", value = 500000, step=10000),
numericInput("dil18", "", value = 500000, step=10000),
numericInput("dil19", "", value = 500000, step=10000),
numericInput("dil20", "", value = 500000, step=10000),
numericInput("dil21", "", value = 500000, step=10000),
numericInput("dil22", "", value = 500000, step=10000),
numericInput("dil23", "", value = 500000, step=10000),
numericInput("dil24", "", value = 500000, step=10000),
width = 2),
column(textInput("check1", "Sample Detected?", "YES"),
textInput("check2", "", "YES"),
textInput("check3", "", "YES"),
textInput("check4", "", "YES"),
textInput("check5", "", "YES"),
textInput("check6", "", "YES"),
textInput("check7", "", "YES"),
textInput("check8", "", "YES"),
width = 2)
)
and then for the server:
server <- function(input, output, session)
# Reading data from CFX exported file
data <- reactive(
inFile <- input$file
if(is.null(inFile))
return(NULL)
data <- read_excel(paste(inFile$datapath), sheet=1, skip=18, col_types = c("text", "text", "text",
"text", "numeric", "numeric", "numeric",
"numeric", "numeric"))
)
ID1 <- reactive(data()[12, 2])
updateTextInput(session, "ID1", value = reactive(ID1()))
Those are just snippets that I hope will be helpful with evaluating this problem. The problem is that when I then go back to the user data and look at the sample ID rather than seeing the ID of the sample I see what appears to be the code of the ID1 variable? I have no idea what I am doing wrong. I am new to Shiny and can't really troubleshoot this. you can find the app here
And this is the output in the textInput("ID1", "Sample ID", value = "")
:
structure(function () ,, .dependents$register(), if (.invalidated , observable = <environment>)
but I was expecting the value in the cell. Any help will be greatly appreciated. Thank you everyone
r shiny
I want to create an app with R shiny where I load data, display it and then I can make some operations on the data in another tibble/data frame and have the original data displayed in a tab. Additionally I would like to use the data in tibble cells to be used as the value for textInput. Thus far I have come up with this for the UI:
ui <-
dashboardPage(
dashboardHeader(title="NGS library quantification app", titleWidth=500),
dashboardSidebar(
menuItem(text = "Raw Data", tabName = "r_data", icon=icon("clipboard")),
menuItem(text = "User Data", tabName = "u_data", icon=icon("clipboard")),
menuItem(text = "Analysis", tabName = "analysis", icon=icon("cog", lib = "glyphicon")),
menuItem(text = "Summary", tabName = "summary", icon=icon("book")),
collapsed=TRUE),
dashboardBody(
tags$head(
tags$style(HTML(".main-sidebar font-size: 30px; ")) #change the font size to 30
),
tags$script(
HTML(
"
$(document).ready(function()
// Bind classes to menu items, easiet to fill in manually
var ids = ['r_data','u_data','analysis', 'summary'];
for(i=0; i<ids.length; i++)
$('a[data-value='+ids[i]+']').addClass('my_subitem_class');
// Register click handeler
$('.my_subitem_class').on('click',function()
// Unactive menuSubItems
$('.my_subitem_class').parent().removeClass('active');
)
)
"
)
),
tabItems(
#Raw data tab
tabItem(tabName = "r_data", fileInput(inputId = "file", label = "Choose file"), tableOutput("info"), tableOutput("raw_data")),
#user data tab
tabItem(tabName = "u_data",
column(textInput("ID1", "Sample ID", value = ""),
textInput("ID2", "", value = ""),
textInput("ID3", "", value = ""),
textInput("ID4", "", value = ""),
textInput("ID5", "", value = ""),
textInput("ID6", "", value = ""),
textInput("ID7", "", value = ""),
textInput("ID8", "", value = ""),
width=1),
column(numericInput("size1", "library size (bp)", value = NULL, step=1),
numericInput("size2", "", value = NULL, step=1),
numericInput("size3", "", value = NULL, step=1),
numericInput("size4", "", value = NULL, step=1),
numericInput("size5", "", value = NULL, step=1),
numericInput("size6", "", value = NULL, step=1),
numericInput("size7", "", value = NULL, step=1),
numericInput("size8", "", value = NULL, step=1),
width = 2),
column(numericInput("dil1", "First dilution", value = 100000, step=10000),
numericInput("dil2", "", value = 100000, step=10000),
numericInput("dil3", "", value = 100000, step=10000),
numericInput("dil4", "", value = 100000, step=10000),
numericInput("dil5", "", value = 100000, step=10000),
numericInput("dil6", "", value = 100000, step=10000),
numericInput("dil7", "", value = 100000, step=10000),
numericInput("dil8", "", value = 100000, step=10000),
width = 2),
column(numericInput("dil9", "Second dilution", value = 250000, step=10000),
numericInput("dil10", "", value = 250000, step=10000),
numericInput("dil11", "", value = 250000, step=10000),
numericInput("dil12", "", value = 250000, step=10000),
numericInput("dil13", "", value = 250000, step=10000),
numericInput("dil14", "", value = 250000, step=10000),
numericInput("dil15", "", value = 250000, step=10000),
numericInput("dil6", "", value = 250000, step=10000),
width = 2),
column(numericInput("dil17", "Third dilution", value = 500000, step=10000),
numericInput("dil18", "", value = 500000, step=10000),
numericInput("dil19", "", value = 500000, step=10000),
numericInput("dil20", "", value = 500000, step=10000),
numericInput("dil21", "", value = 500000, step=10000),
numericInput("dil22", "", value = 500000, step=10000),
numericInput("dil23", "", value = 500000, step=10000),
numericInput("dil24", "", value = 500000, step=10000),
width = 2),
column(textInput("check1", "Sample Detected?", "YES"),
textInput("check2", "", "YES"),
textInput("check3", "", "YES"),
textInput("check4", "", "YES"),
textInput("check5", "", "YES"),
textInput("check6", "", "YES"),
textInput("check7", "", "YES"),
textInput("check8", "", "YES"),
width = 2)
)
and then for the server:
server <- function(input, output, session)
# Reading data from CFX exported file
data <- reactive(
inFile <- input$file
if(is.null(inFile))
return(NULL)
data <- read_excel(paste(inFile$datapath), sheet=1, skip=18, col_types = c("text", "text", "text",
"text", "numeric", "numeric", "numeric",
"numeric", "numeric"))
)
ID1 <- reactive(data()[12, 2])
updateTextInput(session, "ID1", value = reactive(ID1()))
Those are just snippets that I hope will be helpful with evaluating this problem. The problem is that when I then go back to the user data and look at the sample ID rather than seeing the ID of the sample I see what appears to be the code of the ID1 variable? I have no idea what I am doing wrong. I am new to Shiny and can't really troubleshoot this. you can find the app here
And this is the output in the textInput("ID1", "Sample ID", value = "")
:
structure(function () ,, .dependents$register(), if (.invalidated , observable = <environment>)
but I was expecting the value in the cell. Any help will be greatly appreciated. Thank you everyone
r shiny
r shiny
edited Nov 11 '18 at 0:10
Antonino
1,53921327
1,53921327
asked Nov 10 '18 at 22:57
Dawid WalasDawid Walas
32
32
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
There are a few changes you need to make:
- Put your
updateTextInput
inside an observer. This is because you need to read from a reactive expression, andobserve
does that. - You need to parse
ID1()
usingas.character
before being able to display it in your app.
Change your server
to the following:
server <- function(input, output, session)
# Reading data from CFX exported file
data <- reactive(
inFile <- input$file
if(is.null(inFile))
return(NULL)
data <- readxl::read_excel(paste(inFile$datapath), sheet=1, skip=18,
col_types = c("text", "text", "text","text", "numeric",
"numeric", "numeric","numeric", "numeric"))
)
ID1 <- reactive(data()[12, 2])
observe(
updateTextInput(session, "ID1", value = as.character(ID1()))
)
Hi Vishesh Shrivastav, Thank you very much. That solved the problem. Best wishes Dawid
– Dawid Walas
Nov 11 '18 at 9:00
Glad that it helped. Please mark the answer as correct.
– Vishesh Shrivastav
Nov 11 '18 at 16:15
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%2f53244238%2fhow-to-extract-info-from-imported-data-in-shiny-and-use-it-as-textinput%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
There are a few changes you need to make:
- Put your
updateTextInput
inside an observer. This is because you need to read from a reactive expression, andobserve
does that. - You need to parse
ID1()
usingas.character
before being able to display it in your app.
Change your server
to the following:
server <- function(input, output, session)
# Reading data from CFX exported file
data <- reactive(
inFile <- input$file
if(is.null(inFile))
return(NULL)
data <- readxl::read_excel(paste(inFile$datapath), sheet=1, skip=18,
col_types = c("text", "text", "text","text", "numeric",
"numeric", "numeric","numeric", "numeric"))
)
ID1 <- reactive(data()[12, 2])
observe(
updateTextInput(session, "ID1", value = as.character(ID1()))
)
Hi Vishesh Shrivastav, Thank you very much. That solved the problem. Best wishes Dawid
– Dawid Walas
Nov 11 '18 at 9:00
Glad that it helped. Please mark the answer as correct.
– Vishesh Shrivastav
Nov 11 '18 at 16:15
add a comment |
There are a few changes you need to make:
- Put your
updateTextInput
inside an observer. This is because you need to read from a reactive expression, andobserve
does that. - You need to parse
ID1()
usingas.character
before being able to display it in your app.
Change your server
to the following:
server <- function(input, output, session)
# Reading data from CFX exported file
data <- reactive(
inFile <- input$file
if(is.null(inFile))
return(NULL)
data <- readxl::read_excel(paste(inFile$datapath), sheet=1, skip=18,
col_types = c("text", "text", "text","text", "numeric",
"numeric", "numeric","numeric", "numeric"))
)
ID1 <- reactive(data()[12, 2])
observe(
updateTextInput(session, "ID1", value = as.character(ID1()))
)
Hi Vishesh Shrivastav, Thank you very much. That solved the problem. Best wishes Dawid
– Dawid Walas
Nov 11 '18 at 9:00
Glad that it helped. Please mark the answer as correct.
– Vishesh Shrivastav
Nov 11 '18 at 16:15
add a comment |
There are a few changes you need to make:
- Put your
updateTextInput
inside an observer. This is because you need to read from a reactive expression, andobserve
does that. - You need to parse
ID1()
usingas.character
before being able to display it in your app.
Change your server
to the following:
server <- function(input, output, session)
# Reading data from CFX exported file
data <- reactive(
inFile <- input$file
if(is.null(inFile))
return(NULL)
data <- readxl::read_excel(paste(inFile$datapath), sheet=1, skip=18,
col_types = c("text", "text", "text","text", "numeric",
"numeric", "numeric","numeric", "numeric"))
)
ID1 <- reactive(data()[12, 2])
observe(
updateTextInput(session, "ID1", value = as.character(ID1()))
)
There are a few changes you need to make:
- Put your
updateTextInput
inside an observer. This is because you need to read from a reactive expression, andobserve
does that. - You need to parse
ID1()
usingas.character
before being able to display it in your app.
Change your server
to the following:
server <- function(input, output, session)
# Reading data from CFX exported file
data <- reactive(
inFile <- input$file
if(is.null(inFile))
return(NULL)
data <- readxl::read_excel(paste(inFile$datapath), sheet=1, skip=18,
col_types = c("text", "text", "text","text", "numeric",
"numeric", "numeric","numeric", "numeric"))
)
ID1 <- reactive(data()[12, 2])
observe(
updateTextInput(session, "ID1", value = as.character(ID1()))
)
answered Nov 11 '18 at 1:04
Vishesh ShrivastavVishesh Shrivastav
1,0612622
1,0612622
Hi Vishesh Shrivastav, Thank you very much. That solved the problem. Best wishes Dawid
– Dawid Walas
Nov 11 '18 at 9:00
Glad that it helped. Please mark the answer as correct.
– Vishesh Shrivastav
Nov 11 '18 at 16:15
add a comment |
Hi Vishesh Shrivastav, Thank you very much. That solved the problem. Best wishes Dawid
– Dawid Walas
Nov 11 '18 at 9:00
Glad that it helped. Please mark the answer as correct.
– Vishesh Shrivastav
Nov 11 '18 at 16:15
Hi Vishesh Shrivastav, Thank you very much. That solved the problem. Best wishes Dawid
– Dawid Walas
Nov 11 '18 at 9:00
Hi Vishesh Shrivastav, Thank you very much. That solved the problem. Best wishes Dawid
– Dawid Walas
Nov 11 '18 at 9:00
Glad that it helped. Please mark the answer as correct.
– Vishesh Shrivastav
Nov 11 '18 at 16:15
Glad that it helped. Please mark the answer as correct.
– Vishesh Shrivastav
Nov 11 '18 at 16:15
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%2f53244238%2fhow-to-extract-info-from-imported-data-in-shiny-and-use-it-as-textinput%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