Lab 4 Activity Activity4 Lab4 Instructions

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 1

DownloadLab 4 - Activity Activity4 Lab4 Instructions
Open PDF In BrowserView PDF
Lab 4 - Activity
Oleksandr Savenkov
10/3/2018
1. Write a function that normalizes a vector (with two parameters) :
• vector to be normalized
• parameter that allows normalize the vector in two ways: only centered with zero mean and also
standardize with mean zero and standard deviation 1
Example:
• input (1, 2, 3, 4)
• centered vector is
standardize(a, centered_only = TRUE)
## [1] -1.5 -0.5

0.5

1.5

• standardized is
standardize(a, centered_only = FALSE)
## [1] -1.1618950 -0.3872983

0.3872983

1.1618950

2. Modify previous function in order to handle missing values in a vector
standardize(c(1, 2, 3, 4, NA))
## [1] NA NA NA NA NA
standardize(c(1, 2, 3, 4, NA), na.rm = TRUE)
## [1] -1.1618950 -0.3872983

0.3872983

1.1618950

NA

2. Create a 4 by 4 matrix
##
##
##
##
##

[1,]
[2,]
[3,]
[4,]

[,1] [,2] [,3] [,4]
1
5
9
13
2
6
10
14
3
7
11
15
4
8
12
16

Create a function to calculate sum of matrix elements without built-in function sum()

1



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.5
Linearized                      : No
Page Count                      : 1
Page Mode                       : UseOutlines
Author                          : Oleksandr Savenkov
Title                           : Lab 4 - Activity
Subject                         : 
Creator                         : LaTeX with hyperref package
Producer                        : pdfTeX-1.40.19
Create Date                     : 2018:10:03 13:57:17-04:00
Modify Date                     : 2018:10:03 13:57:17-04:00
Trapped                         : False
PTEX Fullbanner                 : This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) kpathsea version 6.3.0
EXIF Metadata provided by EXIF.tools

Navigation menu