4

Rでユーザー入力インターフェースを構築しています。

プログラムのオンロードで、6 つのフィールドのセットに従ってユーザーの好みを尋ねたいと思います。これは、プログラムの残りの部分の比較ツールとして使用されます。

例えば、

>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 をユーザーに質問させ、その応答をベクトルに格納するにはどうすればよいでしょうか?

4

1 に答える 1

5

見る?readline

> x <- readline("What is your name? ")
What is your name? Josh
> x
[1] "Josh"
于 2010-08-11T03:16:44.830 に答える