I am taking Microsoft's online Data Science programme. In one of the courses, I ran into an error with some code which I feel is logical and should work just fine. I'm using DataCamp's IDE.
Here is the question that I was asked (the variables were pre-created and I was to use them in my code. Unfortunately, I can't provide the data stored in the variables):-
Create a new list named key_skills, that contains three elements (in this order): - The second element of the
topicsvector inside theskillslist. - The second element of thecontextfactor inside theskillslist. - The last element of the logical vector inside thelist_infolist, that's insideskills.
This is my code for the question :-
key_skills <- list(
    skills$topics[2], 
    skills$context[2], 
    skills$list_info[length(skills$list_info)]
)
Why is the code incorrect? The code for the last element in the list key_skills was marked wrong. I believe it should work just fine.
EDIT : I looked up the variable in the IDE, the logical vector is the 2nd one inside skills$list_info, the correct code for the last part is skills$list_info[[2]][length(skills$list_info[[2]])]
Thank you everyone!
another solution : key_skills<- list(skills[[1]][2],skills[[2]][2],skills[[4]][[2]][4])
 
     
     
     
    