Question
What is the Rcode and result in Rstudio

3. What is the difference between a vector and a list in R? What about the difference between a matrix and a dataframe in R? Without using R, provide the output from the following command in R: 16; d = array(c, dim = c(2,4, 2))an,2, 5. Explain the connection between z and y, where = qnorm(5); y = pnorm (0
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Vectors (one-dimensional array): can hold numeric, character or logical values. The elements in a vector all have the same data type.

A list in R allows you to gather a variety of objects under one name in an ordered way. These objects can be matrices, vectors, data frames, even other lists, etc.

It is not even required that these objects are related to each other in any way.

You could say that a list is some kind of super data type: you can store practically any piece of information in it.

4:

c=1:16;d=array(c,dim = c(2,4,2));d[1,2,2]

These are actually three steps

c=1:16

Here you are generating numbers from 1 to 16.

d=array(c,dim = c(2,4,2))

Now you are creating an array of these 16 numbers with 2 matrices of dimensions (4,2) that is 4 columns and two rows.

> d
, , 1

[,1] [,2] [,3] [,4]
[1,] 1 3 5 7
[2,] 2 4 6 8

, , 2

[,1] [,2] [,3] [,4]
[1,] 9 11 13 15
[2,] 10 12 14 16

In the third step d[1,2,2], you are calling the element from the second matrix in the second column and first row.

5)

They are both inverses of each other.

The function pnorm returns the integral from −∞ to q of the pdf of the normal distribution where q is a Z-score.

The qnorm function is simply the inverse of the CDF, which you can also think of as the inverse of pnorm!

Add a comment
Know the answer?
Add Answer to:
What is the Rcode and result in Rstudio 3. What is the difference between a vector...
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
  • What is the R code and result in Rstudio 1. The following data gives, for each...

    What is the R code and result in Rstudio 1. The following data gives, for each amount by which an elastic band is stretched over the end of a ruler, the distance that the band moved when released: stretch 46 54 48 50 44 4 52 distance 148 182 173166 109 141 166 Create a data frame in R with two columns that contain "stretch and "dis tance" respectively. Plot the distance versus the stretch using plot) function What trend...

  • What is the R code and result in Rstudio or R 1. Define a character vector...

    What is the R code and result in Rstudio or R 1. Define a character vector in R as follows: y - c("a, "bc", "def") a. Report the output of the following function: length(y);y"a;y"b" b. nchar(x) takes a character vector x as an argument and returns a vector whose elements contain the sizes of the corresponding elements of x. Report the output of nchar(y) 2. Define a numeric vector in R as follows: z=c(3,7,1,2) a. Report the output of the...

  • Problem 1. Consider the two data collections (x,..-, X) and (y,. ya). The median difference statistic...

    Problem 1. Consider the two data collections (x,..-, X) and (y,. ya). The median difference statistic is the median of the (v-x) differences for the mn possible (x, y.) pairings, i= 1, ..., mandj = 1, . . ., n. Construct two specific data collections (x,. Xm) and (y,. .. V) that demonstrate that the median difference statistic is not equal to the difference in the separate medians for the two collections Problem 2. A Venn diagram is a graphical...

  • Paste the R code for each exercise along with the answers. If: Age <- c(22, 25,...

    Paste the R code for each exercise along with the answers. If: Age <- c(22, 25, 18, 20) Name <- c("James", "Mathew", "Olivia", "Stella") Gender <- c("M", "M", "F", "F")       then what is the R-code for getting the following output: ##   Age   Name Gender ## 1 22 James      M ## 2 25 Mathew      M a. DataFrame = data.frame(c(Age), c(Name), c(Gender)) subset(DataFrame, Gender == "M") b. DataFrame = data.frame(c(Age),c(Name),c(Gender)) subset(Gender=="M"), eval=FALSE c. DataFrame = data.frame(Age,Name,Gender) subset(DataFrame,Gender=="M") d. DataFrame = data.frame(c(Age,Name,Gender))...

  • What Is the Difference Between Vector and Array Processing? in computer Architecture

    What Is the Difference Between Vector and Array Processing? in computer Architecture

  • Diagonal Difference HackerRank Pseudocode and C++: Given a square matrix, calculate the absolute difference between the...

    Diagonal Difference HackerRank Pseudocode and C++: Given a square matrix, calculate the absolute difference between the sums of its diagonals. Function Description Complete the diagonalDifference function described below to calculate the absolute difference between diagonal sums. diagonalDifference( integer: a_size_rows, integer: a_size_cols, integer array: arr) Parameters: a_size_rows: number of rows in array a_size_cols: number of columns in array a: array of integers to process Returns: integer value that was calculated Constraints -100 < = elements of the matrix < = 100...

  • what it is the difference between these commands? what command would I use to create an...

    what it is the difference between these commands? what command would I use to create an array that spans between 5 and 25 and is equispaced into four intervals? command 1: x= 5:5:25 command 2: x =linespace(5,25,4)

  • Problem 5 (25 points). Let Mat2x2(R) be the vector space of 2 x 2 matrices with...

    Problem 5 (25 points). Let Mat2x2(R) be the vector space of 2 x 2 matrices with real entries. Recall that (1 0.0 1.000.00 "100'00' (1 001) is the standard basis of Mat2x2(R). Define a transformation T : Mat2x2(R) + R2 by the rule la-36 c+ 3d - (1) (5 points) Show that T is linear. (2) (5 points) Compute the matrix of T with respect to the standard basis in Mat2x2 (R) and R”. Show your work. An answer with...

  • vector calculus. Do both please Q1: What, in your own words, is the difference between a partial derivative and a di...

    vector calculus. Do both please Q1: What, in your own words, is the difference between a partial derivative and a directional derivative? How are they similar? Give a particular example to illustrate your explanations (choose some function z=f(x,y)) Q2: Given a surface z= f(x,y), a point (x,yo) in the domain of f, and a unit vector i pointing some direction in the xy-plane, what does it mean if D,f(x,Y)=0? Be as specific as possible. Q1: What, in your own words,...

  • Need help with the trickle down This is the maxheap.h #ifndef MAXHEAP_H_INCLUDED #define MAXHEAP_H_INCLUDED #include <vector>...

    Need help with the trickle down This is the maxheap.h #ifndef MAXHEAP_H_INCLUDED #define MAXHEAP_H_INCLUDED #include <vector> #include <sstream> #include <string> #include <queue> #include <cmath> // pow() using namespace std; #define PARENT(i) ((i-1) / 2) #define LINE_WIDTH 60.0 template<class T> class MaxHeap{ // private: vector<T> heap; void bubbleUp(int id);    void Heapify() { int length = heap.size(); for(int i=length / 2 -1; i>=0; --i) trickleDown(i); }; public: MaxHeap( vector<T> &vector ) : heap(vector) { Heapify(); } ; MaxHeap() {}; void trickleDown(int...

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