I'm new to r programming and I have a csv file which contains a table with two columns: Subject/Subject ID and Age. I want to run a for loop where it checks the age and if it matches the age, then it will return it's corresponding Subject ID. Can someone help me with this. Thanks in advance
Your question is not clear but I think you want to know the Subject ID that corresponds to a given Age. The following code shows two ways to get that, neither using a for loop. Note that the first method returns a vector and the second method returns a data frame.