Reputation: 1
I'm using R 4.3.3 on VSCode 1.97.2. I'm using the extension R Extension Pack (Yuki Ueda) and R (REditorSupport).
My code snippets previously worked perfectly! Suddenly they were suddenly returning broken outputs. On review within the Terminal all lines are being truncated ($) resulting in errors.
The intention of this snippet is to convert character values in the original file (a. Noticed a clear reduction in my stress during the work shift.) into a numerical value which can be used with statistical analysis (1). Instead im getting a variable column with just NA values after running this snippet. This previously worked perfectly, then suddenly stopped working.
I've not found solutions in stackoverflow nor had any luck with other sources.
Below is the original snippet:
# Convert to categorical variables
qual_fractal_staff$Q12_1 <- factor(qual_fractal_staff$`Q12-1`, levels = c("Yes", "No", NA))
qual_fractal_staff$Q12_2 <- factor(qual_fractal_staff$`Q12-2`, levels = c("Yes", "No", NA))
qual_fractal_staff$Q12_3 <- factor(qual_fractal_staff$`Q12-3`, levels = c("Yes", "No", NA))
qual_fractal_staff$Q12_4 <- factor(qual_fractal_staff$`Q12-4`, levels = c("Yes", "No", NA))
qual_fractal_staff$Q12_5 <- factor(qual_fractal_staff$`Q12-5`, levels = c("Yes", "No", NA))
qual_fractal_staff$Q12_6 <- factor(qual_fractal_staff$`Q12-6`, levels = c("Yes", "No", NA))
qual_fractal_staff$Q12_7 <- factor(qual_fractal_staff$`Q12-7`, levels = c("Yes", "No", NA))
qual_fractal_staff$Q13 <- factor(qual_fractal_staff$Q13, levels = c("a) Very often", "b) Sometimes", "c) Rarely", "d) Not at all"))
qual_fractal_staff$Q14 <- factor(qual_fractal_staff$Q14, levels = c("a. Noticed a clear reduction in my stress during the work shift.",
"b. Noticed a slight reduction in my stress during the work shift.",
"c. Didn’t notice any particular impact on my stress during the work shift.",
"d. Noticed a slight increase of stress during my work shift.",
"e. Noticed a pronounced increase in stress during my work shift."))
# Summarise by mural_group.
qual_fractal_staff_summary <- qual_fractal_staff %>%
group_by(mural_group) %>%
summarize(
Q12_1_yes = sum(`Q12-1` == "Yes", na.rm = TRUE),
Q12_1_no = sum(`Q12-1` == "No", na.rm = TRUE),
Q12_2_yes = sum(`Q12-2` == "Yes", na.rm = TRUE),
Q12_2_no = sum(`Q12-2` == "No", na.rm = TRUE),
Q12_3_yes = sum(`Q12-3` == "Yes", na.rm = TRUE),
Q12_3_no = sum(`Q12-3` == "No", na.rm = TRUE),
Q12_4_yes = sum(`Q12-4` == "Yes", na.rm = TRUE),
Q12_4_no = sum(`Q12-4` == "No", na.rm = TRUE),
Q12_5_yes = sum(`Q12-5` == "Yes", na.rm = TRUE),
Q12_5_no = sum(`Q12-5` == "No", na.rm = TRUE),
Q12_6_yes = sum(`Q12-6` == "Yes", na.rm = TRUE),
Q12_6_no = sum(`Q12-6` == "No", na.rm = TRUE),
Q12_7_yes = sum(`Q12-7` == "Yes", na.rm = TRUE),
Q12_7_no = sum(`Q12-7` == "No", na.rm = TRUE),
Q13_a = sum(Q13 == "a) Very often", na.rm = TRUE),
Q13_b = sum(Q13 == "b) Sometimes", na.rm = TRUE),
Q13_c = sum(Q13 == "c) Rarely", na.rm = TRUE),
Q13_d = sum(Q13 == "d) Not at all", na.rm = TRUE),
Q14_a = sum(Q14 == "a. Noticed a clear reduction in my stress during the work shift.", na.rm = TRUE),
Q14_b = sum(Q14 == "b. Noticed a slight reduction in my stress during the work shift.", na.rm = TRUE),
Q14_c = sum(Q14 == "c. Didn’t notice any particular impact on my stress during the work shift.", na.rm = TRUE),
Q14_d = sum(Q14 == "d. Noticed a slight increase of stress during my work shift.", na.rm = TRUE),
Q14_e = sum(Q14 == "e. Noticed a pronounced increase in stress during my work shift.", na.rm = TRUE)
)
Below is the erroneous output in terminal:
> # Convert to categorical variables
>
> qual_fractal_staff$Q12_1 <- factor(qual_fractal_staff$`Q12-1`, levels = c("Y$
> qual_fractal_staff$Q12_2 <- factor(qual_fractal_staff$`Q12-2`, levels = c("Y$
> qual_fractal_staff$Q12_3 <- factor(qual_fractal_staff$`Q12-3`, levels = c("Y$
> qual_fractal_staff$Q12_4 <- factor(qual_fractal_staff$`Q12-4`, levels = c("Y$
> qual_fractal_staff$Q12_5 <- factor(qual_fractal_staff$`Q12-5`, levels = c("Y$
> qual_fractal_staff$Q12_6 <- factor(qual_fractal_staff$`Q12-6`, levels = c("Y$
> qual_fractal_staff$Q12_7 <- factor(qual_fractal_staff$`Q12-7`, levels = c("Y$
> qual_fractal_staff$Q13 <- factor(qual_fractal_staff$Q13, levels = c("a) Very$
> qual_fractal_staff$Q14 <- factor(qual_fractal_staff$Q14, levels = c("a. Noti$
+ "b. Not$
+ "c. Did$
+ "d. Not$
+ "e. Not$
>
>
> # Summarise by mural_group.
>
> qual_fractal_staff_summary <- qual_fractal_staff %>%
+ group_by(mural_group) %>%
+ summarize(
+ Q12_1_yes = sum(`Q12-1` == "Yes", na.rm = TRUE),
+ Q12_1_no = sum(`Q12-1` == "No", na.rm = TRUE),
+ Q12_2_yes = sum(`Q12-2` == "Yes", na.rm = TRUE),
+ Q12_2_no = sum(`Q12-2` == "No", na.rm = TRUE),
+ Q12_3_yes = sum(`Q12-3` == "Yes", na.rm = TRUE),
+ Q12_3_no = sum(`Q12-3` == "No", na.rm = TRUE),
+ Q12_4_yes = sum(`Q12-4` == "Yes", na.rm = TRUE),
+ Q12_4_no = sum(`Q12-4` == "No", na.rm = TRUE),
+ Q12_5_yes = sum(`Q12-5` == "Yes", na.rm = TRUE),
+ Q12_5_no = sum(`Q12-5` == "No", na.rm = TRUE),
+ Q12_6_yes = sum(`Q12-6` == "Yes", na.rm = TRUE),
+ Q12_6_no = sum(`Q12-6` == "No", na.rm = TRUE),
+ Q12_7_yes = sum(`Q12-7` == "Yes", na.rm = TRUE),
+ Q12_7_no = sum(`Q12-7` == "No", na.rm = TRUE),
+ Q13_a = sum(Q13 == "a) Very often", na.rm = TRUE),
+ Q13_b = sum(Q13 == "b) Sometimes", na.rm = TRUE),
+ Q13_c = sum(Q13 == "c) Rarely", na.rm = TRUE),
+ Q13_d = sum(Q13 == "d) Not at all", na.rm = TRUE),
+ Q14_a = sum(Q14 == "a. Noticed a clear reduction in my stress during the$
+ Q14_b = sum(Q14 == "b. Noticed a slight reduction in my stress during th$
+ Q14_c = sum(Q14 == "c. Didn’t notice any particular impact on my stress $
+ Q14_d = sum(Q14 == "d. Noticed a slight increase of stress during my wor$
+ Q14_e = sum(Q14 == "e. Noticed a pronounced increase in stress during my$
+ )
>
What I've tried
I have updated all extensions I have tried toggling r.bracketedPaste and r.alwaysUseActiveTerminal without luck. I've disabled Quarto.Currently active extensions include:
Any ideas if the issue arises from VSCode itself or perhaps the extensions? Thank you!
Upvotes: 0
Views: 25