While the main purpose of the alexandershemetev package is to clarify working with R for people with very basic skills for the purposes of qualitative statistical analysis, this package also has additional useful functions and will be developed over time by adding new functions.
To see what alexandershemetev has to offer, let’s take a quick tour. For more detailed guidance on how to use a specific function presented below, take a look at the respective function’s help page.
is designed for helping to newcomers in R
with \the most basic functions
to match the purposes of their statistical analysis. For this walk-through I will use the data set mtcars, which comes with the basic R environment.
alex_hello()
#> [1] "Hello, Dear User!"
alex_dataframe_descriptive_table(mtcars, showdf = TRUE, showhtmlinR = TRUE)
#> Loading required package: plyr
#> Loading required package: dplyr
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:plyr':
#>
#> arrange, count, desc, failwith, id, mutate, rename, summarise,
#> summarize
#> The following objects are masked from 'package:plm':
#>
#> between, lag, lead
#> The following object is masked from 'package:kableExtra':
#>
#> group_rows
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
#> Loading required package: htmltools
#> Loading required package: pander
#> Warning: package 'pander' was built under R version 4.0.2
#>
#> Attaching package: 'pander'
#> The following object is masked from 'package:htmltools':
#>
#> p
#> Loading required package: writexl
#> [1] "Library knitr is prepared; Starting to process your data: "
#> [1] "Your final output knitr_kable object name is t1_12_28_90 in your global R environment - you may use it later: "
#> [1] "Your final .html file with descriptive statistics is saved to: C:/Users/Alex/Documents/NewRPackage/alexandershemetev/alexandershemetev/vignettes/my_html_descr_table.html.html"
#> [1] "Trying opening your output descriptive statistics data in your browser from the saved file to your system: "
#> [1] "The new dataframe object t1_12_28_90_df with your descriptive table is set to your R global environment; it looks like this: "
#> [1] "As requested by the user (same is by default), Excel file would be created if no such file would exist at: C:/Users/Alex/Documents/NewRPackage/alexandershemetev/alexandershemetev/vignettes/my_html_descr_tablehtml.xlsx. Please use the file you have or delete the previous version of the file manually (R suggests maybe some important info may be in your file - that is why it was not removed)."
12_28_90_df
t1_#> Nobs Mean Std.dev. Min. 25 % Median 75 % Max.
#> mpg 32 20.090625 6.0269481 10.400 15.42500 19.200 22.80 33.900
#> cyl 32 6.187500 1.7859216 4.000 4.00000 6.000 8.00 8.000
#> disp 32 230.721875 123.9386938 71.100 120.82500 196.300 326.00 472.000
#> hp 32 146.687500 68.5628685 52.000 96.50000 123.000 180.00 335.000
#> drat 32 3.596563 0.5346787 2.760 3.08000 3.695 3.92 4.930
#> wt 32 3.217250 0.9784574 1.513 2.58125 3.325 3.61 5.424
#> qsec 32 17.848750 1.7869432 14.500 16.89250 17.710 18.90 22.900
#> vs 32 0.437500 0.5040161 0.000 0.00000 0.000 1.00 1.000
#> am 32 0.406250 0.4989909 0.000 0.00000 0.000 1.00 1.000
#> gear 32 3.687500 0.7378041 3.000 3.00000 4.000 4.00 5.000
#> carb 32 2.812500 1.6152000 1.000 2.00000 2.000 4.00 8.000
The figure sizes have been customised so that you can easily put two images side-by-side.
5
a = 6
b = a + b
c1 = c(1, 2, 3, 4)
df1 = c(8,9,6,8)
gf1 =ls()
#> [1] "a" "b" "c1" "df1"
#> [5] "digitsx" "gf1" "my_path" "Produc"
#> [9] "t1_12_28_90" "t1_12_28_90_df"
alex_clean(except = c("a", "b", "c", "d"), pattern = "df")
#> [1] "The full name of object in your R environment before request for erasing was: a"
#> [2] "The full name of object in your R environment before request for erasing was: b"
#> [3] "The full name of object in your R environment before request for erasing was: c1"
#> [4] "The full name of object in your R environment before request for erasing was: df1"
#> [5] "The full name of object in your R environment before request for erasing was: digitsx"
#> [6] "The full name of object in your R environment before request for erasing was: gf1"
#> [7] "The full name of object in your R environment before request for erasing was: my_path"
#> [8] "The full name of object in your R environment before request for erasing was: Produc"
#> [9] "The full name of object in your R environment before request for erasing was: t1_12_28_90"
#> [10] "The full name of object in your R environment before request for erasing was: t1_12_28_90_df"
#> [1] "The full name of preserved object in your R environment is: a"
#> [2] "The full name of preserved object in your R environment is: b"
#> [3] "The full name of preserved object in your R environment is: df1"
#> [4] "The full name of preserved object in your R environment is: t1_12_28_90_df"
ls()
#> [1] "a" "b" "df1" "t1_12_28_90_df"
alex_clean()
#> [1] "The full name of object in your R environment before request for erasing was: a"
#> [2] "The full name of object in your R environment before request for erasing was: b"
#> [3] "The full name of object in your R environment before request for erasing was: df1"
#> [4] "The full name of object in your R environment before request for erasing was: t1_12_28_90_df"
#> [1] "Your Request to clear the entire R environment is received"
#> [1] "The full name of preserved object in your R environment is: "
ls()
#> character(0)
Sometimes you need to visualize: how many missing values you have in your data, especially in the panel-type data. Good visualization may always help you with this.
# using dataset Produc from plm package as an example
data("Produc", package="plm")
$test = ifelse(Produc$unemp > 5, Produc$unemp, NA) #Adding NAs occasionally to the dataset
Producalex_na_plot(Produc, ts_id = "year")
#> Loading required package: data.table
#>
#> Attaching package: 'data.table'
#> The following objects are masked from 'package:dplyr':
#>
#> between, first, last
#> The following object is masked from 'package:plm':
#>
#> between
#> Loading required package: ggplot2
#> Scale for 'fill' is already present. Adding another scale for 'fill', which
#> will replace the existing scale.
This is all there is (currently). All these functions are rather simple wrappers around established R functions. They can easily be modified to fit your needs and taste. Take look at the github repository of the alexandershemetev package for the codes. Have fun!
The full package is under construction now (this version is the very basic package). To install it use: - library(devtools) - install_github(“Alexandershemetev/alexandershemetev”) - library(alexandershemetev)