It may be hard at first to interpret the error messages you will encounter on Dodona. You can find the most common error messages and their meaning in this chapter.
In exercise 2.5.1 we ask to store the column names of the murders dataframe in question1
. Submitting the following code where we mistype murders
### loading data ###
library(dslabs)
data(murders)
### question 1 ###
question1 <- names(muders)
Will return the following error
Error while evaluating context: object `muders` not found
Meaning Dodona can not find the object muders
as it does not exist.
This message can also be returned when you are trying to access columns of a dataframe inside a tidyverse function such as mutate()
or filter()
. Take for example the example code from 4.2.1-3: The correct column name is population
, but here we wrote populations
.
library(dplyr)
library(dslabs)
data(murders)
murders <- mutate(murders, population_in_millions = populations / 10^6)
Inside tidyverse functions like mutate
R will look for a column named populations
, as it does not exist it cannot find it. It will then look if there is an object with that name, there is none. Therefore Dodona returns the following error
Error while evaluating context: Problem with `mutate()` column `population_in_millions`. ℹ `population_in_millions = populations/10^6`. ✖ object 'populations' not found
A common mistake is to write a certain character more than needed, for example a )
too much after a function. Or forgetting to close a for loop
. Submitting the following code:
group_iq <- function(n){
mean(rnorm(n, 100, 15))
}}
Will return the error
Error while evaluating context: <text>:3:2: unexpected '}' 2: mean(rnorm(n, 100, 15)) 3: }} ^
This actually tells you all you need. After
It might not always be as obvious where the error is. If we submit the following code, where we didn’t close our mean
and rnorm
function.
group_iq <- function(n){
mean(rnorm(n, 100, 15
}
We get the same error.
Error while evaluating context: <text>:3:1: unexpected '}' 2: mean(rnorm(n, 100, 15 3: } ^
It still tells us that there is an unexpected }
at line 3 character 1. However this is not what our mistake is. Because we did not close the round brackets from mean
and rnorm
R will continue reading the code. Only when R reads }
on line 3 it returns the error.
https://dodona.ugent.be/en/submissions/8439221/1
non-numeric argument to binary operator
Forgetting to save your object will return a runtime error. Unfortunately this wil return different errors depending on how it is evaluated.
It can tell you which variable you did not save
Variable "question1 " not found
It can also return nothing or NULL
When evaluating dataframes it will often return the name of the variable it can’t find together with argument 1 is not a vector
.
Something in your code is slowing the program down considerably. This will often be caused by inefficiënt for loops or while loops that don’t stop.