I ´m getting the first steps in R and perhaps someone could help me. I have a table with n columns and n rows, and what I want to write a script to search each rows for a value, if don´t matches the value than it should proceed to the next row until if matchs the value. Once it matches the value it should go back to the previous row and the concatenate this row with the first column of the table. Can anyone give me any idea on how to make this on R?
Share
Let’s you are looking for the first occurrence of value
Xin the tablefoo. Try this:You may further remove the names of your result by
unname()command or assign your desired names bynames().