大佬教程收集整理的这篇文章主要介绍了如何选择反应表的一列并更改类并解析为日期>,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在从上传的 .csv 执行反应表,我不应该知道内容。应用程序应该执行预测任务,并且至少需要一个日期列,一个整数列是必要的,因为其余的可以解析为因子。我需要一种上传 csv 的方法,选择“日期”列并对其进行解析,选择金额 $ 的整数列,其余为因子。
如果可以将手动输入的列名称动态绑定到反应表 colnames() 会很棒。
@H_429_7@mySerIEs_raw <- reactive({ req(input$filE) ext <- tools::file_ext(input$file$Name) switch(ext,csv = vroom::vroom(input$file$datapath,delim = ","),tsv = vroom::vroom(input$file$datapath,delim = "\t"),valIDate("InvalID file; Please upload a .csv or .tsv file")) df <- as.data.frame(read_csv(input$file$datapath,quoted_na = falSE,trim_ws = TRUE,skip_empty_rows = TRUE)) updateSELEcTinput(session,"SELEct_date",choices = names(df)) # colchoice <- match(input$SELEct_date,names(df)) # df[,colchoice] <- anydate(df[,colchoice]) # Convert Date variable from chr to Date # df$Date <- gsub("[0-9]{2}([0-9]{2})$","\\1",df$DatE) # Convert any remaining character variables to factors df[sapply(df,is.character)] <- lapply(df[sapply(df,is.character)],as.factor) df$Region <- df$Region %>% recode(N.A = "NA") #Remove "-" and replace with "_" as the "-" causes error df$SKU <- gsub('-','_',df$SKU) return(df) })
...
@H_429_7@mainPanel( h2("Data"),br(),# Outputs the dataset conditionalPanel( condition = "!input$date_btn",rHandsontabLeoutput("head"),# conditionalPanel( # condition = "input$build",# shiny::datatabLeoutput("subset_df") # ),# Assigns an ID to the main panel and the length ID = "Main Panel 1",wIDth = 9) )
...
Explainable Picture
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
以上是大佬教程为你收集整理的如何选择反应表的一列并更改类并解析为日期>全部内容,希望文章能够帮你解决如何选择反应表的一列并更改类并解析为日期>所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。