Cannot knit document

Hello,

I'm trying to knit my document but I get this code:

Calls: ... process_file -> split_file -> lapply -> FUN -> parse_block
Execution halted

Does anyone know how to fix this?

Thank you in advance.

I've also updated the knitr package

Hi,

we need more information on what you are doing. It is highly possible this comes from your Rmd chunks content. Without it we won't be able to help.

I would really encourage you to review the following guide, FAQ: Tips for writing R-related questions. For example, the guide emphasizes asking coding questions with formatted code-chunks and a reprex, which would make it easier for people who want to help you to pick up your issue and attempt to run with a solution.

thanks

Hello,

Thank you for the response. My Rmd document is quite big but I will try to attach it:

library(tidyverse)
library(knitr)
library(here)
library(dplyr)
library(Hmisc)
library(cowplot)
library(kableExtra)
library(afex)
library(broom)
library(GGally)
library(ggfortify)
library(tidyr)
library(ggplot2)
library(ltm)
____________________

library(readr)
ddata <- read_csv("Downloads/Research Dissertation: Inner Reach for Poetry_March 13, 2022_16.52.csv")
___________________

filter(.data = ddata, Finished > 0) %>% nrow()
new_ddata <- ddata %>% filter ((Finished > 0))

new_ddata

dem_data <- new_ddata %>% 
  dplyr::select(Q1, Q2, Q3, ResponseId) 
dem_data

dem_data <- new_ddata
____________________
dem_data2 = dplyr::select(dem_data, -RecipientLastName, -RecipientFirstName, -RecipientEmail, -ExternalReference, -Q4, -Q6, -Q13_1, -Q16, -Q17, -Q9, -DistributionChannel, -StartDate, -EndDate, -Status, -IPAddress, -Finished, -LocationLatitude, -LocationLongitude)

dem_data2 <- rename(dem_data2, Age = Q1, Gender = Q2, Ethnicity = Q3)

dem_data2 <- dem_data2[-c(1), ]

dem_data2 <- dem_data2

____________________

Condition <- c("Lyrical", "Lyrical", "Lyrical", "Non-Lyrical", "Lyrical", "Non-Lyrical", "Lyrical", "Non-Lyrical", "Lyrical", "Lyrical", "Lyrical", "Lyrical", "Non-Lyrical", "Non-Lyrical", "Lyrical", "Lyrical", "Non-Lyrical", "Lyrical", "Non-Lyrical", "Lyrical", "Non-Lyrical", "Lyrical", "Non-Lyrical", "Non-Lyrical", "Non-Lyrical", "Lyrical", "Lyrical", "Lyrical", "Non-Lyrical", "Non-Lyrical", "Non-Lyrical", "Non-Lyrical", "Non-Lyrical", "Non-Lyrical", "Non-Lyrical", "Lyrical", "Non-Lyrical", "Lyrical", "Lyrical", "Non-Lyrical", "Lyrical", "Lyrical", "Non-Lyrical", "Non-Lyrical", "Non-Lyrical", "Non-Lyrical", "Lyrical","Non-Lyrical","Lyrical", "Non-Lyrical", "Non-Lyrical", "Non-Lyrical", "Non-Lyrical", "Lyrical", "Non-Lyrical", "Non-Lyrical", "Non-Lyrical", "Non-Lyrical")

dem_data2['Condition'] <- Condition

dem_data2 <- dem_data2[-c(38, 21, 10),]

dem_data2 <- dem_data2

dem_data2 <- dem_data2 %>% as.data.frame(apply(dem_data2, 2, as.numeric)) 
sapply(dem_data2, class)

dem_data2 <- dem_data2 %>% type_convert(col_types = cols(ResponseId = col_character()))

age_desc <- dem_data2 %>%
  summarise(
    mean = mean(Age, na.rm = T),
    sd = sd(Age, na.rm = T),
    min = min(Age, na.rm = T),
    max = max(Age, na.rm = T)
)
age_desc

table(dem_data2$Gender)

table(dem_data2$Ethnicity)

table(dem_data2$Q8)

coo_desc <- dem_data2 %>%
  mutate(Gender = fct_explicit_na(Condition)) %>%
  group_by(Condition) %>%
  summarise(n = n(),
            perc = n()/nrow(dem_data2) * 100,
            mean_age = mean(Age, na.rm = T),
            sd_age = sd(Age, na.rm = T))
coo_desc

coo_desc %>% kable() %>% kable_styling()

coo_desc %>%
  kable(col.names = c("Condition", "*N*", "%", "*M*~age~", "*SD*~age~"),
        caption = "Table 1 *Descriptive statistics by Condition*",
        digits = 2) %>%
  kable_styling()


relevance_data <- dem_data2 %>% 
  dplyr::select(ResponseId, Q18_1, Q18_2, Q18_3, Q18_4, Q18_5, Q18_6, Q18_7, Q18_8, Q18_9, Q18_10, Condition) 
relevance_data

relevance_data <- relevance_data
                           
relevance_comp <- relevance_data %>%
  group_by(ResponseId) %>% 
  mutate(relevance_comp = mean(c(Q18_1, Q18_2, Q18_3, Q18_4, Q18_5, Q18_6, Q18_7, Q18_8, Q18_9, Q18_10), na.rm = T)) %>% 
  dplyr::select(ResponseId, Q18_1, Q18_2, Q18_3, Q18_4, Q18_5, Q18_6, Q18_7, Q18_8, Q18_9, Q18_10, relevance_comp)
relevance_comp

relevance_data <- relevance_data %>%
  group_by(ResponseId) %>% 
  mutate(relevance_comp = mean(c(Q18_1, Q18_2, Q18_3, Q18_4, Q18_5, Q18_6, Q18_7, Q18_8, Q18_9, Q18_10), na.rm = T)) %>% 
  ungroup()

relevance_data <- relevance_data %>% 
  group_by(ResponseId) %>% 
  mutate(nars_total = sum(Q18_1, Q18_2, Q18_3, Q18_4, Q18_5, Q18_6, Q18_7, Q18_8, Q18_9, Q18_10),
         nars_comp = nars_total/10) %>% 
  ungroup()
____________________

relevance_data <- dem_data2 %>% 
  dplyr::select(ResponseId, Q18_1, Q18_2, Q18_3, Q18_4, Q18_5, Q18_6, Q18_7, Q18_8, Q18_9, Q18_10, Condition) 
relevance_data

relevance_data <- relevance_data
                           
relevance_comp <- relevance_data %>%
  group_by(ResponseId) %>% 
  mutate(relevance_comp = mean(c(Q18_1, Q18_2, Q18_3, Q18_4, Q18_5, Q18_6, Q18_7, Q18_8, Q18_9, Q18_10), na.rm = T)) %>% 
  dplyr::select(ResponseId, Q18_1, Q18_2, Q18_3, Q18_4, Q18_5, Q18_6, Q18_7, Q18_8, Q18_9, Q18_10, relevance_comp)
relevance_comp

relevance_data <- relevance_data %>%
  group_by(ResponseId) %>% 
  mutate(relevance_comp = mean(c(Q18_1, Q18_2, Q18_3, Q18_4, Q18_5, Q18_6, Q18_7, Q18_8, Q18_9, Q18_10), na.rm = T)) %>% 
  ungroup()

relevance_data <- relevance_data %>% 
  group_by(ResponseId) %>% 
  mutate(nars_total = sum(Q18_1, Q18_2, Q18_3, Q18_4, Q18_5, Q18_6, Q18_7, Q18_8, Q18_9, Q18_10),
         nars_comp = nars_total/10) %>% 
  ungroup()
____________________

relevance_plot <- relevance_data %>% 
  ggplot(aes(x = Condition, y = relevance_comp)) +
  labs(x = "Experimental Condition", y = "Mean Relavance Rating") +
  theme_cowplot()
relevance_plot +
  geom_point(position = "jitter")
relevance_plot + 
  geom_point(stat = "summary",
           fun.y = "mean")
relevance_plot + 
  geom_point(stat = "summary",
           fun.y = "mean",
           size = 4, 
           shape = 21,
           fill = "black") +
  ylim(0, 8) +
  stat_summary(fun.data="mean_cl_boot",geom="errorbar", width = .25)

relevance_plot_final <- relevance_plot + 
  stat_summary(fun.data="mean_cl_boot",geom="errorbar", width = .25) +
  geom_point(stat = "summary",
           fun.y = "mean",
           size = 4, 
           shape = 21,
           fill = "black") +
  ylim(0, 8)
relevance_plot_final
____________________

test_t_relevance <- relevance_data %>%
t.test(relevance_comp ~ Condition, ., alternative = "two.sided", var.equal = T)
test_t_relevance

____________________

experience_data <- dem_data2 %>% 
  dplyr::select(ResponseId, Q19_1, Q19_2, Q19_3, Q19_4, Q19_5, Q19_6, Q19_7, Q19_8, Q19_9, Q19_10, Q19_11, Q19_12, Q19_13, Q19_14, Condition) 
experience_data

experience_data <- experience_data
                    
experience_comp <- experience_data %>%
  group_by(ResponseId) %>% 
  mutate(experience_comp = mean(c(Q19_1, Q19_2, Q19_3, Q19_4, Q19_5, Q19_6, Q19_7, Q19_8, Q19_9, Q19_10, Q19_11, Q19_12, Q19_13, Q19_14), na.rm = T)) %>% 
  dplyr::select(ResponseId, Q19_1, Q19_2, Q19_3, Q19_4, Q19_5, Q19_6, Q19_7, Q19_8, Q19_9, Q19_10, Q19_11, Q19_12, Q19_13, Q19_14, experience_comp)
experience_comp

experience_data <- experience_data %>%
  group_by(ResponseId) %>% 
  mutate(experience_comp = mean(c(Q19_1, Q19_2, Q19_3, Q19_4, Q19_5, Q19_6, Q19_7, Q19_8, Q19_9, Q19_10, Q19_11, Q19_12, Q19_13, Q19_14), na.rm = T)) %>% 
  ungroup()


experience_data <- experience_data %>% 
  group_by(ResponseId) %>% 
  mutate(nars_total = sum(Q19_1, Q19_2, Q19_3, Q19_4, Q19_5, Q19_6, Q19_7, Q19_8, Q19_9, Q19_10, Q19_11, Q19_12, Q19_13, Q19_14),
         nars_comp = nars_total/14) %>% 
  ungroup()
____________________

experience_plot <- experience_data %>% 
  ggplot(aes(x = Condition, y = experience_comp)) +
  labs(x = "Experimental Condition", y = "Mean Writing Experience Rating") +
  theme_cowplot()
experience_plot +
  geom_point(position = "jitter")
experience_plot + 
  geom_point(stat = "summary",
           fun.y = "mean")
experience_plot + 
  geom_point(stat = "summary",
           fun.y = "mean",
           size = 4, 
           shape = 21,
           fill = "black") +
  ylim(0, 8) +
  stat_summary(fun.data="mean_cl_boot",geom="errorbar", width = .25)

experience_plot_final <- experience_plot + 
  stat_summary(fun.data="mean_cl_boot",geom="errorbar", width = .25) +
  geom_point(stat = "summary",
           fun.y = "mean",
           size = 4, 
           shape = 21,
           fill = "black") +
  ylim(0, 8)
experience_plot_final
____________________

test_t_experience <- experience_data %>%
t.test(experience_comp ~ Condition, ., alternative = "two.sided", var.equal = T)
test_t_experience

____________________
relevance_means <- dem_data2 %>% 
  dplyr::select(Q18_1, Q18_2, Q18_3, Q18_4, Q18_5, Q18_6, Q18_7, Q18_8, Q18_9, Q18_10, Condition)
relevance_means

relevance_means <- relevance_means

mean_test_tib <- relevance_means %>%
  dplyr::select(Q18_1, Q18_2, Q18_3, Q18_4, Q18_5, Q18_6, Q18_7, Q18_8, Q18_9, Q18_10) %>% 
  summarise_each(funs(min = min, 
                      q25 = quantile(., 0.25), 
                      median = median, 
                      q75 = quantile(., 0.75), 
                      max = max,
                      mean = mean, 
                      sd = sd))

mean_tib <- relevance_means %>%
  group_by(Condition) %>%
  dplyr::select(Q18_1, Q18_2, Q18_3, Q18_4, Q18_5, Q18_6, Q18_7, Q18_8, Q18_9, Q18_10) %>% 
  summarise_each(funs(mean = mean,
                      sd = sd))
mean_tib
____________________
final_plot_data <- structure(list(Condition = c("Non-Lyrical", "Lyrical"), Q18_1_mean = c(5.375, 
4.47826086956522), Q18_2_mean = c(5.15625, 4.43478260869565), 
    Q18_3_mean = c(4.59375, 3.8695652173913), Q18_4_mean = c(5.1875, 
    4.21739130434783), Q18_5_mean = c(5.46875, 4.65217391304348
    ), Q18_6_mean = c(4.78125, 3.95652173913043), Q18_7_mean = c(4.78125, 
    4.26086956521739), Q18_8_mean = c(5.78125, 5.43478260869565
    ), Q18_9_mean = c(5.46875, 5.73913043478261), Q18_10_mean = c(4.90625, 
    4.30434782608696), Q18_1_sd = c(0.975506485486286, 1.53355099560676
    ), Q18_2_sd = c(1.16700263979578, 1.53226175536575), Q18_3_sd = c(1.07341405894253, 
    1.57550418556574), Q18_4_sd = c(0.895778630487862, 1.59420888728064
    ), Q18_5_sd = c(1.10670609788542, 1.46500684615757), Q18_6_sd = c(1.15659051219661, 
    1.49174275352279), Q18_7_sd = c(1.15659051219661, 1.684620035507
    ), Q18_8_sd = c(1.00753211747415, 1.47173635721156), Q18_9_sd = c(1.50235030921982, 
    1.32175473258942), Q18_10_sd = c(0.856074122506811, 1.42811963493946
    )), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA, 
-2L))

final_plot_data %>%
  dplyr::select(c(
    "Condition", "Q18_1_mean", "Q18_2_mean", "Q18_3_mean", "Q18_4_mean", "Q18_5_mean", "Q18_6_mean", "Q18_7_mean", "Q18_8_mean","Q18_9_mean", "Q18_10_mean","Q18_1_sd", "Q18_2_sd", "Q18_3_sd",  "Q18_4_sd",  "Q18_5_sd",  "Q18_6_sd",  "Q18_7_sd",  "Q18_8_sd",  "Q18_9_sd",  "Q18_10_sd"
  )) %>%
  tidyr::pivot_longer(
    cols = -Condition,
    names_to = c("variable", ".value"),
    names_pattern = "(.*)_(.*)"
  ) %>%
  ggplot(aes(x = variable, y = mean, fill = Condition)) +
  geom_col(position = "dodge") +
  geom_errorbar(
    aes(ymin = mean - sd, ymax = mean + sd),
    width = 0.2,
    position = position_dodge(.9)
  ) + 
  ggplot2::scale_fill_grey() +
 labs(x = "Relevance Scale Questions", y = "Mean Relevance Rating") +
  theme_classic()
____________________
experience_means <- dem_data2 %>% 
  dplyr::select(Q19_1, Q19_2, Q19_3, Q19_4, Q19_5, Q19_6, Q19_7, Q19_8, Q19_9, Q19_10, Q19_11, Q19_12, Q19_13, Q19_14, Condition)
experience_means

experience_means <- experience_means

mean_test_tib2 <- experience_means %>%
  dplyr::select(Q19_1, Q19_2, Q19_3, Q19_4, Q19_5, Q19_6, Q19_7, Q19_8, Q19_9, Q19_10, Q19_11, Q19_12, Q19_13, Q19_14) %>% 
  summarise_each(funs(min = min, 
                      q25 = quantile(., 0.25), 
                      median = median, 
                      q75 = quantile(., 0.75), 
                      max = max,
                      mean = mean, 
                      sd = sd))

mean_tib2 <- experience_means %>%
  group_by(Condition) %>%
  dplyr::select(Q19_1, Q19_2, Q19_3, Q19_4, Q19_5, Q19_6, Q19_7, Q19_8, Q19_9, Q19_10, Q19_11, Q19_12, Q19_13, Q19_14) %>% 
  summarise_each(funs(mean = mean,
                      sd = sd))
mean_tib2
____________________
final_plot_data2 <- structure(list(Condition = c("Lyrical", "Non-Lyrical"), Q19_1_mean = c(5.34782608695652, 
5.09375), Q19_2_mean = c(4.52173913043478, 4.90625), Q19_3_mean = c(4.39130434782609, 
4.90625), Q19_4_mean = c(4.47826086956522, 4.90625), Q19_5_mean = c(4.82608695652174, 
5.09375), Q19_6_mean = c(5.17391304347826, 4.875), Q19_7_mean = c(4.82608695652174, 
4.84375), Q19_8_mean = c(5.08695652173913, 4.84375), Q19_9_mean = c(4.34782608695652, 
4.71875), Q19_10_mean = c(5.04347826086957, 5.21875), Q19_11_mean = c(4.43478260869565, 
4.78125), Q19_12_mean = c(3.69565217391304, 4.4375), Q19_13_mean = c(4.34782608695652, 
4.8125), Q19_14_mean = c(4.82608695652174, 4.6875), Q19_1_sd = c(1.33514369850296, 
0.962502618345831), Q19_2_sd = c(1.3097385310675, 1.11758307766531
), Q19_3_sd = c(1.52968001510662, 1.1460837947184), Q19_4_sd = c(1.3097385310675, 
1.25362377954678), Q19_5_sd = c(1.46635521905795, 1.25362377954678
), Q19_6_sd = c(1.11404969340133, 1.21150399730412), Q19_7_sd = c(1.37020814321446, 
1.27277636583154), Q19_8_sd = c(0.848155403763253, 1.43929586279026
), Q19_9_sd = c(1.40158013594313, 1.39664055458435), Q19_10_sd = c(1.29608714878021, 
1.15659051219661), Q19_11_sd = c(1.37596534564322, 1.33765261414503
), Q19_12_sd = c(1.25895998234819, 1.36635847560988), Q19_13_sd = c(1.79920931250303, 
1.35450264649237), Q19_14_sd = c(1.49703263804354, 1.55413081194768
)), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA, 
-2L))

final_plot_data2 %>%
  dplyr::select(c(
    "Condition", "Q19_1_mean", "Q19_2_mean", "Q19_3_mean", "Q19_4_mean", "Q19_5_mean", "Q19_6_mean", "Q19_7_mean", "Q19_8_mean","Q19_9_mean", "Q19_1_sd", "Q19_2_sd", "Q19_3_sd",  "Q19_4_sd",  "Q19_5_sd",  "Q19_6_sd",  "Q19_7_sd",  "Q19_8_sd",  "Q19_9_sd"
  )) %>%
  tidyr::pivot_longer(
    cols = -Condition,
    names_to = c("variable", ".value"),
    names_pattern = "(.*)_(.*)"
  ) %>%
  ggplot(aes(x = variable, y = mean, fill = Condition)) +
  geom_col(position = "dodge") +
  geom_errorbar(
    aes(ymin = mean - sd, ymax = mean + sd),
    width = 0.2,
    position = position_dodge(.9)
  ) + ggplot2::scale_fill_grey() +
   labs(x = "Writing Experience Questions (1-9)", y = "Mean Writing Experience Rating") +
  theme_classic()
____________________
ewvar <- c("Q18_1", "Q18_2", "Q18_3", "Q18_4", "Q18_5", "Q18_6", "Q18_7", "Q18_8", "Q18_9", "Q18_10")

Q18_items_tib <- dem_data2[ewvar]
  
Q18_items_tib  %>% dplyr::select(ewvar) %>% 
  correlation::correlation() %>%
  summary()
 
Q18_correlation <- Q18_items_tib %>% 
  dplyr::select(ewvar) %>%
  psych::cor.plot(upper = FALSE)
Q18_correlation

Q18_items_tib <- dem_data2[ewvar]
____________________

cronbach.alpha(Q18_items_tib)

cronbach.alpha(Q18_items_tib, CI=TRUE, standardized=TRUE)

____________________

I can't reproduce your file, and it is hard to know where the error happens

Is this the only information show ?

This comes probably from some part of your chunks that does not correctly parse. You could try reducing your document content to find the culprit.

It is quite specific to your document, so it is hard for some other people to help.

Also for formatting please see

FAQ: How to Format R Markdown Source

I solved the problem and actually I had used the same chunk name twice. Thank you for your help still!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.