View server.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
library(shiny) | |
library(gganimate) | |
library(XML) | |
library(lubridate) | |
library(tidyverse) | |
library(shinydashboard) | |
library(shinythemes) | |
View dataframe4.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub_4<- train %>% | |
filter(.,no_of_trainings==2) %>% | |
select(.,department,education,gender,is_promoted) | |
head(sub_4) |
View dataframe3.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
sub_3 <- train %>% | |
select(.,department,education,gender,is_promoted,no_of_trainings) %>% | |
filter(.,no_of_trainings==2) | |
head(sub_3) |
View dataframe2.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub_2 <- train[which(train$no_of_trainings == 2),names(train) %in% | |
c("department","education","gender","is_promoted")] | |
head(sub_2) |
View dataframe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
train <- read.csv("~/Analytics Vidhya/HR analytics/train_LZdllcl.csv", header=T) | |
head(train) | |
#subset first few rows and columns | |
sub <- train[1:5000,1:6] | |
head(sub) |
View matrix_2.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# assign column names | |
colnames(x) <- c("A", "B", "C") | |
x | |
#subset using the names | |
x[,c('A')] | |
#using the subset function | |
subset(x,select=c('A')) |
View matrix.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x <- matrix(1:6,nrow=2,ncol=3) | |
x | |
#selecting an element | |
x[1,1] | |
#selecting just one row | |
x[2,] | |
# selecting one or more columns |
View atomic_vector.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x <-c(10,12,23,45,84,25,15,56,09) | |
#selecting one element | |
x[1] | |
#selecting multiple elements | |
x[c(3,9)] | |
#dropping certain elements | |
x[-c(1,2)] |
View spread.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data<- data.frame(variable1 = rep(LETTERS[1:3], each = 3), | |
variable2 = rep(paste0("factor", c(1, 2, 3)), 3), | |
num = 1:9) | |
head(data) | |
spread(data,variable2,num) | |
View stringr_3.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x <- "AnaLytics VidHya 001" | |
str_to_lower(x) | |
str_to_upper(x) |
NewerOlder