3 ms·
For the record, the original example is from the homepage of magrittr (I found it here https://www.fromthebottomoftheheap.net/2015/06/03/my-aversion-to-pipes/ h
by kgwgk 7y ago
For the record, the original example is from the homepage of magrittr (I found it here https://www.fromthebottomoftheheap.net/2015/06/03/my-aversion-to-pipes/ https://www.fromthebottomoftheheap.net/2015/06/03/my-aversio...) and I'm not trying to angle towards anywhere. I only wanted to point out that the version with a sequence of assignments is not so painful to read (to me) and even the nested version is readable and has some advantages. Not that anyone cares, but I think I would have written something like:
df <- rbind(read.csv('/path/to/data/file1.csv'),
read.csv('/path/to/data/file2.csv'))
df <- df[, df$variable_a > x]
df$variable_c <- df$variable_a / df$variable_b
or maybe:
df <- subset(rbind(read.csv('/path/to/data/file1.csv'),
read.csv('/path/to/data/file2.csv')),
variable_a > x)
df[,”variable_c”] <- df[,”variable_a”] / df[,”variable_b”]
Whether you think these are badly written pipes or not pipes at all, I don't care. It's good enough for me.