Quantcast
Channel: Active questions tagged row - Stack Overflow
Viewing all articles
Browse latest Browse all 447

How to duplicate a row in a dataframe and relocate it just after the original row?

$
0
0

let's say I have this df

original_df <- data.frame(  ID = c(1, 2, 3),  Name = c("Alice", "Bob", "Charlie"),  Age = c(25, 30, 22))

I wish the following output

  ID    Name Age1  1   Alice  252  2     Bob  303  2     Bob  304  3 Charlie  22

Viewing all articles
Browse latest Browse all 447

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>