how to solve this error: attempt to set 'rownames' on an object with no dimensions
<p>I have a csv file with daily streamflow. I need to combine the daily values into monthly. I am trying to use the "daily2monthly" function of "hydroTSM" package. 
sample data from the BRPT2.csv:</p>

<pre><code>_date,_time,_value,_flag
 10/2/1959,0:00:00,0,2
 10/3/1959,0:00:00,0,2
 10/4/1959,0:00:00,1540,2
 10/5/1959,0:00:00,16100,2
 10/6/1959,0:00:00,6680,2
 10/7/1959,0:00:00,3100,2
 10/8/1959,0:00:00,2060,2
</code></pre>

<p>I used the following commands:</p>

<pre><code>qme&lt;- read.csv(file = "BRPT2.csv",header = T,sep = ",") #read in csv file
date&lt;- as.Date(qme$X_date,format("%Y-%m-%d")) #convert date column to date format from factor
flow&lt;- qme[,3]
flow_2&lt;-replace(flow,flow==-999,0) #replace the missing values (-999) with 0
df&lt;- data.frame()
df&lt;- rbind(df,data.frame(date,flow_2,stringsAsFactors = FALSE))
daily2monthly(df,FUN=sum,dates=1)
</code></pre>

<p>And it gives the following error message:</p>

<blockquote>
  <p>Error in <code>rownames&lt;-</code>(<code>*tmp*</code>, value = c("Oct-1959", "Nov-1959",
  "Dec-1959",  :    attempt to set 'rownames' on an object with no
  dimensions</p>
</blockquote>

<p>Could someone help me regarding this. Thanks in advance.</p>