![TomazTsql | Tomaz Doing BI & DEV With SQL Server & R](https://i1.feedspot.com/4889371.jpg?t=1612588695)
TomazTsql | Tomaz Doing BI & DEV With SQL Server & R
2,058 FOLLOWERS
Tomaz Kastrun is a BI / DEV developer and data analyst. With more than 15 years of experience in the field of databases, business warehouses, and development, with a focus on T-SQL programming and query optimization. Follow this blog to get articles on BI & DEV with SQL Server and R, Python, Power BI, Azure, and beyond.
TomazTsql | Tomaz Doing BI & DEV With SQL Server & R
2w ago
This sample R code is an implementation one of possible solutions for generating timetable schedule. The proposed solution is based on methods of evolutionary computing, and it uses (1+1) evolutionary strategy and simulated hardening. The success of solution is estimated on fulfillment of given constraints and criteria. Results of testing the algorithm show that all hard constraints are satisfied, while additional criteria are optimized to a certain extent.
Problem:
Each meeting slot is represented as block (lasts arbitrary number of hours, mostly form 1 to 4). For conducting every block requi ..read more
TomazTsql | Tomaz Doing BI & DEV With SQL Server & R
3w ago
Let’s play with some dragons. Dragons from the Jurassic park or the board game dungeon and dragons.
The algorithm is a fractal curve of Hausdorff dimension 2. One starts with one segment. In each iteration the number of segments is doubled by taking each segment as the diagonal of a square and replacing it by half the square (90 degrees). Alternating and doing the left and right function / direction to complement in order to get the shape.
Assume that we start with just a horizontal line (called Dn) as a segment. Since we created two dragons, we will introduce another line (called Cn, which is ..read more
TomazTsql | Tomaz Doing BI & DEV With SQL Server & R
1M ago
A simple, yet effective way to set your colour palette in R using ggplot library.
library(ggplot2)
set.seed(2908)
my_palette <- c("red", "limegreen", "#3357FF", "goldenrod1", "#33FFFF", "brown")
data <- data.frame(
x = 1:25,
y = rnorm(25),
group = rep(c("A", "B", "C", "D", "E"), each = 5) )
After that, we can start “chaining” ggplot graphs.
Scatter plot
ggplot(data, aes(x = x, y = y, color = group)) +
geom_point(size = 3) +
scale_color_manual(values = my_palette, na.value = "grey45") +
theme_minimal()
Barchart / Histogram
ggplot(data, aes(x = x, y = y, color = gro ..read more
TomazTsql | Tomaz Doing BI & DEV With SQL Server & R
2M ago
Calculating cumulative percentage or percentage per group for each time can sometimes be a task with a slight twist. Let’s check this with ggplot2 and tidyverse.
library(ggplot2)
library(tidyverse)
data <- data.frame(
sector = rep(1:20, each = 5),
item = rep(1:5, times = 20),
value = rpois(100, 10)
)
Three (out of many more) ways to show how this can be achieved.
using simple calculation
# using simple calculation
ggplot(data, aes(x = factor(sector), y = value / sum(value) * 100, fill = factor(item))) +
geom_bar(stat = "identity", position = "fill") +
scale_y_con ..read more
TomazTsql | Tomaz Doing BI & DEV With SQL Server & R
4M ago
You know the feeling after long vacation and finally sitting in front of your favourite UI and even forgot how to write simplest “hello world” or “foo bar” function? Well, we got you covered! The reverse Hello world function is for all the people returning to the office after rather long vacation.
Create the function:
# reverse Hello World
hello_world <- function(print){
if (print == "print"){
print("Hello World")
} else {
cat("\rWell ...")
}
}
And be confused for a split second, when you want to use this function correctly
Welcome back!
As always, the complete code is av ..read more
TomazTsql | Tomaz Doing BI & DEV With SQL Server & R
7M ago
In this Microsoft Fabric series:
Dec 01: What is Microsoft Fabric?
Dec 02: Getting started with Microsoft Fabric
Dec 03: What is lakehouse in Fabric?
Dec 04: Delta lake and delta tables in Microsoft Fabric
Dec 05: Getting data into lakehouse
Dec 06: SQL Analytics endpoint
Dec 07: SQL commands in SQL Analytics endpoint
Dec 08: Using Lakehouse REST API
Dec 09: Building custom environments
Dec 10: Creating Job Spark definition
Dec 11: Starting data science with Microsoft Fabric
Dec 12: Creating data science ..read more
TomazTsql | Tomaz Doing BI & DEV With SQL Server & R
7M ago
In this Microsoft Fabric series:
Dec 01: What is Microsoft Fabric?
Dec 02: Getting started with Microsoft Fabric
Dec 03: What is lakehouse in Fabric?
Dec 04: Delta lake and delta tables in Microsoft Fabric
Dec 05: Getting data into lakehouse
Dec 06: SQL Analytics endpoint
Dec 07: SQL commands in SQL Analytics endpoint
Dec 08: Using Lakehouse REST API
Dec 09: Building custom environments
Dec 10: Creating Job Spark definition
Dec 11: Starting data science with Microsoft Fabric
Dec 12: Creating data science ..read more
TomazTsql | Tomaz Doing BI & DEV With SQL Server & R
7M ago
In this Microsoft Fabric series:
Dec 01: What is Microsoft Fabric?
Dec 02: Getting started with Microsoft Fabric
Dec 03: What is lakehouse in Fabric?
Dec 04: Delta lake and delta tables in Microsoft Fabric
Dec 05: Getting data into lakehouse
Dec 06: SQL Analytics endpoint
Dec 07: SQL commands in SQL Analytics endpoint
Dec 08: Using Lakehouse REST API
Dec 09: Building custom environments
Dec 10: Creating Job Spark definition
Dec 11: Starting data science with Microsoft Fabric
Dec 12: Creating data science ..read more
TomazTsql | Tomaz Doing BI & DEV With SQL Server & R
7M ago
In this Microsoft Fabric series:
Dec 01: What is Microsoft Fabric?
Dec 02: Getting started with Microsoft Fabric
Dec 03: What is lakehouse in Fabric?
Dec 04: Delta lake and delta tables in Microsoft Fabric
Dec 05: Getting data into lakehouse
Dec 06: SQL Analytics endpoint
Dec 07: SQL commands in SQL Analytics endpoint
Dec 08: Using Lakehouse REST API
Dec 09: Building custom environments
Dec 10: Creating Job Spark definition
Dec 11: Starting data science with Microsoft Fabric
Dec 12: Creating data science ..read more
TomazTsql | Tomaz Doing BI & DEV With SQL Server & R
7M ago
In this Microsoft Fabric series:
Dec 01: What is Microsoft Fabric?
Dec 02: Getting started with Microsoft Fabric
Dec 03: What is lakehouse in Fabric?
Dec 04: Delta lake and delta tables in Microsoft Fabric
Dec 05: Getting data into lakehouse
Dec 06: SQL Analytics endpoint
Dec 07: SQL commands in SQL Analytics endpoint
Dec 08: Using Lakehouse REST API
Dec 09: Building custom environments
Dec 10: Creating Job Spark definition
Dec 11: Starting data science with Microsoft Fabric
Dec 12: Creating data science ..read more