by Suf | May 25, 2022 | Programming, R, Tips
You can rotate the axis labels by using angle parameter of the element_text() function when modifying the theme of your plot, for example: theme(axis.text.x = element_text(angle = 90, vjust = 0.5) We can use vjust and hjust in element_text() to add horizontal and...
by Suf | May 22, 2022 | Programming, R, Tips
This R tutorial will go through how to order bars in a ggplot2 bar chart with code examples. Table of contentsExampleSolution #1: Manually Order BarsSolution #2: Sort Bars in Descending OrderSolution #3: Sort Bars in Ascending OrderSummary Example Consider the...
by Suf | May 21, 2022 | Finance, Programming, R, Tips
R provides several powerful tools for financial market analysis. This tutorial will go through how to download and plot the daily stock prices from Yahoo! Finance using quantmod. Yahoo finance provides free access to historic stock prices at the time of writing this...
by Suf | May 20, 2022 | Programming, R, Tips
To perform element-by-element multiplication between two matrices X and Y, you must use the * operator as follows: X * Y If you want to perform matrix multiplication between two matrices X and Y, you must use the %*% operator as follows: X * Y This tutorial will go...
by Suf | May 16, 2022 | Programming, R, Tips
The Jaccard similarity compares two sets of data to determine how similar they are. The value of the Jaccard similarity can be between 0 and 1, where the close the number is to 1 the more similar the two sets of data are. This tutorial will go through how to calculate...
by Suf | May 15, 2022 | Programming, R, Tips
This tutorial will go through how to calculate the cosine similarity in R for vectors and matrices with code examples. Table of contentsWhat is Cosine Similarity?Visual Description of Cosine SimilarityCosine Similarity Between Two Vectors in RCosine Similarity of a...