Hello everyone,
I am wondering if there is an existing function in R that can produce a certain number of blank lines in R. I will give an example as below。
First, this is an example data frame:
exampleData <- data.frame(homeNB = c("ANDERLECHT CENTRUM - WAYEZ", "GROTE MARKT"), outTripNB = c(2, 3))
The table will look like this:
homeNB outTripNB
1 ANDERLECHT CENTRUM - WAYEZ 2
2 GROTE MARKT 3
Ideally, I would like to have something like this:
homeNB outTripNB toBeAdded
1 ANDERLECHT CENTRUM - WAYEZ 2 NA
2 ANDERLECHT CENTRUM - WAYEZ 2 NA
3 GROTE MARKT 3 NA
4 GROTE MARKT 3 NA
5 GROTE MARKT 3 NA
So as you can see, the number of newly added lines is equal to the number in the column outTripNB. As I have lots of NB in my data so it will be possible for me to add this manually. I am wondering if you can help me with this? Thanks very much for your help