Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Quiz
3. Exercise 3

Instruction

Perfect!

Now, let's display the starting point of each transportation company. The starting point is denoted with a zero in the destination_number column. Here's an example using company_a:

city country ... destination_number ...
1 Prague Czech Republic ... 0 ...

Exercise

First, let's create a function named starting_point that takes a single data frame named df and returns the name of the city for which destination_number is equal to zero.

Stuck? Here's a hint!

Hint 1: df$destination_number and df$city will extract the destination_number and city columns, respectively.

Hint 2: You can extract all rows for which destination_number equals 0 like this:

df[df$destination_number == 0, ]

Hint 3: To display only the city column, use this code:

df[df$destination_number == 0, "city"]