homework4-AX04*•C65) L** - o(Alt+Q) ADS OF 2 - 07 檔案 常用 插入 興誠 設計 M 版面配置 參考資料 郵件 AQUA 檢機說明 ①受保護的標視小心,这日於網際網路的倫茲可能有濃時,趁非何需

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

homework4-AX04*•C65) L** - o(Alt+Q) ADS OF 2 - 07 檔案 常用 插入 興誠 設計 M 版面配置 參考資料 郵件 AQUA 檢機說明 ①受保護的標視小心,这日於網際網路的倫茲可能有濃時,趁非何需

Post by answerhappygod »

 1
1 (122.64 KiB) Viewed 35 times
homework4-AX04*•C65) L** - o(Alt+Q) ADS OF 2 - 07 檔案 常用 插入 興誠 設計 M 版面配置 參考資料 郵件 AQUA 檢機說明 ①受保護的標視小心,这日於網際網路的倫茲可能有濃時,趁非何需要通稱,否則傳留在[受保護的檢視] 中較為安全・ AND 0. Initial work: a. Download homework4.Rmd notebook and employee.csv files from the course website to your working directory, b. Start the R Studio+ c. Open homework4.Rmd file into R. d. Set the folder that has the file as the working directory (wd) Click on Session --> Set Working Directory --> Choose Directory.... and select the folder where you saved the downloaded file(s) and click on OK. You can check your working directory by executing the following code: getwd()+ 1. Create a vector namned country with the following 7 elements:/ USA, USA, USA, USA, France, Italy, Zambia. (Consider these values as the countries of /people)< 2. Use class(country) to see the data type in this vector. What is the data type? 3. Create a logical vector citizen to indicate if the individual is a USA citizen based on the countries included in the vector country. (Hint: The first four elements of citizen vector will be TRUE, TRUE, TRUE, TRUE). You need to write the R code to assign the logical values using the country information. Writing a code as given below is not acceptable. citizen <-c(TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) 4. Display the vector citizen to see if the entries are correct. (Hint: The first four entries must be TRUE, TRUE, TRUE, TRUE) 5. Use class(citizen) to see the data type in this vector. What is the data type? 6. Create a data frame (called df) containing two columns: country and citizen 7. Create a 3x3 matrix (call it mtr), enter the values as shown below, and display the matrix to see if the values are entered correctly. 20 19 30 14 2€ 8 4€ Se READ DATA and DISPLAY (SELECT) SUBSET OF DATA 8. Read the dataset employee.csv in the R workspace 9. Write the code to display the following rows/columns in the employee object (a) Data in the first 6 rowse 第1頁,共3 頁 1040 個字 文字预测:同配 8 刀在這裡輸入文字來搜尋 登入 01 28°C Z ^ ca 0 x 註解 v 台共用 后英 E -+ 100% E TF0437 2022/6/3
白热储存(OH)日 檔案 常用 插入 X T BE 9160 homework4 EGEU LEN - 參考資料: 郵件 Calibri (53) 12 A A Aa A A A + BIU x, x² ADA A Iv 21 第2頁,共3间 2. #3 1040* B #X(X) 吸 H ◇在這裡輸入文字來搜尋 25 板钢格式 o = 黑 o(Alt+Q) 3$1 檢機 說明 AE- E• 5• ==Ã Â↓ E AaBbCcDd AaBbCcDd AaB AaB AaBbc AaBBC AaBbC 文 #1 - THE 3 B take 9935 板式 column? e 11. If data type is already factor, then skip the next two questions and go to question 11. If the type of the gender column is not factor, change the type of gender column to factor type.< 12. Display the structure of the data frame employee again. What is the data type of the gender column? Has it been changed to factor? If not, correct your code to change the type of gender column to factor type. 13. Display the structure of the data frame employee once more to see the change. 14. Display ALL data in employee object (data frame) • Replacing/Changing values: 15. Change the hair color (hcolor) of Nancy to brown 16. The birthday (birthyear) of 1993 is recorded for Chloe in row 5. Change 1993 to her age. 17. The weights entered for the last three employees are in kilograms. Change these weights to lbs equivalents of: 144, 131, 199 18. Display the employee data frame to see that the changes are recorded correctly.< DATA MANIPULATION • Adding and removing columns 19. Remove bcolor column (column 7) 20. Add the vectors country and citizen (created in question 1 and 3) as the new columns to employee data frame. 21. Display the employee data • Missing Values (NA) Checking for missing values (NA). Write the R codes for the following: 22. Is there any missing value in employee object? 23. How many missing values are there in the employee object? 24. Is there any missing value in age variable (column)? 25. How many missing values are there in age variable? 26. Replace NA value in work column in row 4 (Michael's work) with 14.+ 設計 版面配置 义字预测:圆雕农協助工具:调度 O E 2 01 28°C 2 ^ № Bure ▷ 口解… F * 36 R 0 合共用 E 100% TF04:38 E 2022/6/3
白热储存(OH)日 檔案 常用 插入 下 貼上 板钢格式 homework4 • 已保存到 此電腦 - o(Alt+Q) 登入 設計 版面配置 參考資料: 郵件 檢機 說明 Calibri (53) 12、AAA 书囚 ·E·EXU别 AaBbCcDd AaBbCcDd AaB AaB AaBbc AaBbC AaBbC 目 BIUebx, A- B I U … de x, x' 0 -0.A.A0 ===≡直 Ⓗ 培幽田 - 無間距 题1 题了 take 题4 Iv 中国 经验 日 板式 27. Calculate the mean age-ignore the NA values in the calculation. 28. Replace the NA value in age in row 4 (Michael's age) with the mean age value (calculated in 27) 29. Omit all other observations with missing values (NA).. Note that this will remove all rows containing the missing data. Assign the revised data (without NA data) to a new data frame empComplete+ 30, Display empCompleter' • Sorting and ordering data . Important: Use the empComplete data frame (created in question 29) to answer questions 31, 32, 33, 30. 35 and 36.4 31. Display empComplete data ordered by name. Do not make a change in the empComplete data frame. The display should not be just the names column. Your R code should display all the columns in the data frame ordered by name. 32, Calculate the mean work experience for each gender separately using tapply() function on gender column. + + Dividing data into smaller sizes (subsets of data: include only some columns/rows) 33. Display all the columns for female employees only (in empComplete data framele • Grouping data 34. Create a data frame (female) that contains the temale employees onlye 黑 田站博 第2頁,共3版 1040個 H ◇在這裡輸入文字來搜尋 义字预開飯跟協助工具:調五 城义() O 2 从 回 ⑥ 28℃ 晴時找吧 人 品取代 A测功 口解… F 透 路 后中 R P 合共用 下午04:38 2022/6/3 E 100% 2
白热储存(OH)日 檔案 常用 插入 下 貼上 板钢格式 可 homework4 • 已保存到 此電腦 - o(Alt+Q) 登入 設計 版面配置 參考資料: 郵件 檢機 說明 Calibri (53) 12、AAAar o书囚 ·E·EXU别 AaBbCcDd AaBbCcDd AaB AaB AaBbc AaBbC AaBbC 四 三三台 培 BIU x, x² ADA e x' A Ⓡ -無間距 +32 题了 take 單 之 经验 M 板式 35. Create another data frame (male) that contains the male employees only- 36. Calculate the mean work experience of female and male employees using female and male objects that you created in questions 34 and 35 above. Display these means. Are the answers to questions 32 and 36 consistent (same), 37. Creating the html file: After completing your R Notebook or R Markdown file, you will execute all the chunks, save the file, and generate the html file containing the codes and the results. To do this, use the following steps:/ Step 1. Execute all chunks one by one starting from the first chunk (regardless of whether you executed the codes while writing your codes). Step 2. Save your file➔Save Asse If you have completed Step 1, then Step 2 will save your Rmd file and (at the same time) will create the html file on your working directory. You will attach and submit this html file on Sakai as your homework4. 黑 田站博 Iv 第3頁(共3頁1040水眼病义) 义字预测:圆雕农協助工具:调度 8 ◇在這裡輸入文字來搜尋 O 分私子 回 ⑥ 28℃ 晴時找吧 人 品取代 A测功 口解… F 透 路 后中 R P 合共用 下午04:38 2022/6/3 + 100% 2
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply