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

Error in self$model$get_scores(effect_i = effect_i, component = component) : object 'PC' not found #10

Closed
MuyaoXi9271 opened this issue Feb 13, 2024 · 10 comments

Comments

@MuyaoXi9271
Copy link

Hi developer,

I got the ALASCA model successfully but accidentally removed the log file. I met the error as shown in the title when I ran plot(ALASCA_model, component = c(1,2), type = "effect")

I appreciate any help you could provide.

Best,
Muyao

@andjar
Copy link
Owner

andjar commented Feb 13, 2024

Hi @MuyaoXi9271,

Thanks for reporting this issue. I am not able to replicate the error. What version of ALASCA are you using? What settings do you use?

Best,
Anders

@MuyaoXi9271
Copy link
Author

Hi Anders,

The version I used is 1.0.14.

ALASCA_model <- ALASCA(df_l, formula = value ~ visit*group + (1|subject), scale_function = "sdall", validate = TRUE, filepath = paste0(path_outputs$POS, "/ALASCA"), save = TRUE)

Thanks for your quick reply.

Best,
Muyao

@andjar
Copy link
Owner

andjar commented Feb 13, 2024

Hi,

Thank you for the additional information. I am still unable to reproduce the error using the Example 2 dataset in our paper and your settings. Is visit a factor variable? Do you get any output with ALASCA_model$get_scores(component = c(1,2))?

Best,
Anders

@MuyaoXi9271
Copy link
Author

Hi Anders,

I get the same error. What else can I check also?

Best,
Muyao

@andjar
Copy link
Owner

andjar commented Feb 13, 2024

You can take a look at the score data table itself with ALASCA_model$ALASCA$score which contains all the PCs calculated

@MuyaoXi9271
Copy link
Author

image

I can get the data table after running ALASCA_model$ALASCA$score as shown in the image above.

Best,
Muyao

@andjar
Copy link
Owner

andjar commented Feb 13, 2024

Thank you. I have no experience using the tibble package but perhaps it is interfering in some way (since this print looks like tibble)? I guess you can try mod$ALASCA$score[[1]] <- as.data.table(mod$ALASCA$score[[1]]) and then try to plot again, just to ensure that the data tables actually are data table objects

@MuyaoXi9271
Copy link
Author

I try mod$ALASCA$score[[1]] <- as.data.table(mod$ALASCA$score[[1]]) and mod$ALASCA$score <- as.data.table(mod$ALASCA$score[[1]]) (I use the function as.data.table from package data.table)

I still have the same error when I plot it.

Best,
Muyao

@andjar
Copy link
Owner

andjar commented Feb 13, 2024

Strange! Can you check that it is indeed a data table? is.data.table(ALASCA_model$ALASCA$score[[1]])

So, the issue here is that - with data.table - we can select the appropriate rows with self$ALASCA$score[[effect_i]][PC %in% component] (where self is the model object) - this is the code in the get_scores function that throws the error. But there is something preventing this selection to work. We can, however, see that the data table exists and has a column called PC

@MuyaoXi9271
Copy link
Author

Hi Ander,

It works now.

Thanks for your help

Best,
Muyao

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

2 participants