i'm working through hands-on programming r. reason setup runtime function doesn't throws error.
specifically:
error: unexpected '}' in "}"
here code:
# create safe runtime environment setup <- functon(deck){ # store prestine copy deck <- deck # deal card function deal <- function(){ card <- deck[1, ] assign("deck", deck[-1, ], envir = globalenv()) card } # shuffle deck function shuffle <- function(){ random <- sample(1:52, size = 52) assign("deck", deck[random, ], envir = globalenv()) } }
i using 4 spaces tabs. braces matched? going on?
edit:
flagged closed.
you misspelled ´function´ @ beginning of code.
you wrote functon
, should write function
in setup <- functon(deck){...