简体   繁体   English

如何将 CSV 文件上传到 R/shiny 并根据列标题自动填充选择器

[英]How to upload a CSV file into R/shiny and automatically populate selectors based on column headers

I want to upload a csv file from a \data folder inside the R project.我想从 R 项目中的 \data 文件夹上传 csv 文件。

So far I've been reading questions, but most answers seemed a bit too fancy, with user interaction when selecting a data file.到目前为止,我一直在阅读问题,但大多数答案似乎有点过于花哨,在选择数据文件时需要用户交互。 I simply want R Shiny to read a data file (just the one) without any user interaction.我只是希望 R Shiny 无需任何用户交互即可读取数据文件(仅此一个)。

I have the standard files ui.R and server.R I place them in a working directory.我有标准文件 ui.R 和 server.R 我将它们放在工作目录中。

I have a csv file with data which I place in a subdirectory called 'data'我有一个 csv 文件,其中包含我放置在名为“数据”的子目录中的数据

I might be missing something, but this should work right?我可能会遗漏一些东西,但这应该可以正常工作吗?

df = rio::import("./data/my_filename.csv")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM