この質問は繰り返されている可能性があります。しかし、以前のリンクを経ても、私はこれを解決することができません。formatDistData()、距離は数値である必要があります
コード
yDat <- formatDistData(Detects1, distCol="distance", transectNameCol="transect", dist.breaks=db)
を実行しているとき、私は、しかし、マークされていないパッケージからformatDistData()関数を使用しようとしていますが、私は"The distances must be numeric"
を言って、エラーを取得します。私はすでにas.numeric()関数を実行していますが、コードは同じエラーを表示します。
私のデータは次のようになります。私はある列にトランセクト、もう一方の列にトランセクトを持っています。右側では、距離がnum値でtransectがchrであることがわかります。誰かが私はそれを動作させるために何をする必要があるかを私に伝えることができる場合にはそれは素晴らしいことだ
transect,distance
NT1,14
NT1,14
NT1,20
NT1,20
NT1,10
NT1,15
> dput(Detects1)`
structure(list(transect = c("NT1", "NT1", "NT1", "NT1", "NT1",
"NT1", "NT1", "NT1", "NT1", "NT1", "NT2", "NT2", "NT2", "NT2",
"NT2", "NT2", "NT2", "NT2", "NT2", "NT2", "NT2", "NT2", "NT3",
"NT3", "NT3", "NT3", "NT3", "NT3", "NT3", "NT3", "NT3", "NT3",
"NT3", "NT3", "NT3", "NT3", "NT3", "NT3", "NT4", "NT3", "NT4",
"NT4", "NT4", "NT5", "NT5", "NT5", "NT5", "NT5", "SCC1", "SCC1",
"SCC1", "SCC1", "SCC1", "SCC1", "SCC1", "SCC1", "SCC3", "SCC3",
"SCC4", "SCC4", "SCC4", "SCC4", "SCC4", "SCC5", "SCC5", "SCC5",
"SCC5", "SCC5", "SCC5", "SCC5", "Urban1", "Urban1", "Urban1",
"Urban2", "Urban2", "Urban2", "Urban2", "Urban2", "Urban2", "Urban2",
"Urban4", "Urban4"), distance = c(14, 14, 20, 20, 10, 15, 5,
10, 15, 6, 10, 5, 5, 40, 7, 7, 5, 5, 12, 12, 2, 2, 5, 16, 6,
13, 3, 7, 5, 2, 0, 16, 10, 20, 20, 15, 10, 11, 17, 17, 12, 5,
3, 5, 8, 21, 12, 12, 15, 15, 7, 12, 3, 5, 6, 3, 2, 7, 8, 21,
5, 5, 11, 4, 12, 2, 1, 2, 5, 14, 10, 8, 3, 3, 11, 4, 9, 3, 7,
5, 2, 7)), .Names = c("transect", "distance"), row.names = c(NA,
-82L), spec = structure(list(cols = structure(list(transect =
structure(list(), class = c("collector_character",
"collector")), distance = structure(list(), class = c("collector_number",
"collector"))), .Names = c("transect", "distance")), default =
structure(list(), class = c("collector_guess",
"collector"))), .Names = c("cols", "default"), class = "col_spec"), class =
c("tbl_df", "tbl", "data.frame"))
データの簡単な例を貼り付けやすい形式で入力してください。 –
問題を再現できるようにすると役に立ちます:https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example –
@RomanLuštrik大丈夫ですか? – Jamie