I am having trouble assigning to a dataframe after running the for loop. When I use print it give my value, any explanation to it?
salesdate<-rep(seq(from=as
You are mixing vectorized processing with indexed. In the first example, you assign the one number from (length.....) to all elements of test, overwriting the numbers on each cycle. Only the last assignment is printed.
something like:
test = rep(NA,length(new))
for (i in new)
test[i] = your number
will work. As Paul mentions, the code is not very R-ish, but since you did not provide msales, I cannot give you a better example.