Question: (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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!