You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am unsure if this should be two separate bug reports, if this is a single issue with a common source, or if I am simply using it wrong.
library(plyr)
ir <- iris[1:2,]
adply(ir,1,function (x) data.frame(a=1),.id='row')
The expectation is that this snippet will run my function on each of the two rows in the ir data frame, rbind the results, and add an id column containing the margin index. Thus, the output I was expecting based on the documentation was:
a row
1 1 1
2 1 2
However, the output obtained is:
Sepal.Length Sepal.Width Petal.Length Petal.Width Species a
1 5.1 3.5 1.4 0.2 setosa 1
2 4.9 3.0 1.4 0.2 setosa 1
Thus, (1) the .id argument seems to be ignored, and (2) adply seems to silently prepend the original columns to the output data frame, which I do not want. Both of these points seem to go against the documentation?
R 3.6.0, plyr 1.8.4, running on 64-bit Windows 10.
The text was updated successfully, but these errors were encountered:
I am unsure if this should be two separate bug reports, if this is a single issue with a common source, or if I am simply using it wrong.
The expectation is that this snippet will run my function on each of the two rows in the
ir
data frame,rbind
the results, and add anid
column containing the margin index. Thus, the output I was expecting based on the documentation was:However, the output obtained is:
Thus, (1) the
.id
argument seems to be ignored, and (2)adply
seems to silently prepend the original columns to the output data frame, which I do not want. Both of these points seem to go against the documentation?R 3.6.0, plyr 1.8.4, running on 64-bit Windows 10.
The text was updated successfully, but these errors were encountered: