Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating kernel models with get_kernel doesn't work #12

Closed
PaulPOOFA opened this issue Nov 21, 2021 · 4 comments
Closed

Creating kernel models with get_kernel doesn't work #12

PaulPOOFA opened this issue Nov 21, 2021 · 4 comments

Comments

@PaulPOOFA
Copy link

Thanks for creating the package.

I am facing difficulty creating kernel models EMM, EMDs, RMMM and RNMDs based on the toy data set in the package. I am receiving error message: length of 'dimnames' [1] not equal to array extent. I do not know how to fix this.

EMM = get_kernel(K_G = KG, K_E = KE, y = y,gid = gid,env = env, data = maizeYield, model = "EMM")
EMDs = get_kernel(K_G = KG, K_E = KE, y = y,gid = gid,env = env, data = maizeYield, model = "EMDs")
RMMM = get_kernel(K_G = KG, K_E = KE, y = y,gid = gid,env = env, data = maizeYield, model = "RNMM")
RNMDs = get_kernel(K_G = KG, K_E = KE, y = y,gid = gid,env = env, data = maizeYield, model = "RNMDs")

Error in dimnames(x) <- dn :
length of 'dimnames' [1] not equal to array extent

Thanks.

@huw143
Copy link

huw143 commented Nov 3, 2023

Any solution for this, I met the same issue here.

Thanks for your helps,

Tiger

@PaulPOOFA
Copy link
Author

PaulPOOFA commented Nov 3, 2023 via email

@huw143
Copy link

huw143 commented Nov 3, 2023

Thank you Paul for your quick response,

The question is same:

EMM = get_kernel(K_G = KG, K_E = KE, y = y,gid = gid,env = env, data = maizeYield, model = "EMM")
EMDs = get_kernel(K_G = KG, K_E = KE, y = y,gid = gid,env = env, data = maizeYield, model = "EMDs")
RMMM = get_kernel(K_G = KG, K_E = KE, y = y,gid = gid,env = env, data = maizeYield, model = "RNMM")
RNMDs = get_kernel(K_G = KG, K_E = KE, y = y,gid = gid,env = env, data = maizeYield, model = "RNMDs")

Error in dimnames(x) <- dn :
length of 'dimnames' [1] not equal to array extent

But I figured it out already,

This is because the gid in the dataframe of maizeYield are not the same format, some of them are character, while some of them are not. I used the following R script to fix it.

maizeYield$gid <- as.character(maizeYield$gid)

Thanks for your contribution to this R package, which is amazing!

Best regards,

Tiger

@PaulPOOFA
Copy link
Author

PaulPOOFA commented Nov 3, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants