I'm trying to do a 3d kernel density estimation on a ternary plot using the function kde3d, but when I run the code, it can't find my second coordinate.
I'm using the function
kde3d(C, S, R, 0.588, n = 41, lims = c(range(C), range(S), range(R)))
but when I run the code it gives me the error message:
Error: object 'S' not found
C, S, and R are the names of columns in my dataframe. I've switched the orders of the coordinates, tried a, b, and c (the names of columns C, S, and R before I renamed them), and tried x, y, and z. Why can R find my first coordinate but not my second