Question: R coding. Hello! how can I specify in my R code that I just want 1 decimal place? This is the code I used in

R coding.

Hello! how can I specify in my R code that I just want 1 decimal place?

This is the code I used in R to create the data frame to which I need to round my results:

d3 <- d2 %>% select(conm, sale, oibdp, xrd) %>% filter(conm == "APPLE INC" | conm == "META PLATFORMS INC" | conm == "TESLA INC") as.data.frame(summarize(group_by(d3, conm), sale_mean = mean(sale), oibdp_mean = mean(oibdp), xrd_mean = mean(xrd)))

This are the instructions to the question:

Q3. Round all the numeric variables in the above data frame to 1 decimal place. Output as a data frame using as.data.frame() function. For rounding, you will have to use mutate, across, and where functions from dplyr package.

Thank you!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!