命令行问题 [英] Command line Questions in R
本文介绍了命令行问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在R中建立一个用户输入界面。
I am building an user input interface in R.
程序的加载,我想询问用户他们的偏好是根据一组6个字段。
onload of the program, I would like like to ask the user what their preferences are according to a set of 6 fields. This will then be used as a comparison tool for the rest of the program.
例如
>ThisProgram
>"Hello, on a scale of 1 to 10, how much would you say you rate the outdoors in your trips? Enter a 10 for very important, and a 1 for not important at all.
>7
>"Great. on a scale of 1 to 10, how much would you say you rate the Family Friendly in your trips? Enter a 10 for very important, and a 1 for not important at all.
>2
.
.
.
and so on...
我如何得到R问用户一个问题,然后将响应存储在向量中?
how would I get R to ask the user a question, and then store the response in a vector?
推荐答案
请参阅?readline
> x <- readline("What is your name? ")
What is your name? Josh
> x
[1] "Josh"
这篇关于命令行问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文