How to use (i in nums) with foreach in R? -
How can I define something similar to (i) num <) Foreach ? It looks like foreach i = 1: nums , but in my case numbers nums are not sequential.
nums & lt; -c (1,2,5,8) prob & lt; - foreach (i num, .combine = rbind, .packages = "randomForest")% dopar% {# ...}
You do not use these to use foreach () . Try using the named parameter only you
nums < -c (1,2,5,8) prob & lt; Parameter will accept a vector without problem. The 1: n syntax is an easy way to create a vector of elements from 1 to n. But you can pass directly into your vectors.
Comments
Post a Comment