Top "Apply" questions

A function to call another function with a list of arguments.

Apply a function to all the elements of a data frame

I am trying to apply some transformations to all the elements in a dataframe. When using the regular apply functions, …

r dataframe apply
Row-wise iteration like apply with purrr

How do I achieve row-wise iteration using purrr::map? Here's how I'd do it with a standard row-wise apply. df &…

r apply purrr
Puppet 2.7: Calling puppet apply init.pp does nothing - why?

Directory and file layout as follows: app_test/ app_test/manifests app_test/manifests/init.pp app_test/manifests/test.…

manifest apply puppet
Calculate row-wise proportions

I have a data frame: x <- data.frame(id = letters[1:3], val0 = 1:3, val1 = 4:6, val2 = 7:9) # id val0 val1 val2 # 1 a 1 4 7 # 2 …

r dataframe apply
Extract second subelement of every element in a list while ignoring NA's in sapply in R

I'm trying to extract the second subelement of every element in a list while ignoring NAs in R. Here's a …

r list apply na sapply
what's the difference between 'call/apply' and 'bind'

var obj = { x: 81, getX: function() { console.log( this.x) } }; var getX = obj.getX.bind(obj);//use obj as 'this'; getX();//81 …

javascript function call bind apply
Difference between using a spread syntax (...) and push.apply, when dealing with arrays

I have two arrays, const pets = ["dog", "cat", "hamster"] const wishlist = ["bird", "snake"] I want to append wishlist to pets, …

javascript arrays ecmascript-6 apply spread-syntax
How do I count the number of words in a text (string)?

I have this string vector (for example): str <- c("this is a string current trey", "feather rtttt", "tusla", "…

regex r apply sapply
Last Observation Carried Forward In a data frame?

I wish to implement a "Last Observation Carried Forward" for a data set I am working on which has missing …

r matrix apply dataframe
Faster way to read fixed-width files

I work with a lot of fixed width files (i.e., no separating character) that I need to read into …

r substring data.table apply lapply