Question

Question 1 1 pts If vv - list(a-1,b-2) why doesnt as.vector(vv) work to coerce vw to an atomic vector? Not applicable: The code returns an error. vv is already a vector atomic vectors cannot have named elements elements of an atomic vector must be of the same type. Question 2 2 pts Suppose ll<-list(a-1,b-c(2,3)). How do we replace the value 3 with the missing data code NA? 0 11[[2]][2] <-NA ﹁ ll <-as.na(II[[2]]) 0 ll[[22]] <-NA is.na([211) <-2Question3 1 pts If A is a matrix with 2 rows and 3 columns, and B is a matrix with 2 rows and 2 columns, what is the dimension (number of rows and columns) of cbind(A,B)? 5,2 Not applicable: The code returns an error 2,5 Question 4 1 pts If A is a matrix with 2 rows and 3 columns, and B is a matrix with 2 rows and 2 columns, what is the dimension (number of rows and columns) of rbind(A,B)? Not applicable: The code returns an error 2,5 5,2 Question 5 1 pts If we start with A<-matrix(c(1:4),nrow=2.ncol-2) and vv<-cl-10,10), and then make the assighment AlA 1]- vv, what is the order of replacements? vv1] is inserted into A12,1], then vvI2] into Al1,2], then wI1] into A12.2. [1] is inserted into Al1,2], then wl2] is inserted into A[2,1], then w1] is inserted into A[2,2] Not applicable: The code returns an error

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer 1

vv is already a vector

(option 2)

A list is implicitly still a vector. Thus, when you type in as.vector(vv), it remains a vector, and the data type does not change.

Answer 2

ll[[2]][2]= NA

(option 1)

When referencing to an element of a list, double square brackets have to be used. Thus, by typing this code we are saying that we need to change the 2nd element (by typing [2]) of the 2nd element of the list (by typing [[2]])

Answer 3

2,5

(option 3)

Since we are binding the matrices by columns, the number of rows of both the matrices must be the same (which they are, in our case). Thus, the combined matrix will have shape 2,5 (2 rows and 5 columns).

Answer 4

Not applicable: The code returns an error

(option 1)

The number of columns must be same to combine the matrices by rows (which they are not, in our case). Thus, the matrices cannot be combined.

Answer 5

vv[1] is inserted into A[2,1], then vv[2] into A[1,2], then vv[1] into A[2,2].

(option 1)

The elements of a matrix are modified column wise (down the columns). Thus, this is the correct answer.

If you have any doubts/ questions/ feedback related to any of the answers, please feel free to comment and I shall get back to you. Happy learning!

Add a comment
Know the answer?
Add Answer to:
Question 1 1 pts If vv - list(a-1,b-2) why doesn't as.vector(vv) work to coerce vw to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT