Problem data.frame

Points that strike to me immediately:

  1. Your while loop doesn't make any sense to me. First of all, you're not updating i, so this loop will run forever. Second, even if you add a stopping condition (say i <- (i + 1) before closing the while loop), what will you get? final will still be cbind(one, two), and repeating it has no meaning. Perhaps, you were planning to update final in each repetition, or something like that?

  2. How did you run cbind(one, two), where one is an empty data frame, and two has 20 rows? I failed to run it, as you can find below:

one <- data.frame()
two <- data.frame(1:20)
cbind(one, two)
#> Error in data.frame(..., check.names = FALSE): arguments imply differing number of rows: 0, 20

Please try to ask a properly formulated question with a minimal reproducible example. This will help others to help you. You can go through these helpful posts:

1 Like