Skip to content

Instantly share code, notes, and snippets.

View akshat3096's full-sized avatar

Akshat arora akshat3096

View GitHub Profile
@akshat3096
akshat3096 / server.R
Last active November 19, 2019 07:07
Shiny Dashboard for Animated plots in R
library(ggplot2)
library(shiny)
library(gganimate)
library(XML)
library(lubridate)
library(tidyverse)
library(shinydashboard)
library(shinythemes)
install.packages("XML")
library(XML)
xml <- xmlParse("export.xml")
summary(xml)
#convert the XML object to data frame
df <- XML:::xmlAttrsToDataFrame(xml["//Record"])
sub_4<- train %>%
filter(.,no_of_trainings==2) %>%
select(.,department,education,gender,is_promoted)
head(sub_4)
library(tidyverse)
sub_3 <- train %>%
select(.,department,education,gender,is_promoted,no_of_trainings) %>%
filter(.,no_of_trainings==2)
head(sub_3)
sub_2 <- train[which(train$no_of_trainings == 2),names(train) %in%
c("department","education","gender","is_promoted")]
head(sub_2)
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)
# 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'))
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
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)]
x <- "AnaLytics VidHya 001"
str_to_lower(x)
str_to_upper(x)