Why is the difference in applying map()?

I'm trying to follow this tidymodels - K-means clustering with tidy data principles.
And got a bit confused in:

Why in kclust =, it needs to use ~ and .x? How's this exactly applied? Meanwhile, bellow
in augmented =, it only applies the column name points in map(kclust, augment, points)?

Thank you.

Because in the first case, the mapped variable needs to be used as the second argument for the kmeans() function, so if you need to specify the order you need to use the . x placeholder, whereas in the second case, the mapped variable goes to the first argument so no need to specify the order.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.