knitr::opts_chunk$set(echo = TRUE)
install.packages("shinyr") library(shinyr)
library(shinyr) shinyr::shineMe()
valid_sets() will give all the data sets that are available in the data frame
library(shinyr) dsets <- shinyr::valid_sets() knitr::kable(dsets)
In case you want to load any data sets from the list of datasets from return of valis_sets() function you can use base::get() function to load the data sets. this will help you to choose on data sets to load dynamycally in any program.
dsets$Item <- as.character(dsets$Item) mtcars <- get(dsets$Item[dsets$Item == "mtcars"]) knitr::kable(head(mtcars))
To figure the class of each column in the given data frame use getnumericcols() it return the column names which are numeric
getnumericCols(mtcars)
to split paragraph or sentence to induvidial words use splitAndGet(), it returns the list of induvidual words in the given input which can be later used by getFeqTable()
splitAndGet("**shinyr** is developed to build dynamic shiny based dashboards to analyze the data of your choice. It provides simple yet genius dashboard design to subset the data, perform exploratory analysis and predictive analysis by means of")
getFeqTable will be used on the output of spliAndGet() to get the frequency of each word, which will be used by getWordCloud
x <- getFeqTable("shinyr is developed to build dynamic shiny based dashboards to analyze the data of your choice. It provides simple yet genius dashboard design to subset the data, perform exploratory analysis and predictive analysis by means of") knitr::kable(x)
Use getWordCloud() to plot word cloud.
getWordCloud(x)
getDataInsights() takes data frame as an input and returns the basic insights such as class, number of values missing, maximum, min, var, sd, mean, median, unique items for each column.
res <- getDataInsight(mtcars) knitr::kable(res$Types)
getDataInsight() also calculates the correlation table for the given data frame.
knitr::kable(res$cor_matrix)
You can use corrplot::corrplot() on correlation table to get the correlation table.
corrplot::corrplot(as.matrix(res$cor_matrix),method = "number")
This function was developed to eliminate few items from the list of items for any reason.
excludeThese(mtcars$mpg, c(21.0))
You can find out most repeated values in the given set of values.
getMostRepeatedValue(c(1,1,1,2,2,3,4,5))
missing count will calculate the total number of NA, NULL, "", "NULL", "NA" s in a given set of values. lets introduce some missing values to mtcars
x <- head(mtcars) x$mpg[1:2] <- NA
missing_count(x$mpg)
You can replace the missing values in any column of given data frame with one of mean, median, max, and min, sum and mode by using ImputeMydata(). for example you can impute the missing values in the mpg column by mean of all the values in the column as shown below.
imputeMyData(df = x, col = "mpg", FUN = "mean")
You can summarize the values of one column by grouping the values in the other column using groupByandSummarize(). For example you can calculate mean of hp by am.
knitr::kable(groupByandSumarize(mtcars, grp_col = c("am"), summarise_col = "hp", FUN = "mean"))
You can split a given data set into training set and test set by using datapartition(), you can specify the percentage to specify the size of trainset. For example you can split mtcars into 85 percent to train and 15 to test as shown below.
partition <- dataPartition(mtcars, 85)
partition is a list of length 2, which contains test and train sets.
knitr::kable(head(partition$Train))
knitr::kable(head(partition$Test))
mod <- lm(formula = wt ~ ., data = mtcars) mod
predictions <- predict(mod, mtcars[,-6])
get the metrics of regression model by using regressionModelmMetrics()
actials <- mtcars[,6] x <- regressionModelMetrics(actuals = actials, predictions = predictions, model = mod) y <- as.data.frame(x) row.names(y) <- NULL knitr::kable(y)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.