r - Why does the vector gets expanded in the loop -


I need to select Size 5 window from the 'data' variable and use it in the next process. (Please see the following code). However, the length of 'all_data' increases for each walk. What am i doing

  next_one & lt; -function {for (for in: length (data)) {sub_data & lt; -data [k-5: k]; Print (sub_data); }}  

I call the function as follows:

  dat = read.csv ("file name"); Attached (DAT); # Is the corresponding column called 'val' (value);  

Add brackets:

(k-5 ): K

Comparison

  20-5: 20 # [1] 15 14 13 12 11 10 9 7 6 5 4 3 2 1 0 With  

  (20-5): 20 # [1] 15 16 17 18 19 20  

Help ("Syntax") to learn about the operator's priority.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -