Q:

kernel density function in R gives unequal x and y resolution

I hope you can help me with a problem that I've had for a while now. I need to make a bias file for MaxEnt, for which I have used this tutorial: https://scottrinnan.wordpress.com/2015/08/31/how-to-construct-a-bias-file-with-r-for-use-in-maxent-modeling/ and altered it to my own situation. However, I'm stuck now...
I need to use the kde2d function to create a 2d kernel density estimation and then turn that into a raster. However, the raster that is created has a different resolution for x and y. This is a problem, since I have to use it in MaxEnt which won't accept unequal x and y resolutions.
This is what I did:
biasraster <- raster("file.tif") #load raster with all the occurrences  
presences <-which(values(biasraster)==1)  
pres.locs<- coordinates(biasraster)[presences,]  
dens <-kde2d(pres.locs[,1],pres.locs[,2],n=c(nrow(biasraster),ncol(biasraster))) #2d kernel density function on the biasraster  
dens.ras<-raster(dens) #create raster from kde2d function 

The original resolution of the biasraster is 0.00833333 for both x and y, but the resolution for dens.ras has changed to 0.0104052, 0.00833333 (x,y) (so the y resolution is the correct one).
As can probably be seen from the question, I am a total noob when it comes to coding (in r). I've been trying to figure out what to do for about a week now but I can't find any answers that seem to work, so I hope someone here can help me. 

A:

I had the same problem. I only could solve it using:
dens.ras <- resample(dens.ras, climdat, method="bilinear") #make bias file in the same resolution of climdat
but additionaly, I need also cut dens.ras.
densmod<-crop(dens.ras,extent(climdat))
With these additional steps, my bias file worked well.

