Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Cost Accounting A Managerial Emphasis

Authors: Charles T. Horngren, Srikant M.Dater, George Foster, Madhav

13th Edition

8120335643, 136126634, 978-0136126638

Students also viewed these Mathematics questions