Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this partice proble about describe the coding : could you give me some suggest to improve my work and rewrite one pls To clean

For this partice proble about describe the coding :

could you give me some suggest to improve my work and rewrite one pls

To clean the dataset, I started by removing the missing value of "penguins" and renaming it "data" because we only require a dataset with observations from 2009. I created a new variable called "flipper" and used the ifelse function in the "data_year" dataset to determine whether the length of the flippers mattered. If the data is greater than 200 as 1, and if the data is less than 200 as 0,.

After that, I used the ifelse function to determine whether the penguin's weight is greater than or less than the median body mass of all sampled penguins, with those whose weight is greater than the median body mass being noted as 1, and those whose weight is less than the median body mass being noted as 0.

Then a new variable called "ratio" was established to investigate the relationship between the ratio of bill length to bill depth (length depth) and a variety of variables.I eliminated rows from the dataset by removing row numbers (2 3 8 10 11 12) from the dataset, leaving only the variable we require.

Finally, I use the write.csv method to save my data to a csv file named date_new.

image text in transcribed
{r} data=na. omit (penguins) median_data=median(data$body_mass_g) median_data data_year=data [data$year>=2009, ] data_year $flippers=ifelse(data_year $flipper_length_mm>200, 1, 0) data_year $mass=ifelse(data_year $body_mass_g>median_data, 1, 0) data_year $ratio=data_year$bill_depth_mm/data_year $bill_depth_mm head (data_year ) data_new=data_year [ , c(2, 3, 8,10,11,12) ] write. csv(data_new, file="data_new. csv") A X spec_tbl_of R Console 6 x 12 X1 species island bill_length_mm bill_depth_mm flipper_length_mm body_mass_g sex year cabi> 101 101 Adelie Biscoe 35.0 17.9 192 3725 female 2009 102 102 Adelie Biscoe 41.0 20.0 203 4725 male 2009 103 103 Adelie Biscoe 37.7 16.0 183 3075 female 2009 Biscoe 37.8 20.0 190 4250 male 2009 104 104 Adelie 105 Adelie 37.9 18.6 193 2925 female 2009 105 Biscoe 106 106 Adelie 39.7 18.9 184 3550 male 2009 Biscoe 6 rows / 1-10 of 12 columns

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

Concepts In Discrete Mathematics

Authors: Mofidul Islam

1st Edition

9353146372, 9789353146375

More Books

Students also viewed these Mathematics questions

Question

What additional information would you want to know?

Answered: 1 week ago

Question

Go, do not wait until I come

Answered: 1 week ago

Question

Make eye contact when talking and listening

Answered: 1 week ago