From sapply to vapply
Bu egzersiz
Intermediate R
kursunun bir parçasıdırEgzersiz talimatları
Convert all the sapply() expressions on the right to their vapply() counterparts. Their results should be exactly the same; you're only adding robustness. You'll need the templates numeric(1) and logical(1).
Uygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
# temp is already defined in the workspace
# Convert to vapply() expression
sapply(temp, max)
# Convert to vapply() expression
sapply(temp, function(x, y) { mean(x) > y }, y = 5)