Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to set specified number of decimal places in across function #153

Closed
antonio-yu opened this issue Nov 16, 2022 · 2 comments
Closed

how to set specified number of decimal places in across function #153

antonio-yu opened this issue Nov 16, 2022 · 2 comments
Labels
question Further information is requested

Comments

@antonio-yu
Copy link

Sometimes I wanna set all the float columns to 2 decimal places , 3.2154 --3.22
any params could be set in the round function?

In the examples of across, it seems to keep zero decimals places

iris >> mutate(across(where(is_double) & ~c(f.Petal_Length, f.Petal_Width), round))

@pwwang pwwang added the question Further information is requested label Nov 16, 2022
@pwwang
Copy link
Owner

pwwang commented Nov 16, 2022

Try:

iris >> mutate(across(where(is_double) & ~c(f.Petal_Length, f.Petal_Width), round, 2))

@antonio-yu
Copy link
Author

Try:

iris >> mutate(across(where(is_double) & ~c(f.Petal_Length, f.Petal_Width), round, 2))

perfect, thanks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants