Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(Data science and visualisation) Write the following syntax in one script using comments to indicate the question number and turn in your script to the

(Data science and visualisation)

Write the following syntax in one script using comments to indicate the question number and turn in your script to the drop box.

  1. Define two vectors, a and b, where a=(3, 15, 22, 17) and b=(2, 3). Conduct the following operations and report what you observe as a result:
  1. a*b
  2. ab
  3. a+b

  1. In a social survey, there is one variable marital status with 4 elements: single, married, divorced, and widow
  1. Create a character vector named marital_status with the above 4 elements
  2. Convert the character vector in a) to a factor
  3. Convert the factor in b) to a numeric vector

  1. a) Create a matrix B

3 4 5 7

-2 6 8 10

12 -3 7 6

b) Show the second column of the matrix

c) Show the element on the first row second column

  1. a) Create a data frame

ID

Gender

Age

Diastolic blood pressure

Systolic Blood Pressure

Temperature

A

Male

55

90

130

98.5

B

Female

42

80

111

99.0

C

Male

39

79

115

98.7

b) Add a row where ID=D, Gender=Female, Age=60, DBP=101, SBP=135, Temperature=98.3

c) Add a column named as weight with the values of (155, 121, 147, 112) to the data frame with that row in b) added

d) Find the mean temperature of all four individuals

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_2

Step: 3

blur-text-image_3

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

Database Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

Students also viewed these Databases questions

Question

Express each of the following as a percent. 0.0225

Answered: 1 week ago

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago