I was unable to get help at school or with tech support for this code

Hi! Welcome!

Let me see if I’m understanding your situation correctly... You are taking a class that uses codio.com for interactive, auto-graded code exercises. You are having trouble getting your answer to an exercise into a format the auto-grader will accept. Is that right?

That’s a frustrating situation to be in! Unfortunately, people here may be limited in their ability to help — this is really a question best directed to your instructor or other class staff, since (presumably!) they know the specifics of how the exercises are set up.

Before going any further, you should review this community’s policy on homework questions: FAQ: Homework Policy

The best thing you can do here is to copy and paste both the exact code you ran, and the exact output you got (which is not accepted by the auto-grader). It sounds like the problem lies in structuring your list or vector in the way that’s expected. In case it helps, here are a few examples of the output from different list and vector structures:

# List with 4 elements, each a single number
list(1, 2, 3, 4)
#> [[1]]
#> [1] 1
#> 
#> [[2]]
#> [1] 2
#> 
#> [[3]]
#> [1] 3
#> 
#> [[4]]
#> [1] 4

# list with 1 element, a vector of 4 numbers
list(c(1, 2, 3, 4))
#> [[1]]
#> [1] 1 2 3 4

# named list with 4 elements, each a single number
list(one = 1, two = 2, three = 3, four = 4)
#> $one
#> [1] 1
#> 
#> $two
#> [1] 2
#> 
#> $three
#> [1] 3
#> 
#> $four
#> [1] 4

# vector of 4 numbers
c(1, 2, 3, 4)
#> [1] 1 2 3 4

# named vector of 4 numbers
c(one = 1, two = 2, three = 3, four = 4)
#>   one   two three  four 
#>     1     2     3     4 

I’ll say up front that it’s hard to know for sure how to advise on this problem without knowing exactly what you were instructed to do, but posting verbatim class assignment text is against the rules for this community, so please do not paste in instructions from your assignment.

2 Likes