Grouped Kernel Density Estimation

#1
Hi folks!

I'm new to the site and forum because I 'm having an R problem that I haven't seen answered yet...

Data:
I have daily temperature data covering a four year span of time. In its simplest form, I have three columns: "year_month", "timestamp", and "temps".

GOAL:
I want to create a separate kernel density estimate of temperature from the daily information for each month in the data set, so that in the end I may aggregate the daily temperature data to monthly temperature PDFs for which I will later use in regression.

So far, I have not been able to find a package (ks, np, KernSmooth, sm, bda, etc...), or base code which will allow me to do this, so I'm reaching out here for some advice.

I figured 'ks' would be my best bet since there is the 'x.group=' option but I am continually getting this error:

> Hkda(jcp$temps, x.group = jcp$year_month)
Error in x[x.group == gr, ] : incorrect number of dimensions

If necessary, I will be happy to post some sample data at a later time as my work computer will not allow it. Although, really I feel as though this should be a basic option built into most kernel density packages, so it should be a simple syntax issue, I hope.

Many thanks in advance!