Md Faisal Akbar
by Md Faisal Akbar

Tags

  • code
  • syntax highlighting

Syntax highlighting is a feature that displays source code, in different colors and fonts according to the category of terms. This feature facilitates writing in a structured language such as a programming language or a markup language as both structures and syntax errors are visually distinct. Highlighting does not affect the meaning of the text itself; it is intended only for human readers.[^1]

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
getwd()

setwd("D://Data Science//R//Mine//R Programming Advanced Analytics//SECTION 3. List in R")

#MAC:
#setwd("/Users/Faisal/Desktop/")
getwd()

util <- read.csv("Machine-Utilization.csv")
head(util,12)
str(util)
summary(util)

summary(util)
            Timestamp    Machine     Percent.Idle   
 01/09/2016 00:00:   5   RL1 :720   Min.   :0.0000  
 01/09/2016 01:00:   5   RL2 :720   1st Qu.:0.0262  
 01/09/2016 02:00:   5   SR1 :720   Median :0.0410  
 01/09/2016 03:00:   5   SR4A:720   Mean   :0.0431  
 01/09/2016 04:00:   5   SR6 :720   3rd Qu.:0.0576  
 01/09/2016 05:00:   5              Max.   :0.1508  
 (Other)         :3570              NA's   :361  

#Derive utilization column
util$Utilization = 1 - util$Percent.Idle
head(util,12)

#Handling Date-Time In R (American or Europian)
tail(util)

?POSIXct

util$PosixTime <- as.POSIXct(util$Timestamp, format="%d/%m/%Y %H:%M")
head(util,12)
summary((util))

#Tip: how to rearrange columns in a df:
util$Timestamp <- NULL
head(util,12)
util <- util[,c(4,1,2,3)] #rearrange
head(util,12)

GitHub Gist Embed

GitHub Gist embeds can also be used: