gpt4 book ai didi

command-line - R 中的命令行问题

转载 作者:行者123 更新时间:2023-11-30 23:59:47 24 4
gpt4 key购买 nike

我正在用 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 向用户提问,然后将响应存储在向量中?

最佳答案

?readline

> x <- readline("What is your name? ")
What is your name? Josh
> x
[1] "Josh"

关于command-line - R 中的命令行问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3454969/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com