I have a data frame like this:
<table>
<tr><td>Task</td><td>UserStory</td><tr>
<tr><td>123</td><td>abc</td><tr>
<tr><td>4321</td><td>abc</td><tr>
<tr><td>8763</td><td>abc</td><tr>
<tr><td>9087</td><td>efg</td><tr>
<tr><td>0652</td><td>efg</td><tr>
<tr><td>7609</td><td>hij</td><tr>
</table>
I have collected the unique values for User Story into a vector. ("abc", "efg", "hij"). Let's say I've created this vector as "UserStories".
UserStories <- c("abc", "efg", "hij")
I would like to create a vector of matching Tasks for each value in the first vector, with the eventual goal of creating a second data frame with this structure:
<table>
<tr><td>abc</td><td>1234</td><td>4321</td><td>8763</td><tr>
<tr><td>efg</td><td>9087</td><td>0652</td><td>NA</td><tr>
<tr><td>hij</td><td>609</td><td>NA</td><td>NA</td><tr>
</table>
I thinking of then rbind'ing them into a second data frame once I've padded the missing values with NA:
abc, 1234, 4321, 8763 efg, 9087, 0652, NA hij, 7609, NA, NA
I've been googling all afternoon without finding an approach.
I'd like to pass the UserStories vector to a function which would extract a series of vectors for all of the tasks associated with each UserStory.
Thanks in advance to any takers.