私は新しい R ユーザーであり、readline() を使用してユーザーにデータを要求する関数の作成に取り組んでいます。後で関数の式で答えを使用したいと思います。
「w/m のエラー: 二項演算子への数値以外の引数」というエラーが表示されます
ユーザーからの入力が文字クラスであることがわかりました。これを数値に変換して、(w) 式を実行できるようにします。
私のコードは次のようになります...
lands<-function(w, g, r, b, u, l, au, mc, uw, gw, wr, bw, gr, gb, ug, rb, ur, ub){
l<-readline("How many lands are you playing?")
au<-readline("How many of these lands can be tapped for more than or less than 2 colors of mana? note: omit fetch lands that get two different types of land, but include fetch lands that can get any basic.")
mc<-readline("Count the number of mana symbols on your cards an input the number. Be sure to include flash back costs that differ from regular mana costs, hybrid mana should be split (add 1 for odd numbers).")
w<-readline("How many mana symbols are white?")
wh<-(((w/mc)*(l-au))) ##-((uw+gw+wr+bw)/2))
}