Add tags

Add tags to the following comment
Pythonの便利さがすごい・・・。
自分のコードは文字の長さを使っていたので、strlen相当の関数を使用しないように変更してみました。

ifelseは第1引数の条件がTRUEなら第2引数、FALSEなら第3引数の処理を実行します。
条件にはTRUE/FALSEのリストを渡すこともでき、その長さに応じて後ろの処理のリストはコピーされていきます。
1
2
-   breaks <- sort(rep(1:num, len=length(string)))
+   breaks <- sort(ifelse(string==string, 1:num))

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...