Skip to content

Instantly share code, notes, and snippets.

Avatar

Akshat arora akshat3096

View GitHub Profile
@akshat3096
akshat3096 / server.R
Last active Nov 19, 2019
Shiny Dashboard for Animated plots in R
View server.R
library(ggplot2)
library(shiny)
library(gganimate)
library(XML)
library(lubridate)
library(tidyverse)
library(shinydashboard)
library(shinythemes)
View dataframe4.R
sub_4<- train %>%
filter(.,no_of_trainings==2) %>%
select(.,department,education,gender,is_promoted)
head(sub_4)
View dataframe3.R
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
sub_2 <- train[which(train$no_of_trainings == 2),names(train) %in%
c("department","education","gender","is_promoted")]
head(sub_2)
View dataframe
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
# 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
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
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
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
x <- "AnaLytics VidHya 001"
str_to_lower(x)
str_to_upper(x)