I want to create a df in R with two variables, they have different number of rows. This is an abstract example: I want to match a 3 to "Fail" (without writing in manually, I know that I could just write the 3 in a on the third place). So first assign 3 to Fail, than match 1 to Test, 2 to Test, 4 to Success and 5 to Test by skipping Fail.
a <- c(1,2,4,5)
b <- c("Test", "Test", "Fail", "Success", "Test")
data.frame(a,b)
So the following steps would be important:
1st: find string "Fail": assign a certain value to it (here 3)
2nd: create a df with a and b
3rd: final result should look like this:
a | b |
---|---|
1 | Test |
2 | Test |
3 | Fail |
4 | Success |
5 | Test |