Closed LizzetDRojas closed 2 years ago
Hi Lizzet. Yes you are correct. Essentially element means larger part of a whole. So yes vectors and lists have elements. For example if I have a vector x <- (1, 2, 3, 4). It's elements would be 1, 2, 3, 4. And the columns/variables are elements of a data frame.
Your code for 3.3.1 is correct because you want the first element of your list which would be the set of numbers [1:3].
For your first problem, I don't think you need to run the header, but I had issues knitting. Brianna helped me out and suggested add ":" after the PDF (header), and I was able to knit the document. Hope this helps.
This problem set was very helpful for getting more comfortable with investigating objects, subsetting, and practicing setting up syntax in general. I did have two questions though.
For Problem 1 Did anyone else have trouble with adding the table of contents and section numbering to sub-headers or got error messages in this title section before we get to the other problems for the week? I read the R Markdown Section 3.3. from the hyperlink, but when I run everything from the title to the syntax I added for the table of contents and numbering sections, I'm getting an error for every single line of code - with the lines on title, name, and date giving me error messages stating "NA/NaN argument" and for the output_pdf, toc, toc_depth, and number_sections lines, I'm getting error messages that these "objects not found". Last week running the code for the title section didn't give me any problems, and I'm thus not sure how to troubleshoot this.
For Problem 3.3.1 (Return the 1st element of the list
list
using[]
) I ran "list[1]" to get the "(1:3)" part of the list, but just wanted to verify if that's the "element" referred to in this question. I'm having trouble differentiating element vs. atomic vectors. The way I understood the distinction from the first lecture, in thinking about the list from this example, this list consists of 3 atomic vectors within the list [e.g. (1:3), ("red", "orange"), and ("LA", "NY", "DC")] , and what's in these vectors are the elements (so for example, for the first one, the elements are 1, 2, and 3). However, in the second lecture, the instructions for how to subset a list refer to extracting elements from the list, with the examples pulling what I understood to be the atomic vectors. Thus, I'm assuming elements could refer to the elements within vectors but also to the vectors within lists, is that correct? For the code I used, I pulled the first atomic vector (with elements 1, 2, 3) from the list. Not sure if that is the intent of the question, or if I'm supposed to be trying to pull "1" from the first atomic vector (1:3).@@ozanj, @briannawright135, @lizachavac, @anyone-can-cook/skl