Open tpemartin opened 2 years ago
@raychiu135
if(pick5_1_4[[.x]]==T){
can be reduced to if(pick5_1_4[[.x]]){
since pick5_1_4[[.x]]
is already logical.@AmyChen20021003
iterate generation
happens several time, try to combine the .x-patterns.
https://github.com/AmyChen20021003/110-1-r4ds-main/blob/fdca3bce1bf5fbe8fdad6f52abe8ac7cc6ff3dd8/5-1.Rmd#L32
Exercise 5.1 Load the following data set:
Data set concerts_obo has difference performance information as its observations. For each performance, there can be more than one show, and each show’s information is contained inside the observation’s showInfo element.
How many shows does the 5th performance have?
If we are to find out the number of shows for each performance, what is the .x-pattern?
Find out the number of shows for each performance, and put the answer as an integer vector under analysis$number_of_shows. (i.e. analysis$number_of_shows[[5]] will show your answer in 1.)
Construct a data frame with columns, title, date, location and locationName, where title comes from each observation’s title, and the rest three are from each observation’s 1st showInfo. In addition, date column has to be “POSIXct” “POSIXt” class with Taipei time zone.