Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Explain output of each line using R studio code. Problem 1. Explain what each line of the following R code do? You can run them

Explain output of each line using R studio code.
image text in transcribed
image text in transcribed
Problem 1. Explain what each line of the following R code do? You can run them in R and check the results. (a) x + c(1.2.3, 2, 3, 4, 8, 12, 43, -4,-1) (b) max(x) (c) y + c(x, NA) (d) max(y, nam = T) (e) x2 + c(-100,-43,0,3,1, -3) and min(x.x2) (f) sample(4:10) (s) sample(c(2.5,3), size=3, replace=FALSE) (h) sample(c(2,5.3), size=3, replace= TRUE) (i) sample(2, 10, replace = TRUE) (what happens when you write "replace = FALSE"?) () sample(1:2, size=10, prob=c(1,3), replace=TRUE) (k) round(3.14159, digits = 2) (1) range(100:400) (m) matrix(c(1.2.3, 2, 3, 4, 8, 12, 43.-4.-1,9,14), nr=3, nc=4) (n) matrix(c(1.2.3.2, 3, 4, 8, 12, 43, -4,-1,9,14), nr=3, nc=4, byrow = T) (o) - matrix(c(4.3.4,6,7,6),3,2), rownames(x) + c("rowl", "row2", "row 3"), colnames(x) = c("coll", "col2") (9) x +rbind(c(1:4),c(5,8)), y cbind(c(1:4),c(5,8)) (P) y + 1:9, w 2:10, 2 3:5, and rbind(y,w.z). (r) Let m matrix(1:36,9,4). Check m[2,3] m3] m2. cbind(m[3]) m[-(3:8) 2:4). (8) Let x + cbind(xl = 3, x2 = c(4:1, 2:5)). Check diminames(x)[(1) letters 1:8] apply(x, 2, mean, trim = 2) col.sums apply(x, 2. sum) row.sums apply(x, 1, sum) apply(x, 2. sort)

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

Recommended Textbook for

Practical Neo4j

Authors: Gregory Jordan

1st Edition

1484200225, 9781484200223

More Books

Students also viewed these Databases questions

Question

Explain the importance of prioritizing training and HRD needs

Answered: 1 week ago

Question

2. The model is credible to the trainees.

Answered: 1 week ago