title: How can I split the numeric data into group of 500 each, without sorting the data in R?
body: <p>This question might look simple but I am not able to find the correct function to get desired output. </p>
  
  <p>I extracted the required data from uploaded text file using following code in R - </p>
  
  <pre><code>&gt; library(stringr)
  &gt; library(readr)
  &gt; 
  &gt; myFile = readLines(file.choose())
  &gt; 
  &gt; myResult = list() 
  &gt; 
  &gt; vars = c(which(str_detect(myFile, "^\\[.*\\]\\s*$") == T), length(myFile))
  &gt; 
  &gt; for(i in 1:(length(vars)-1)){
  +   myData = myFile[vars[i]:(vars[i+1]-1)]
  + #remove lines that are comments or blank
  + myData = myData[!str_detect(myData, "^\\s*#|^\\s*$")]
  + 
  + #if content is a list of variables, create them as a list
  + if(str_detect(myData[2],"=")){
  +   content = str_split(myData[-1],"=")
  +   result = lapply(lapply(content,"[",2), parse_guess)
  +   names(result) = sapply(content,"[",1)
  + } else{
  +   #if the content just a vector of data, extract it
  +   result = parse_guess(myData[-1])
  + }
  + #create the variable as a list item and assign the content 
  + myResult[[str_remove_all(myData[1], "\\[\\]")]]=result
  + }
  &gt; 
  &gt; 
  &gt; myFile = myResult$`[specdata0]`
  &gt; 
  &gt; myFile=myFile[1:(myResult$`[specchannel0]`$fRPMmean*4/myResult$`[specchannel0]`$dF)]
  &gt; 
  &gt; View(myFile)
  &gt;
  </code></pre>
  
  <p>myFile has data in following way - image <a href="https://i.stack.imgur.com/muGfc.png" rel="nofollow noreferrer">myFile</a></p>
  
  <p>I want to divide this data into groups of 500. </p>
  
  <p>How can I do this?</p>
  
  <p>Thank You</p>