You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This should probably not give an warning and this should be fixed in the test suite instead?.
Hi Mans,
So the problem was noticed by the students in lab2 with the function
while_mult_table()
Example code:
while_mult_table <- function(from, to) {
i <- 0
vect <- from:to
temp <- c()
range <- length(vect)
while (i < range) {
i <- i + 1
start_pos <- range * (i - 1) + 1
end_pos <- range * i
temp[start_pos:end_pos] <-
vect * sort(vect[i], decreasing = FALSE)
}
mat_final <- matrix(temp, nrow = range, ncol = range)
colnames(mat_final) <- sort(vect, decreasing = FALSE)
rownames(mat_final) <- sort(vect, decreasing = FALSE)
return(mat_final)
}
When I run mark_my_assignment on this I get the warnings:
Warnings
Assignment: while_mult_table() (@test-while_mult_table-1.R#39) -
numerical expression has 3 elements: only the first used
Assignment: while_mult_table() (@test-while_mult_table-1.R#39) - NAs
introduced by coercion
Failed
as it should. Students who installed the latest version (next to me by
install.packages(), so I guess from CRAN) do not observe this warning at
all.
What is also interesting is that if from:to is replaced by seq(from,to)
then students' code throws an error that markmyassignment correctly
considers as an error thrown (but I do not know if there is any way of
automatically making sure input is checked)?
Cheers
Krzysztof
The text was updated successfully, but these errors were encountered:
This should probably not give an warning and this should be fixed in the test suite instead?.
Hi Mans,
So the problem was noticed by the students in lab2 with the function
while_mult_table()
Example code:
while_mult_table <- function(from, to) {
i <- 0
vect <- from:to
temp <- c()
range <- length(vect)
while (i < range) {
i <- i + 1
start_pos <- range * (i - 1) + 1
end_pos <- range * i
temp[start_pos:end_pos] <-
vect * sort(vect[i], decreasing = FALSE)
}
mat_final <- matrix(temp, nrow = range, ncol = range)
colnames(mat_final) <- sort(vect, decreasing = FALSE)
rownames(mat_final) <- sort(vect, decreasing = FALSE)
return(mat_final)
}
When I run mark_my_assignment on this I get the warnings:
Warnings
numerical expression has 3 elements: only the first used
introduced by coercion
Failed
as it should. Students who installed the latest version (next to me by
install.packages(), so I guess from CRAN) do not observe this warning at
all.
What is also interesting is that if from:to is replaced by seq(from,to)
then students' code throws an error that markmyassignment correctly
considers as an error thrown (but I do not know if there is any way of
automatically making sure input is checked)?
Cheers
Krzysztof
The text was updated successfully, but these errors were encountered: