题目
题目

ECON3310001.1251 Extra Credit Assignment: Power BI & SQL

数值题

R & Power BI In this exercise, you will embed R into Power BI to analyze industry employment data. The following steps are the same as the previous exercise. Make sure you load the same data again: Step 1: Use Embedded SQL to Import Data Click Get Data, then choose MySQL. Enter the following connection details: Server: dadata.bensresearch.com Database: industry Click Advanced Options to embed custom SQL queries. Paste and run each of the queries below one at a time: SELECT TSE.DataYear, TSE.StateShort, SUM(HHI.Herf * ISE.Emp / TSE.Emp) AS WHHI FROM (SELECT StateShort, DataYear, SUM(ExpEmpValue) AS Emp FROM StateData WHERE IndustryCodeLength = 6 GROUP BY StateShort, DataYear) AS TSE JOIN (SELECT StateShort, DataYear, IndustryCode, ExpEmpValue AS Emp FROM StateData WHERE IndustryCodeLength = 6) AS ISE ON TSE.StateShort = ISE.StateShort AND TSE.DataYear = ISE.DataYear JOIN HHI ON ISE.DataYear = HHI.DataYear AND ISE.IndustryCode = HHI.IndustryCode GROUP BY TSE.DataYear, TSE.StateShort ORDER BY WHHI SELECT * FROM HHI SELECT * FROM StateData SELECT StateShort, DataYear, SUM(ExpEmpValue) AS Emp FROM StateData WHERE IndustryCodeLength = 6 GROUP BY StateShort, DataYear Rename your resulting tables as follows: WHHI (for the weighted HHI results) HHI StateData StateEmp (total employment by state) Step 2: Import NAICS Labels Click Get Data again. Browse for the file NAICS.csv and load it. Your result should look like this: Step 3: Using R Once you have these results. Select the R visualization. Drag only DataYear, ExpEmpValue and IndustryCodeLength to it. Then write the code below, which transforms and plot the data: library(sqldf) plot <- sqldf("SELECT DataYear, SUM(ExpEmpValue) AS Emp FROM dataset WHERE IndustryCodeLength = 6 GROUP BY DataYear") library(ggplot2) ggplot(plot, aes(x = DataYear, y = Emp)) +   geom_line(color = "steelblue", size = 1) +   geom_point(color = "steelblue", size = 2) +   labs(title = "Employment Over Time",     x = "Year",     y = "Employment" ) +   theme_minimal() Question: Inspect the resulting graph. Which year had the lowest number of manufacturing jobs nationwide? Ignore years not included in our dataset.

题目图片
查看解析

查看解析

标准答案
Please login to view
思路分析
Initial observation: The question asks to inspect the resulting graph and identify the year with the lowest number of manufacturing jobs nationwide, while noting to ignore years not present in the dataset. Since the provided data for answer options is empty, there are no explicit choices to evaluate one by one. In situations like this, you should rely on the visual output (the plotted line) to determine which DataYear has the minimum Emp value. Key idea 1: Read the plotted line accurately. The graph repre......Login to view full explanation

登录即可查看完整答案

我们收录了全球超50000道考试原题与详细解析,现在登录,立即获得答案。

更多留学生实用工具

加入我们,立即解锁 海量真题独家解析,让复习快人一步!