R 如何使用闪亮的软件包阅读表格?
我对R真的很陌生,很有光泽 我正在尝试使用闪亮的包读取数据集。 最初在R中,我只使用R 如何使用闪亮的软件包阅读表格?,r,shiny,R,Shiny,我对R真的很陌生,很有光泽 我正在尝试使用闪亮的包读取数据集。 最初在R中,我只使用 data <- read.csv(file.choose(),header=TRUE) T <- data$TEMP X <- data$TSUSC Cs <- data$CSUSC Ns <- data$NSUSC 数据在窗口中,如果要读取对象并在以后(反应性地)使用它,则必须使用反应性()加载。类似这样的
data <- read.csv(file.choose(),header=TRUE)
T <- data$TEMP
X <- data$TSUSC
Cs <- data$CSUSC
Ns <- data$NSUSC
数据在窗口中,如果要读取对象并在以后(反应性地)使用它,则必须使用反应性()加载。类似这样的东西可以帮助您:
server <- function(input, output) {
# load the data and save it as a reactive object
data = reactive({
file = input$file1
if (is.null(file)) {
stop('Wrong input!')
} else {
read.csv(file$datapath, input$file1$datapath,
header = input$header, sep = input$sep,
quote = input$quote)
}
})
# now you can call the loaded data and render it
output$contents <- renderTable({
if(input$disp == 'head') {
return(head(data()))
} else {
return(df)
}
})
}
服务器
data <- read.csv(file.choose(),header=TRUE)
T <- data$TEMP
X <- data$TSUSC
Cs <- data$CSUSC
Ns <- data$NSUSC
server <- function(input, output) {
# load the data and save it as a reactive object
data = reactive({
file = input$file1
if (is.null(file)) {
stop('Wrong input!')
} else {
read.csv(file$datapath, input$file1$datapath,
header = input$header, sep = input$sep,
quote = input$quote)
}
})
# now you can call the loaded data and render it
output$contents <- renderTable({
if(input$disp == 'head') {
return(head(data()))
} else {
return(df)
}
})
}