0
ユーザプロンプトから整数を読み込もうとしています。しかし、それは文字として読んでいる。どのように整数として読む?この機能を実行するRでは、ユーザープロンプトから整数を読み取る方法は?
myfunt <- function(){
cat("Enter an integer or whole number : \n")
enter <- readline(prompt = "")
cat("You sumitted : \n"); str(enter)
}
は生成します myfunt()
Enter an integer or whole number:
17
You sumitted :
chr "17"
任意のソリューションを?
()
とあなたの関数を実行している... myfunt()as.integerを使用しています。私は... as.integer()と問題が解決したと思います。ありがとう。 –
私はちょうどそれを考えなかった。しかし、確かに、次回は自分で試してみます。 –