using mutate_at convert from scientific notation to regular notation in r in r

You can use the mutate_at function from the dplyr package in R to convert columns from scientific notation to regular notation. One way to achieve this is by using the format function within mutate_at.

Here's an example demonstrating how to use mutate_at to convert columns from scientific notation to regular notation:

# Load the required library
library(dplyr)

# Example dataset
df <- data.frame(x = c(1e5, 2e6, 3e7),
                 y = c(4e8, 5e9, 6e10))

# Convert columns from scientific notation to regular notation
df <- df %>% 
  mutate_at(vars(x, y), ~format(., scientific = FALSE))

# View the modified dataset
print(df)
314 chars
14 lines

In this example, the columns x and y from the df data frame are converted from scientific notation to regular notation using mutate_at and format functions.

Make sure to adjust the column names and dataset according to your specific requirements.

related categories

gistlibby LogSnag