R中的文件浏览器 [英] File browser in R

查看:61
本文介绍了R中的文件浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要为从未使用过R的人编写一个小的R脚本,然后再导入文件并对其执行某些操作.我想尽可能地减少用户输入,并且由于分配文件路径基本上是我想知道的所有用户输入,因此是否有可能获得一个弹出屏幕(基本上是您通常的打开文件"屏幕),允许某人选择一个文件(将名称导入为R或其他形式的字符串)?

I need to write a small R script for people who never used R before that imports a file and does some things with it. I would like to minimize user input as much as possible, and since assigning the file-path is basically all the user input required I was wondering, is it possible to get a popup screen (basically your usual "open file" screen) allowing someone to select a file (import the name as string in R or something)?

推荐答案

file.choose函数执行此操作,例如:

The file.choose function performs this, eg:

fname <- file.choose()

source(file.choose())

您可能还希望查看choose.files(用于多个文件)和choose.dir(仅用于选择目录路径).

You may also want to look at choose.files (for multiple files) and choose.dir (for just selecting a directory path).

这篇关于R中的文件浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆