Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Write R code to convert a list lst into a single vector. lst

1. Write R code to convert a list lst into a single vector.

lst <- list(c(1,2,3),c(6,7,10))

2. write R code to create a list that contains three vectors (each vector of length 5) that satisfy the following:

a. each entry in first vector is random number between 0 and 10.

b. each entry in second vector is random number between 10 and 20.

c. each entry in third vector is random number between 20 and 30.

3. x <- list(y=1:10, t="Hello", f="TT", r=5:20)

write an R statement that will give the sum of all items of vector r of list x.

4. b <- list(a=1:10, c="Hello", d="AA"),

write an R expression that will give all elements, except the second element, of the first vector of list b. (the result should be a vector (1,3,4,5,6,7,8,9,10) )

5. write R code to create a matrix (3 rows and 4 columns) that looks like this:

10 -10 10 -10
10 -10 10 -10
10 -10 10 -10

6. write R code to create a matrix (10 rows and 3 columns) that satisfies the following:

  • each entry in column #1 is random number between 0 and 10
  • each entry in column #2 is random number between 10 and 20
  • each entry in column #3 is randoml number between 20 and 30

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

1. Write R code to convert a list lst into a single vector. lst

Answered: 1 week ago

Question

Explain methods of metal extraction with examples.

Answered: 1 week ago