library(tidyverse)
<- read_csv("http://bcdanl.github.io/data/dominick_oj_feat.csv")
oj ggplot(data = oj,
mapping = aes(x = price, y = sales,
color = brand)) +
geom_point(alpha = .3) +
geom_smooth(method = "lm") +
labs(title = "Scatter Plot of Sales vs. Price",
x = "Price",
y = "Sales")
Homework Assignment 5
- Please answer all of the following questions thoroughly, ensuring that none are left unanswered.
- Craft your answers in a Word document and submit your Word document to Brightspace
- For Homework Assignment 5, the use of any generative artificial intelligence (AI) tools is strictly required.
- Pick one generative AI tool you prefer.
- Copy your conversation with generative AI and paste it to your Word document.
- You may submit multiple times, but only your most recent submission will be evaluated.
- The due is December 10, 11:59 P.M., 2024, Tuesday, Eastern Time.
Question 1.
What generative AI tool have you used for this homework assignment?
Question 2.
- Provide your conversation with generative AI to do the following tasks:
- Translate the following R
ggplot
code into Pythonseaborn
code to generate a scatter plot showing the relationship between “sales” and “price” using the CSV file,http://bcdanl.github.io/data/dominick_oj_feat.csv
. - Make a step-by-step comparison between the Python code and the R code to understand how each part corresponds to the other.
- Translate the following R
Question 3.
- Provide your conversation with generative AI to do the following task:
- Make an in-line comment on each line of the following R
ggplot
code.
- Make an in-line comment on each line of the following R
library(tidyverse)
<- read_csv("http://bcdanl.github.io/data/dominick_oj_feat.csv")
oj ggplot(data = oj,
mapping = aes(x = price, y = sales,
color = brand)) +
geom_point(alpha = .3) +
geom_smooth(method = "lm") +
labs(title = "Scatter Plot of Sales vs. Price",
x = "Price",
y = "Sales")
Question 4
Insert an image file of your scatterplot showing sales
versus price
, with data points color-coded by brand
, generated using Power BI.
Question 5.
- Provide your conversation with generative AI to debug the following code:
- Explain to the generative AI the error message you received when running the code below:
|>
oj counting(brand, ad_status)
Question 6.
- Provide your conversation with generative AI for adding a new variable,
revenue
, to theoj
data frame.- The
revenue
variable should be computed as the product ofsales
andprice
to provide information about the weekly revenue for each orange juice brand.
- The
library(tidyverse)
<- read_csv("http://bcdanl.github.io/data/dominick_oj_feat.csv") oj