Sorry, At the end of the code I get an error message
Error: object 'base_df' not found Best, Le mercredi 16 avril 2025 à 18:23:42 UTC+2, Ben Bolker <bbol...@gmail.com> a écrit : Unless this is a continuation of a conversation I missed the beginning of, you haven't told us enough yet for us to help you. What is your problem? Do you get an error? Does the code give you an incorrect result? How do you know? (It's possible that I could figure out that your code hits an error by running it myself, but if that is the case it would be better if you said "I get the following error <full text of error>, at the following point in the code ..." ) On 2025-04-16 12:11 p.m., varin sacha via R-help wrote: > R-experts, > > The R script here below. > > How to solve my problem ? > > Best, > > > ############################## > # Load packages > > install.packages("remotes") > remotes::install_github("bd2kccd/r-causal") > > # Install 'gssr' from 'ropensci' universe > install.packages('gssr', repos = > c('https://kjhealy.r-universe.dev', 'https://cloud.r-project.org')) > > # Also recommended: install 'gssrdoc' as well > install.packages('gssrdoc', repos = > c('https://kjhealy.r-universe.dev', 'https://cloud.r-project.org')) > > library(dplyr) > library(gssr) > > set.seed(123) > > > # Load dataset > > data("gss_panel06_long") > > > # Filter one wave, remove variables with high NA, and keep usable types > > base_df <- gss_panel06_long %>% > > filter(year == 2006) %>% > > select_if(~ is.numeric(.) || is.factor(.)) %>% > > select_if(~ sum(is.na(.)) < 0.1 * n()) %>% > > na.omit() > > > # Sample sizes to test > > sample_sizes <- c(30, 50, 100, 300, 500) > > > # Set plotting layout > > par(mfrow = c(2, 3)) # 2 rows, 3 columns > > > # Loop through sample sizes > > for (n in sample_sizes) { > > df_sample <- sample_n(base_df, n) > > result <- gfci(data = df_sample, test = "kci", score = "sem-bic") > > plot(result, main = paste("n =", n)) > > } > ################################# > > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide https://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Dr. Benjamin Bolker Professor, Mathematics & Statistics and Biology, McMaster University Director, School of Computational Science and Engineering > E-mail is sent at my convenience; I don't expect replies outside of working hours. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.