Question
In this section of the activity, we will be focusing on aggregate functions that we discussed in the course modules. These functions are used to
In this section of the activity, we will be focusing on aggregate functions that we discussed in the course modules. These functions are used to perform calculations on the values of different columns and as an outcome, we can extract information about the attributes in the table that will result in retrieving relevant insights. These aggregate functions include avg, count, sum, min, and max and they will be used on the values of attributes to return a certain calculation of the values considered.
Use SQLite to establish a connection and work with SQL: using this link https://db.rstudio.com/databases/sqlite/ you will write table "Melanoma" with dbWriteTable command instead of mtcars. To make sure that you are using the proper library for birthwt use the library(MASS) first and then use data("Melanoma") commands in Rstudio to make the Melanoma dataset available. To better understand the Melanoma dataset, please review this link and understand the variables: https://www.rdocumentation.org/packages/MASS/versions/7.3-53/topics/Melanoma
After installing RSQLite, create a connection using the command below: con <-dbConnect(RSQLite::SQLite(), ":memory:") dbListTables(con) After establishing the connection successfully, we can use the Melanoma dataset to write it in a database table using the below command: dbWriteTable(con, "Melanoma", Melanoma) dbListTables(con) The result of the list tables will be in this case the only dataset added.
Required Tasks 1) Make a table with two columns of MIN and Max survival time in days for the below rows: a. All study participants b. Female study participants c. Male study participants d. Study participants who had ulcer e. Study participants who did not have ulcer f. All female participants with ulcer g. All female participants without ulcer h. All male participants with ulcer i. All female participants without ulcers 2) Make a frequency table that to report on the below: a. The number of female participants who died from Melanoma b. The number of female participants who died from other causes c. The number of female participants who are alive d. The number of male participants who died from Melanoma e. The number of male participants who died from other causes f. The number of male participants who are alive g. The number of female participants with ulcer who died from Melanoma h. The number of male participants without ulcer who died from Melanoma 3) Make a table with two columns of male and female for the below rows: a. Report on the average age b. Report on the SUM of the survival time of each group c. Report on the average age for patients with ulcerd. Report on average age of patients without ulcers e. Report on average age of patients who died from Melanoma f. Report on average age of patients who died from other causes g. Report on average age of patients who were alive at the end of the study h. Report on SUM of the tumor thickness i. Report on SUM of the tumor thickness for patients who died from Melanoma j. Report on SUM of the tumor thickness for patients who died from other causes
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started