LoginSignup
0
0

More than 5 years have passed since last update.

行列の形を保ったままapply

Posted at

行列の形を保ったまま関数を適応する方法についてのメモ

m <- c(1:9, 3, 3)

structure(sapply(m, sqrt), dim=m))
structure(vapply(m, sqrt, numeric(1)), dim=m))

m[] <- sapply(m, sqrt)
m[] <- vapply(m, sqrt, numeric(1))
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0