Data manipulation in R
Here is one way to generate two data frames based on the data.

# read data
dat &lt;- read.csv("sample csv1.csv", stringsAsFactors = FALSE, header = FALSE)

# find rows containing "Interval"
idx_int &lt;- dat[[1]] == "Interval"

# calculate groups
group &lt;- cumsum(idx_int) %% 2

# remove indices for "Interval" rows
group2 &lt;- group[!idx_int]

# split data frame into two data frames
dat_list &lt;- split(dat[!idx_int, ], group2)

# generate two separate data frames
dat_energy &lt;- dat_list[[2]]  # Energy
dat_demand &lt;- dat_list[[1]]  # Demand