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


#1
#Create a new Rscript named Challenge31L.R and save it
install.packages('ISLR)
library(ISLR)
data(Default)

okay, that part worked. I was then to create and print a list. This was Credit data this is the code I wrote. Codio doesn't give a hint at to what is wrong with it.

nrow(Default)
ncol(Default)
head(Default)
tail(Default)
summary(Default)
lstCreditDefaultLst <- list(nrow(Default), ncol(Default), head(Default), tail(Default), summary(Default))
print(CreditDefaultLst)

The instructions to write the code were in a list-exactly like I wrote it. I wrote lstCreditDefaultLst and then print. The only difference seems to be in my output:

[1] a number
[1] a number

In Codio it should be:

[1] a number
[2] a number

I have no idea how to change that.


#2

You have an unpaired quote in this line. On new projects, you might try a line at a time to localize where a problem might be.


#3

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.


#4

you never created an object called CreditDefaultLst... where'd that come from?


#5

There was a line that said CreditDefaultLst<-list(nrow(Default))
I actually ended up giving up. I followed Codio's instructions and nothing worked.


#6

Actually that was a typo here. I was able to install the package. What I finally realized is that the data(Default) was what I needed to be working with. Still got an error in the end. Gave up.


#7

I did, I'll be posting another question. A question about how to do something and how to find a "guide" to R. The help button in Codio doesn't "help".