Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
これは単純だと確信していますが、私のRはそれに対応していません.Xより低いデータフレームの1つの列のすべての値を0に変更し、XとXよりも大きいすべての値を1に変更するにはどうすればよいですか?
ifelse関数は、まさにあなたが望むことを行います。データフレームが呼び出されd、列が呼び出された場合d$column:
d
d$column
d$column = ifelse(d$column < X, 0, 1)