Stats and R
https://www.statsandr.com/
Recent content on Stats and RHugo -- gohugo.ioenMon, 16 Dec 2019 00:00:00 +0000Wilcoxon test in R: how to compare 2 groups under the non-normality assumption
https://www.statsandr.com/blog/wilcoxon-test-in-r-how-to-compare-2-groups-under-the-non-normality-assumption/
Sun, 07 Jun 2020 00:00:00 +0000https://www.statsandr.com/blog/wilcoxon-test-in-r-how-to-compare-2-groups-under-the-non-normality-assumption/Introduction 2 different scenarios Independent samples Paired samples Introduction In a previous article, we showed how to compare two groups under different scenarios using the Student’s t-test. The Student’s t-test requires that the distributions follow a normal distribution1. In this article, we show how to compare two groups when the normality assumption is violated, using the Wilcoxon test.
The Wilcoxon test (also referred as the Mann-Withney-Wilcoxon test) is a non-parametric test, meaning that it does not rely on data belonging to any particular parametric family of probability distributions.How to publish a Shiny app: example with shinyapps.io
https://www.statsandr.com/blog/how-to-publish-shiny-app-example-with-shinyapps-io/
Fri, 29 May 2020 00:00:00 +0000https://www.statsandr.com/blog/how-to-publish-shiny-app-example-with-shinyapps-io/Introduction Prerequisite Step-by-step guide Additional notes Introduction The COVID-19 virus led many people to create interactive apps and dashboards. A reader recently asked me how to publish a Shiny app she just created. Similarly to a previous article where I show how to upload R code on GitHub, I thought it would be useful to some people to see how I publish my Shiny apps so they could do the same.Correlation coefficient and correlation test in R
https://www.statsandr.com/blog/correlation-coefficient-and-correlation-test-in-r/
Thu, 28 May 2020 00:00:00 +0000https://www.statsandr.com/blog/correlation-coefficient-and-correlation-test-in-r/Introduction Data Correlation coefficient Between two variables Correlation matrix: correlations for all variables Interpretation of a correlation coefficient Visualizations A scatterplot for 2 variables Scatterplots for several pairs of variables Another simple correlation matrix Correlation test For 2 variables For several pairs of variables Combination of correlation coefficients and correlation tests Introduction Correlations between variables play an important role in a descriptive analysis. A correlation measures the relationship between two variables, that is, how they are linked to each other.How to upload your R code on GitHub: example with an R script on MacOS
https://www.statsandr.com/blog/how-to-upload-r-code-on-github-example-with-an-r-script-on-mac-os/
Sun, 24 May 2020 00:00:00 +0000https://www.statsandr.com/blog/how-to-upload-r-code-on-github-example-with-an-r-script-on-mac-os/Introduction Prerequisite Step-by-step guide Additional notes Introduction Few days ago, a colleague asked me how to upload some R code on GitHub in order to make it accessible to everyone. Due to the lockdown, I could not just go into his office and show him on his computer. So I sent him several screenshots showing, step by step, how to do so.
Right before I deleted the screenshots I’d just taken, I thought that perhaps they would be useful for other persons, so I wrote this article.Press
https://www.statsandr.com/press/
Sun, 24 May 2020 00:00:00 +0000https://www.statsandr.com/press/Contact You can contact me here.
Social profiles Twitter Medium LinkedIn GitHub In the news Here is a roll-up of press mentions of the blog:
How can we predict the evolution of COVID 19 in Belgium? (UCLouvain: in English & in French) Evolution of COVID-19 hospital admissions in Belgium (LN24) COVID-19 in Belgium: is it over yet?
https://www.statsandr.com/blog/covid-19-in-belgium-is-it-over-yet/
Fri, 22 May 2020 00:00:00 +0000https://www.statsandr.com/blog/covid-19-in-belgium-is-it-over-yet/Introduction New hospital admissions Overall Zooming in New confirmed cases Introduction This is a joint work with Prof. Niko Speybroeck and Angel Rosas-Aguirre.
Belgium recently started to lift its lockdown measures initially imposed to contain the spread of the Covid-19. Following this decision taken by Belgian authorities, we analyze how the situation evolved so far.
Contrarily to a previous article in which I analyzed the outbreak of the Coronavirus in Belgium using the SIR model, in this article we focus on the evolution of:One-proportion and goodness of fit test (in R and by hand)
https://www.statsandr.com/blog/one-proportion-and-goodness-of-fit-test-in-r-and-by-hand/
Wed, 13 May 2020 00:00:00 +0000https://www.statsandr.com/blog/one-proportion-and-goodness-of-fit-test-in-r-and-by-hand/Introduction In R Data One-proportion test Assumption of prop.test() and binom.test() Chi-square goodness of fit test Does my distribution follow a given distribution? Observed frequencies Expected frequencies Observed vs. expected frequencies By hand One-proportion test Verification in R Goodness of fit test Verification in R Introduction In a previous article, I presented the Chi-square test of independence in R which is used to test the independence between two categorical variables.A package to download free Springer books during Covid-19 quarantine
https://www.statsandr.com/blog/a-package-to-download-free-springer-books-during-covid-19-quarantine/
Sun, 26 Apr 2020 00:00:00 +0000https://www.statsandr.com/blog/a-package-to-download-free-springer-books-during-covid-19-quarantine/Introduction Installation Download all books at once Create a table of Springer books Download only specific books By title By author By subject Improvements Acknowledgments Update: The promotion has ended so it is not possible to download the books for free anymore. If you did not download the books in time, you can download all of them here.COVID-19 in Belgium
https://www.statsandr.com/blog/covid-19-in-belgium/
Tue, 31 Mar 2020 00:00:00 +0000https://www.statsandr.com/blog/covid-19-in-belgium/Introduction Top R resources on Coronavirus Coronavirus dashboard for your own country Motivations, limitations and structure of the article Analysis of Coronavirus in Belgium A classic epidemiological model: the SIR model Fitting a SIR model to the Belgium data Reproduction number \(R_0\) Using our model to analyze the outbreak if there was no intervention More summary statistics Additional considerations Ascertainment rates More sophisticated models Modelling the epidemic trajectory using log-linear models Estimating changes in the effective reproduction number \(R_e\) More sophisticated projections Conclusion References Introduction The Novel COVID-19 Coronavirus is still spreading quickly in several countries and it does not seem like it is going to stop anytime soon as the peak has not yet been reached in many countries.How to create a simple Coronavirus dashboard specific to your country in R
https://www.statsandr.com/blog/how-to-create-a-simple-coronavirus-dashboard-specific-to-your-country-in-r/
Mon, 23 Mar 2020 00:00:00 +0000https://www.statsandr.com/blog/how-to-create-a-simple-coronavirus-dashboard-specific-to-your-country-in-r/Introduction Top R resources on Coronavirus Coronavirus dashboard: the case of Belgium How to create your own Coronavirus dashboard Additional notes Data Open source Accuracy Publish your dashboard Coronavirus dashboard: the case of Belgium
Introduction The Novel COVID-19 Coronavirus is the hottest topic right now. Every day, the media and newspapers share the number of new cases and deaths in several countries, try to measure the impacts of the virus on citizens and remind us to stay home in order to stay safe.How to do a t-test or ANOVA for more than one variable at once in R and communicate the results in a better way
https://www.statsandr.com/blog/how-to-do-a-t-test-or-anova-for-many-variables-at-once-in-r-and-communicate-the-results-in-a-better-way/
Thu, 19 Mar 2020 00:00:00 +0000https://www.statsandr.com/blog/how-to-do-a-t-test-or-anova-for-many-variables-at-once-in-r-and-communicate-the-results-in-a-better-way/Introduction Perform multiple tests at once Concise and easily interpretable results T-test Additional p-value adjustment methods ANOVA To go even further References Introduction As part of my teaching assistant position in a Belgian university, students often ask me for some help in their statistical analyses for their master’s thesis.
A frequent question is how to compare groups of patients in terms of several quantitative continuous variables.Top 100 R resources on Novel COVID-19 Coronavirus
https://www.statsandr.com/blog/top-r-resources-on-covid-19-coronavirus/
Thu, 12 Mar 2020 00:00:00 +0000https://www.statsandr.com/blog/top-r-resources-on-covid-19-coronavirus/R Shiny apps and dashboards Coronavirus tracker Coronavirus dashboard from the {coronavirus} package COVID-19 Global Cases Visualization of Covid-19 Cases Modeling COVID-19 Spread vs Healthcare Capacity COVID-19 Data Visualization Platform Coronavirus 10-day forecast Coronavirus (COVID-19) across the world COVID-19 outbreak Comparing Corona trajectories Flatten the Curve Explore the spread of Covid-19 Governments and COVID-19 Simulating COVID-19 Epidemic in Togo - West Africa Covid-19 Prediction Covid-19 Dashboard Healthcare worker deaths from novel Coronavirus (COVID-19) in the US Covid-19 Hospitalizations in Belgium COVIDMINDER: Where you live matters!How to perform a one sample t-test by hand and in R: test on one mean
https://www.statsandr.com/blog/how-to-perform-a-one-sample-t-test-by-hand-and-in-r-test-on-one-mean/
Mon, 09 Mar 2020 00:00:00 +0000https://www.statsandr.com/blog/how-to-perform-a-one-sample-t-test-by-hand-and-in-r-test-on-one-mean/Introduction Null and alternative hypothesis Hypothesis testing Two versions of the one sample t-test How to compute the one sample t-test by hand? Scenario 1: variance of the population is known Scenario 2: variance of the population is unknown Different underlying distributions for the critical value How to compute the one sample t-test in R? Scenario 1: variance of the population is known Scenario 2: variance of the population is unknown Confidence interval Assumptions Introduction After having written an article on the Student’s t-test for two samples (independent and paired samples), I believe it is time to explain in details how to perform one sample t-tests by hand and in R.The 9 concepts and formulas in probability that every data scientist should know
https://www.statsandr.com/blog/the-9-concepts-and-formulas-in-probability-that-every-data-scientist-should-know/
Tue, 03 Mar 2020 00:00:00 +0000https://www.statsandr.com/blog/the-9-concepts-and-formulas-in-probability-that-every-data-scientist-should-know/What is probability? 1. A probability is always between 0 and 1 2. Compute a probability 3. Complement of an event 4. Union of two events 5. Intersection of two events 6. Independence of two events 7. Conditional probability Bayes’ theorem Example 8. Accuracy measures False negatives False positives Sensitivity Specificity Positive predictive value Negative predictive value 9. Counting techniques Multiplication Example Permutation Example By hand In R Combination Example By hand In R What is probability?FAQ - Frequently asked questions
https://www.statsandr.com/faq/
Mon, 02 Mar 2020 00:00:00 +0000https://www.statsandr.com/faq/What technology and theme do you use to write this blog and the articles? I am new to this blog, to R or to statistics, from where can I start? I would like to replicate an analysis you have done in one of your article, can I have access to the entire code? I believe there is mistake/bug, what is the best way to report it? I have a question or I would like to collaborate with you, how can I contact you?Student's t-test in R and by hand: how to compare two groups under different scenarios
https://www.statsandr.com/blog/student-s-t-test-in-r-and-by-hand-how-to-compare-two-groups-under-different-scenarios/
Fri, 28 Feb 2020 00:00:00 +0000https://www.statsandr.com/blog/student-s-t-test-in-r-and-by-hand-how-to-compare-two-groups-under-different-scenarios/Introduction Null and alternative hypothesis Hypothesis testing Different versions of the Student’s t-test How to compute Student’s t-test by hand? Scenario 1: Independent samples with 2 known variances Scenario 2: Independent samples with 2 equal but unknown variances Scenario 3: Independent samples with 2 unequal and unknown variances Scenario 4: Paired samples where the variance of the differences is known Scenario 5: Paired samples where the variance of the differences is unknown How to compute Student’s t-test in R?Correlogram in R: how to highlight the most correlated variables in a dataset
https://www.statsandr.com/blog/correlogram-in-r-how-to-highlight-the-most-correlated-variables-in-a-dataset/
Sat, 22 Feb 2020 00:00:00 +0000https://www.statsandr.com/blog/correlogram-in-r-how-to-highlight-the-most-correlated-variables-in-a-dataset/Introduction Correlation matrix Correlogram Correlation test Code {lares} package All possible correlations Correlation of one variable against all others Reference Introduction Correlation, often computed as part of descriptive statistics, is a statistical tool used to study the relationship between two variables, that is, whether and how strongly couples of variables are associated.
Correlations are measured between only 2 variables at a time. Therefore, for datasets with many variables, computing correlations can become quite cumbersome and time consuming.Getting started in R markdown
https://www.statsandr.com/blog/getting-started-in-r-markdown/
Tue, 18 Feb 2020 00:00:00 +0000https://www.statsandr.com/blog/getting-started-in-r-markdown/R Markdown: what, why and how? Before you start Components of a .Rmd file YAML header Code chunks Text Code inside text Highlight text like it is code Images Tables Additional notes and useful resources If you have spent some time writing code in R, you probably have heard of generating dynamic reports incorporating R code, R outputs (results) and text or comments. In this article, I will explain how R Markdown works and give you the basic elements you need to get started easily in the production of these dynamic reports.The complete guide to clustering analysis: k-means and hierarchical clustering by hand and in R
https://www.statsandr.com/blog/clustering-analysis-k-means-and-hierarchical-clustering-by-hand-and-in-r/
Thu, 13 Feb 2020 00:00:00 +0000https://www.statsandr.com/blog/clustering-analysis-k-means-and-hierarchical-clustering-by-hand-and-in-r/What is clustering analysis? Application 1: Computing distances Solution k-means clustering Application 2: k-means clustering Data kmeans() with 2 groups Quality of a k-means partition nstart for several initial centers and better stability kmeans() with 3 groups Optimal number of clusters Elbow method Silhouette method Gap statistic method NbClust() Visualizations Manual application and verification in R Solution by hand Solution in R Hierarchical clustering Application 3: hierarchical clustering Data Solution by hand Single linkage Complete linkage Average linkage Solution in R Single linkage Optimal number of clusters Complete linkage Average linkage k-means versus hierarchical clustering References What is clustering analysis?Contribute
https://www.statsandr.com/contribute/
Sat, 08 Feb 2020 00:00:00 +0000https://www.statsandr.com/contribute/Stats and R welcomes guest posts that provides unique insight into statistics and R.
How can you contribute? If you want to contribute and write for www.statsandr.com, please submit your article through this contribution form.
Once your guest post is received, I will review it and inform you about the decision (accepted, rejected, or accepted with minor changes).
Submission rules and guidelines Before submitting your article, please bear in mind the following points:An efficient way to install and load R packages
https://www.statsandr.com/blog/an-efficient-way-to-install-and-load-r-packages/
Fri, 31 Jan 2020 00:00:00 +0000https://www.statsandr.com/blog/an-efficient-way-to-install-and-load-r-packages/What is a R package and how to use it? Inefficient way to install and load R packages More efficient way Most efficient way {pacman} package {librarian} package What is a R package and how to use it? Unlike other programs, only fundamental functionalities come by default with R. You will thus often need to install some “extensions” to perform the analyses you want. These extensions which are are collections of functions and datasets developed and published by R users are called packages.Do my data follow a normal distribution? A note on the most widely used distribution and how to test for normality in R
https://www.statsandr.com/blog/do-my-data-follow-a-normal-distribution-a-note-on-the-most-widely-used-distribution-and-how-to-test-for-normality-in-r/
Wed, 29 Jan 2020 00:00:00 +0000https://www.statsandr.com/blog/do-my-data-follow-a-normal-distribution-a-note-on-the-most-widely-used-distribution-and-how-to-test-for-normality-in-r/What is a normal distribution? Empirical rule Parameters Probabilities and standard normal distribution Areas under the normal distribution in R and by hand Ex. 1 In R By hand Ex. 2 In R By hand Ex. 3 In R By hand Ex. 4 In R By hand Ex. 5 Why is the normal distribution so crucial in statistics? How to test the normality assumption Histogram Density plot QQ-plot Normality test References What is a normal distribution?Fisher's exact test in R: independence test for a small sample
https://www.statsandr.com/blog/fisher-s-exact-test-in-r-independence-test-for-a-small-sample/
Tue, 28 Jan 2020 00:00:00 +0000https://www.statsandr.com/blog/fisher-s-exact-test-in-r-independence-test-for-a-small-sample/Introduction Hypotheses Example Data Observed frequencies Expected frequencies Fisher’s exact test in R Conclusion and interpretation References Introduction After presenting the Chi-square test of independence by hand and in R, this article focuses on the Fisher’s exact test.
Independence tests are used to determine if there is a significant relationship between two categorical variables. There exists two different types of independence test:
the Chi-square test (the most common) the Fisher’s exact test On the one hand, the Chi-square test is used when the sample is large enough (in this case the \(p\)-value is an approximation that becomes exact when the sample becomes infinite, which is the case for many statistical tests).Chi-square test of independence by hand
https://www.statsandr.com/blog/chi-square-test-of-independence-by-hand/
Mon, 27 Jan 2020 00:00:00 +0000https://www.statsandr.com/blog/chi-square-test-of-independence-by-hand/Introduction Hypotheses How the test works? Example Observed frequencies Expected frequencies Test statistic Critical value Conclusion and interpretation Introduction Chi-square tests of independence test whether two qualitative variables are independent, that is, whether there exists a relationship between two categorical variables. In other words, this test is used to determine whether the values of one of the 2 qualitative variables depend on the values of the other qualitative variable.Chi-square test of independence in R
https://www.statsandr.com/blog/chi-square-test-of-independence-in-r/
Mon, 27 Jan 2020 00:00:00 +0000https://www.statsandr.com/blog/chi-square-test-of-independence-in-r/Introduction Example Data Chi-square test of independence in R Conclusion and interpretation Introduction This article explains how to perform the Chi-square test of independence in R and how to interpret its results. To learn more about how the test works and how to do it by hand, I invite you to read the article “Chi-square test of independence by hand”.
To briefly recap what have been said in that article, the Chi-square test of independence tests whether there is a relationship between two categorical variables.How to create a timeline of your CV in R?
https://www.statsandr.com/blog/how-to-create-a-timeline-of-your-cv-in-r/
Sun, 26 Jan 2020 00:00:00 +0000https://www.statsandr.com/blog/how-to-create-a-timeline-of-your-cv-in-r/Introduction Minimal reproducible example How to personalize it Additional note Introduction In this article, I show how to create a timeline of your CV in R. A CV timeline illustrates key information about your education, work experiences and extra activities. The main advantage of CV timelines compared to regular CV is that they make you stand out immediately by being visually appealing and easier to scan. It also allows you to better present your “story” by showing the chronology of your jobs and activities and thus explain how you got to where you are today.RStudio addins, or how to make your coding life easier
https://www.statsandr.com/blog/rstudio-addins-or-how-to-make-your-coding-life-easier/
Sun, 26 Jan 2020 00:00:00 +0000https://www.statsandr.com/blog/rstudio-addins-or-how-to-make-your-coding-life-easier/What are RStudio addins? Installation Addins Esquisse Questionr Recoding factors Reordering factors Categorize a numeric variable Remedy Styler Snakecaser ViewPipeSteps Ymlthis Blogdown What are RStudio addins? Although I have been using RStudio for several years, I only recently discovered RStudio addins. Since then, I am using these addins almost every time I use RStudio.
What are RStudio addins? RStudio addins are extensions which provide a simple mechanism for executing advanced R functions from within RStudio.Descriptive statistics in R
https://www.statsandr.com/blog/descriptive-statistics-in-r/
Wed, 22 Jan 2020 00:00:00 +0000https://www.statsandr.com/blog/descriptive-statistics-in-r/Introduction Data Minimum and maximum Range Mean Median First and third quartile Other quantiles Interquartile range Standard deviation and variance Summary Coefficient of variation Mode Correlation Contingency table Mosaic plot Barplot Histogram Boxplot Scatterplot QQ-plot For a single variable By groups Density plot Correlation plot Advanced descriptive statistics {summarytools} package Frequency tables with freq() Cross-tabulations with ctable() Descriptive statistics with descr() Data frame summaries with dfSummary() describeBy() from the {psych} package aggregate() function Introduction This article explains how to compute the main descriptive statistics in R and how to present them graphically.Support the blog
https://www.statsandr.com/support/
Tue, 21 Jan 2020 00:00:00 +0000https://www.statsandr.com/support/On this blog, I provide free articles and tutorials about statistics and R. My goal with the blog is to help people to understand statistical concepts (through examples and in plain English), and to apply them in R.
All the articles, Shiny apps and code are open source and available to everyone. I also try to reply to questions I receive from readers by emails or as comments.
I work on the blog voluntarily in my spare time (when I am not too busy working on my PhD thesis).Tips and tricks in RStudio and R Markdown
https://www.statsandr.com/blog/tips-and-tricks-in-rstudio-and-r-markdown/
Tue, 21 Jan 2020 00:00:00 +0000https://www.statsandr.com/blog/tips-and-tricks-in-rstudio-and-r-markdown/Run code Insert a comment in R and R Markdown Knit a R Markdown document Code snippets Ordered list in R Markdown New code chunk in R Markdown Reformat code RStudio addins {pander} for aesthetics Pipe operator %>% Others If you have the chance to work with an experienced programmer, you may be amazed by how fast she can write code. In this article, I share some tips and shortcuts you can use in RStudio and R Markdown to speed up the writing of your code.Descriptive statistics by hand
https://www.statsandr.com/blog/descriptive-statistics-by-hand/
Sat, 18 Jan 2020 00:00:00 +0000https://www.statsandr.com/blog/descriptive-statistics-by-hand/Introduction Location versus dispersion measures Location Minimum and maximum Mean Median Odd number of observations Even number of observations Mean vs. median \(1^{st}\) and \(3^{rd}\) quartiles \(q_{0.25}\), \(q_{0.75}\) and \(q_{0.5}\) A note on deciles and percentiles Mode Mode for qualitative variables Dispersion Range Standard deviation Standard deviation for a population Standard deviation for a sample Variance Variance for a population Variance for a sample Standard deviation vs.What is the difference between population and sample?
https://www.statsandr.com/blog/what-is-the-difference-between-population-and-sample/
Sat, 18 Jan 2020 00:00:00 +0000https://www.statsandr.com/blog/what-is-the-difference-between-population-and-sample/Introduction Sample vs. population Why a sample? Representative sample Paired samples Conclusion Introduction People often fail to properly distinguish between population and sample. It is however essential in any statistical analysis, starting from descriptive statistics with different formulas for variance and standard deviation depending on whether we face a sample or a population.
Moreover, the branch of statistics called inferential statistics is often defined as the science of drawing conclusions about a population from observations made on a representative sample of that population.A Shiny app for inferential statistics by hand
https://www.statsandr.com/blog/a-shiny-app-for-inferential-statistics-by-hand/
Wed, 15 Jan 2020 00:00:00 +0000https://www.statsandr.com/blog/a-shiny-app-for-inferential-statistics-by-hand/A Shiny app for inferential statistics: hypothesis tests and confidence intervals
Statistics is divided into four main branches:
Descriptive statistics Inferential statistics Predictive analysis Exploratory analysis Descriptive statistics provide a summary of the data; it helps explaining the data in a concise way without losing too much information. Data can be summarized numerically or graphically. See descriptive statistics by hand or in R to learn more about this branch of statistics.A Shiny app for simple linear regression by hand and in R
https://www.statsandr.com/blog/a-shiny-app-for-simple-linear-regression-by-hand-and-in-r/
Wed, 15 Jan 2020 00:00:00 +0000https://www.statsandr.com/blog/a-shiny-app-for-simple-linear-regression-by-hand-and-in-r/A Shiny app to perform simple linear regression (by hand and in R)
Simple linear regression is a statistical method to summarize and study relationships between two variables. When more than two variables are of interest, it is referred as multiple linear regression.
In this article, we focus only on a Shiny app which allows to perform simple linear regression by hand and in R:
Statistics-202 Here is the entire code in case you would like to enhance it (see how to use this app after the embedded code):World map of visited countries in R
https://www.statsandr.com/blog/world-map-of-visited-countries-in-r/
Thu, 09 Jan 2020 00:00:00 +0000https://www.statsandr.com/blog/world-map-of-visited-countries-in-r/Like me, if you like traveling as much as R you might want to draw a world map of the countries you have visited in R. Below an example with the countries I have visited as of January 2020:A practical guide on optimal asset allocation
https://www.statsandr.com/blog/practical-guide-on-optimal-asset-allocation/
Tue, 07 Jan 2020 00:00:00 +0000https://www.statsandr.com/blog/practical-guide-on-optimal-asset-allocation/A Shiny app with an example of optimal asset allocation
In his book A Random Walk down Wall Street, Burton G. Malkiel advises readers of an optimal asset allocation depending on age. As an amateur investor, I thought it would be useful to develop a Shiny app which depicts his advice for other interested investors. Here is the link to the app:
Optimal asset allocation Here is the entire code in case you would like to enhance it (see an example on how to use this app after the embedded code):Draw a word cloud with a R Shiny app
https://www.statsandr.com/blog/draw-a-word-cloud-with-a-shiny-app/
Tue, 07 Jan 2020 00:00:00 +0000https://www.statsandr.com/blog/draw-a-word-cloud-with-a-shiny-app/Word cloud in a Shiny app
Below a Shiny app to help you draw a word cloud:
Word cloud Here is the entire code in case you would like to enhance it (see an example on how to use this app after the embedded code):
Word clouds are particularly useful as part of text mining analyses. Moreover, it is also useful to analyze string and character variables for any datasets (see the different data types in R).How to embed a Shiny app in blogdown?
https://www.statsandr.com/blog/how-to-embed-a-shiny-app-in-blogdown/
Tue, 07 Jan 2020 00:00:00 +0000https://www.statsandr.com/blog/how-to-embed-a-shiny-app-in-blogdown/If you have developed and deployed a Shiny app and would like to embed it in blogdown, follow these steps:
create a new post as usual add runtime: shiny (and output: html_document if it is not already included) in the YAML metadata insert the following HTML code in the body of the post: <iframe height="800" width="100%" frameborder="no" src="https://antoinesoetewey.shinyapps.io/statistics-201/"> </iframe> You should change the URL with the URL of your deployed Shiny app (after src=, do not forget that the URL should start with http:// or https:// and should be surrounded by "A guide on how to read statistical tables
https://www.statsandr.com/blog/a-guide-on-how-to-read-statistical-tables/
Mon, 06 Jan 2020 00:00:00 +0000https://www.statsandr.com/blog/a-guide-on-how-to-read-statistical-tables/Shiny app to compute probabilities for the main probability distributions
Below a Shiny app to help you read the main statistical tables:
Statistics-101 This Shiny app helps you to compute probabilities for the main probability distributions.
Here is the entire code in case you would like to enhance it (see an example on how to use this app after the embedded code):
Note that the link may not work if the app has hit the monthly usage limit.Newsletter
https://www.statsandr.com/subscribe/
Tue, 31 Dec 2019 00:00:00 +0000https://www.statsandr.com/subscribe/By subscribing to this newsletter you will be notified each time a new article is published. You can unsubscribe at anytime and your email address will never be shared.
#mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; } /* Add your own Mailchimp form style overrides in your site stylesheet or in this style block. We recommend moving this block and the preceding CSS link to the HEAD of your HTML file.Data types in R
https://www.statsandr.com/blog/data-types-in-r/
Mon, 30 Dec 2019 00:00:00 +0000https://www.statsandr.com/blog/data-types-in-r/What data types exist in R? Numeric Integer Character Factor Logical This article presents the different data types in R. To learn about the different variable types from a statistical point of view, read “Variable types and examples”.
What data types exist in R? There are the 6 most common data types in R:
Numeric Integer Complex Character Factor Logical Datasets in R are often a combination of these 6 different data types.Variable types and examples
https://www.statsandr.com/blog/variable-types-and-examples/
Mon, 30 Dec 2019 00:00:00 +0000https://www.statsandr.com/blog/variable-types-and-examples/Big picture Quantitative Discrete Continuous Qualitative Nominal Ordinal Variable transformations From continuous to discrete From quantitative to qualitative Additional notes This article presents the different variable types from a statistical point of view. To learn about the different data types in R, read “Data types in R”.
Big picture In statistics, variables are classified into 4 different types:
{"x":{"diagram":"digraph {\n\n\n\n\n \"How to create an interactive booklist with automatic Amazon affiliate links in R?
https://www.statsandr.com/blog/how-to-create-an-interactive-booklist-with-automatic-amazon-affiliate-links-in-r/
Thu, 26 Dec 2019 00:00:00 +0000https://www.statsandr.com/blog/how-to-create-an-interactive-booklist-with-automatic-amazon-affiliate-links-in-r/Introduction Requirements Create a booklist Create it in Excel then import it Create it directly in R Make it interactive Add URLs with your affiliate link to the table Extract affiliate link Append the book title and author to make it automatic Add links to the interactive table Final result Introduction Booklists are a useful way to share the books you have read and which you recommend to other readers and/or to promote the books you have written.Terms and policies
https://www.statsandr.com/terms/
Wed, 25 Dec 2019 00:00:00 +0000https://www.statsandr.com/terms/This is my personal blog written and edited by me. Your use of this website, in any and all forms, constitutes an acceptance of these terms and policies. This page is reviewed and revised from time to time.
All content provided is for informational purposes only. The articles and posts on this website are my own and do not necessarily represent the positions, strategies, or opinions of my employer or its subsidiaries.Data manipulation in R
https://www.statsandr.com/blog/data-manipulation-in-r/
Tue, 24 Dec 2019 00:00:00 +0000https://www.statsandr.com/blog/data-manipulation-in-r/Introduction Dataset Subset a dataset First or last observations Random sample of observations Based on row or column numbers Based on variable names Based on one or multiple criterion Create a new variable Transform a continuous variable into a categorical variable Sum and mean in rows Sum and mean in column Categorical variables and labels management Recode categorical variables Change reference level Rename variable names Create a dataframe manually Missing values Remove NAs Impute NAs Scale Introduction Not all datasets are as clean and tidy as you would expect.Links
https://www.statsandr.com/links/
Tue, 24 Dec 2019 00:00:00 +0000https://www.statsandr.com/links/ Below a list of useful links.
Contributions to online blogs:
www.r-bloggers.com www.medium.com www.towardsdatascience.com www.rweekly.org Additional resources:
R for Data Science and Advanced R (excellent free books on R, written by Garrett Grolemund and Hadley Wickham) www.statisticsbyjim.com www.statistique-et-logiciel-r.com (in french) www.r-users.com (jobs in R) Sitemap
https://www.statsandr.com/sitemap/
Tue, 24 Dec 2019 00:00:00 +0000https://www.statsandr.com/sitemap/A list of all the pages and articles found on the blog. If you cannot find what you are looking for, do not hesitate to contact me.
For you robots out there is an XML version available for digesting as well.
Pages Home Blog Tags About Contact Subscribe to the newsletter FAQ - Frequently asked questions Contribute - Guest post Support the blog Press Useful links Terms and policies Sitemap How to import an Excel file in RStudio?
https://www.statsandr.com/blog/how-to-import-an-excel-file-in-rstudio/
Wed, 18 Dec 2019 00:00:00 +0000https://www.statsandr.com/blog/how-to-import-an-excel-file-in-rstudio/Introduction Transform an Excel file to a CSV file R working directory Get working directory Set working directory User-friendly method Via the console Via the text editor Import your dataset User-friendly way Via the text editor Import SPSS (.sav) files Introduction As we have seen in this article on how to install R and RStudio, R is useful for many kind of computational tasks and statistical analyses.Contact
https://www.statsandr.com/contact/
Tue, 17 Dec 2019 00:00:00 +0000https://www.statsandr.com/contact/Thanks in advance for contacting me.
In order for me to answer you as soon as possible, here are the best communication methods:
If you have a question or a suggestion related to an article, I invite you to add it as a comment (at the end of the corresponding article) so other readers can benefit from the discussion For mistakes or bugs, you can inform me about them by raising an issue on GitHub.How to install R and RStudio?
https://www.statsandr.com/blog/how-to-install-r-and-rstudio/
Tue, 17 Dec 2019 00:00:00 +0000https://www.statsandr.com/blog/how-to-install-r-and-rstudio/What is R and RStudio? R RStudio The main components of RStudio Examples of code Calculator Comments Store and print values Vectors Matrices Generate random values Plot What is R and RStudio? R The statistical program R is nothing more than a programming language, mainly used for data manipulation and to perform statistical analyses. At the time of writing, this language is (one of) the leading program in statistics, although not the only programming language used by statisticians.About me
https://www.statsandr.com/about/
Mon, 16 Dec 2019 00:00:00 +0000https://www.statsandr.com/about/Hello, my name is Antoine Soetewey. I am a PhD student in statistics at UCLouvain (Belgium) within the Institute of Statistics, Biostatistics and Actuarial Sciences. My research interests focus on survival analysis and bio-statistical procedures applied to cancer patients.
In parallel with my doctoral thesis, I am teaching assistant for several courses in statistics and probability at bachelor and master’s level. From time to time, I also provide trainings and workshops in statistics and R programming for a Belgian consulting company.Hello World!
https://www.statsandr.com/blog/hello-world/
Mon, 16 Dec 2019 00:00:00 +0000https://www.statsandr.com/blog/hello-world/hello world
This is the first post for the blog Stats and R, just to introduce it. This blog aims at helping academics and professionals working with data to grasp important concepts in statistics and to apply them in R.
The goal of this website is to make statistics easy to understand by illustrating with examples and using plain English. When possible, for all statistical concepts covered here, I also write an article on how to apply these concepts in R.