0
0
R Programmingprogramming~10 mins

Parameterized reports in R Programming - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a parameterized report that accepts a year input.

R Programming
params <- list(year = [1])
report <- render_report('sales_report.Rmd', params = params)
Drag options to blanks, or click blank then click option'
A'2023'
Byear
C2023
Dinput$year
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the year as a number without quotes causes errors.
Using variable names instead of actual values.
2fill in blank
medium

Complete the code to filter data by the parameter 'region' inside the report.

R Programming
filtered_data <- subset(data, region == [1])
Drag options to blanks, or click blank then click option'
A'region'
Bparams$region
Cregion
D'params$region'
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes around params$region treats it as a string literal.
Using the column name 'region' instead of the parameter value.
3fill in blank
hard

Fix the error in the code to correctly pass multiple parameters to the report.

R Programming
params <- list(year = [1], region = 'North')
Drag options to blanks, or click blank then click option'
Ayear
B2022
Cparams$year
D'2022'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing year as a number without quotes.
Using variable names instead of actual values.
4fill in blank
hard

Fill both blanks to create a parameterized filter for sales data.

R Programming
filtered_sales <- subset(sales, [1] == [2])
Drag options to blanks, or click blank then click option'
Aregion
Bparams$region
C'region'
D'params$region'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting quotes around the parameter variable.
Using the parameter name as a string instead of the column name.
5fill in blank
hard

Fill all three blanks to create a parameterized summary report filtering by year and product.

R Programming
summary_data <- subset(data, [1] == [2] & [3] == params$product)
Drag options to blanks, or click blank then click option'
Ayear
Bparams$year
Cproduct
D'year'
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes around parameter variables.
Mixing up column names and parameter names.