Declaring A Variable Before Loop In R