For loops in R can lose class information
Win-Vector Blog 2016-03-25
Summary:
Did you know R‘s for() loop control structure drops class annotations from vectors? Consider the following code R code demonstrating three uses of a for-loop that one would expect to behave very similarly. dates <- c(as.Date('2015-01-01'),as.Date('2015-01-02')) for(ii in seq_along(dates)) { di <- dates[ii] print(di) } ## [1] "2015-01-01" ## [1] "2015-01-02" for(di in as.list(dates)) { … Continue reading For loops in R can lose class information