Open StrikerG1 opened 1 year ago
I'm having this same issue. When I use ?"&&" it says this on the help page: "Using vectors of more than one element in && or || will give an error."
Not sure how other people have been getting past this.
I am having the same issue in RStudio 2023.060.1 Build 524 | R 4.3.1. Additionally, the "skip()" function does not work as it is supposed to skip a question - not the whole lesson.
> TRUE && c(TRUE, FALSE, FALSE)
Error in TRUE && c(TRUE, FALSE, FALSE) :
'length = 3' in coercion to 'logical(1)'
> info()
| When you are at the R prompt (>):
| -- Typing skip() allows you to skip the current question.
| -- Typing play() lets you experiment with R on your own; swirl will ignore what you do...
| -- UNTIL you type nxt() which will regain swirl's attention.
| -- Typing bye() causes swirl to exit. Your progress will be saved.
| -- Typing main() returns you to swirl's main menu.
| -- Typing info() displays these options again.
> skip()
Error in TRUE && c(TRUE, FALSE, FALSE) :
'length = 3' in coercion to 'logical(1)'
| Leaving swirl now. Type swirl() to resume.
Yeah. The error is caused when swirl tries to run the command it was expecting, giving swirl itself an error rather than just one in the console
I am having the same issue in RStudio 2023.060.1 Build 524 | R 4.3.1. Additionally, the "skip()" function does not work as it is supposed to skip a question - not the whole lesson.
> TRUE && c(TRUE, FALSE, FALSE) Error in TRUE && c(TRUE, FALSE, FALSE) : 'length = 3' in coercion to 'logical(1)' > info() | When you are at the R prompt (>): | -- Typing skip() allows you to skip the current question. | -- Typing play() lets you experiment with R on your own; swirl will ignore what you do... | -- UNTIL you type nxt() which will regain swirl's attention. | -- Typing bye() causes swirl to exit. Your progress will be saved. | -- Typing main() returns you to swirl's main menu. | -- Typing info() displays these options again. > skip() Error in TRUE && c(TRUE, FALSE, FALSE) : 'length = 3' in coercion to 'logical(1)' | Leaving swirl now. Type swirl() to resume.
I'm also having the same issue.
I wasn't about to finish the lesson.
I have put in a pull request to update the https://github.com/swirldev/swirl_courses/pull/527
Until this is merged you can either edit out the uestions in the .yaml file or copy my editted lesson. Learners may need to use a different name when loading swirl if they have already tried the lesson:
file_path <- file.path(find.package("swirl"),"Courses","R_Programming","Logic","lesson.yaml")
file_url <- "https://raw.githubusercontent.com/daniel-j-miller/swirl_courses/master/R_Programming/Logic/lesson.yaml"
download.file(file_url, file_path)
I went down the rabbit hole and found that the error is because the newer version of R limits the && function result length to 1, whereas I guess previously it did not. There are tickets in to resolve it.
But there is a second issue with skip()
:
skip()
is defined three different ways depending on the method used :
skip()
: 'skip the current unit of instruction.' ?skip()
-skip()
:'return to main menu' info()
printed menu-skip()
:'allows you to skip the current question'| When you are at the R prompt (>):
| -- Typing skip()
allows you to skip the current question.
| -- Typing play()
lets you experiment with R on your own; swirl will ignore what
| you do...
| -- UNTIL you type nxt()
which will regain swirl's attention.
| -- Typing bye()
causes swirl to exit. Your progress will be saved.
| -- Typing main()
returns you to swirl's main menu.
| -- Typing info()
displays these options again.
I have put in a pull request to update the https://github.com/swirldev/swirl_courses/pull/527
Until this is merged you can either edit out the uestions in the .yaml file or copy my editted lesson. Learners may need to use a different name when loading swirl if they have already tried the lesson:
create file path to swirl lesson file
file_path <- file.path(find.package("swirl"),"Courses","R_Programming","Logic","lesson.yaml")
url of my edited lesson file
file_url <- "https://raw.githubusercontent.com/daniel-j-miller/swirl_courses/master/R_Programming/Logic/lesson.yaml"
download and save file
download.file(file_url, file_path)
Worked great, thanks for the assist.
Only issue I had with it was the fact that I was using the R Programming E version that doesn't connect with Coursera. This required a minor tweak to the file_path to include the right folder as seen below.
file_path <- file.path(find.package("swirl"),"Courses","R_Programming_E","Logic","lesson.yaml")
The question: Now we'll type the same expression except we'll use the
&&
operator. Type the expression TRUE && c(TRUE, FALSE, FALSE).This expression raises an error in R, so you can't get the question to be correct. When you do skip(), Swirl runs the snippet of code for you, erroring out of Swirl. This makes it so you cannot complete the 'Logic' section of the swirl course in R