title: adding a subject ID variable to a big dataframe in R using loop or other function?
body: <p>i just started using R.
  I merged 54 files (54 subjects) each 7 variables (data from a behavioral experiment) into one R dataframe.</p>
  
  <p>i now have the variables trial (1 to 210) reaction-time, choice and others in one table starting from subject 1 to 54.</p>
  
  <p>my problem is that i do not have a subject variable (subject ID).</p>
  
  <p>is there any easy way to add a subject variable to the dataframe where already all subjects are in (subject 1 to the first 210 trials (rows) subject 2 to next 210 rows... and so on)</p>
  
  <p>my plan is to use maybe a loop function that adds a variable with the value 1 to the dataset from row 1 to 210 and than a variable 2 to the next 210 rows and so on until subject 54 (row 10920).</p>
  
  <p>thank you very much for your help and best wishes</p>