问题描述
我想在我闪亮的应用程序中轻松复制粘贴数据。因此,我通过获取用户输入的行数和列数来创建一个空的 rhandsontable:
ui <- dashboardPage(
dashboardHeader(title = "Basic dashboard"),dashboardSidebar(),dashboardBody(
tabItems(
tabItem(tabName = "UploadTab",Box(title=strong("PASTE DATA"),status = "primary",solidHeader = TRUE,width = 12,"Create Table to Paste Data:",numericInput("rowno","No. of rows(observations):",1),numericInput("columnno","No. of columns(variables):",1)
),div(style="display:inline-block;margin-left:15px",rHandsontableOutput("tabelle",width = "100%"))))))
server <- function(input,output) {
output$tabelle <- renderRHandsontable({
df=matrix("",input$rowno,input$columnno)
d=data.frame(df)
rhandsontable(d,width = "100%",height=300,rowHeaders = FALSE,colHeaders=FALSE,useTypes = FALSE)
})
}
shinyApp(ui,server)
我还将输入值保存到变量中:
uploadedfile<<-hot_to_r(input$tabelle)
print(class(uploadedfile))
print(dim(uploadedfile))
colnames(uploadedfile)<<-uploadedfile[1,]
uploadedfile<<-tail(uploadedfile,-1)
rownames(uploadedfile)<<-1:nrow(uploadedfile)
datatable(uploadedfile,rownames=TRUE,editable=TRUE)
表格被正确创建,数据也被完整保存。但是,无法正确读取尺寸,即 1505(虹膜的实际尺寸)被读取为 1500,因此出现以下错误:
Error in py_call_impl: ValueError: Found array with 0 feature(s) (shape=(150,0)) while a minimum of 1 is required.
我正在使用 reticulate 包将 R 与 python 接口,并使用 python sklearn 执行分析。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)