Erik Marsja
- Website
- marsja.se · all feeds from this site
- Feed URL
https://www.marsja.se/feed/
Read it in your FeedListing reader
Or add to: Feedly Inoreader Raw feed
Latest posts
-
How to Combine Two Data Tables in R Using rbind()
The post How to Combine Two Data Tables in R Using rbind() appeared first on Erik Marsja . In this tutorial, you will learn how to combine two data tables in R using rbind() and rbindlist(). We will look at how to add rows from one table to another, combine tables with different…
-
Understanding SSE in Regression
The post Understanding SSE in Regression appeared first on Erik Marsja . SSE in regression, or Sum of Squared Errors, measures how well a regression model fits the data. This post explains what SSE represents, why it matters in regression analysis, and how to calculate it using…
-
Pandas: Drop Columns By Name in DataFrames
The post Pandas: Drop Columns By Name in DataFrames appeared first on Erik Marsja . This post explains how to use pandas to drop columns by name from one or multiple DataFrames. We demonstrate dropping single and multiple columns, as well as how to conditionally remove columns…
-
How to Rename Columns in data.table in R (With Examples)
The post How to Rename Columns in data.table in R (With Examples) appeared first on Erik Marsja . In this post, you will learn how to rename columns in data.table in R. Renaming columns can be useful when cleaning data, for example, if we want to give our variables more…
-
Replace NA in data.table: Replacing with 0 and Other Values
The post Replace NA in data.table: Replacing with 0 and Other Values appeared first on Erik Marsja . In this post, we explore two methods for replacing NA values in data.table using R. First, we replace NAs with zero, and second, we use the mean of non-missing values. These…
-
How to Use data.table to Fill NA with the Previous Value in R
The post How to Use data.table to Fill NA with the Previous Value in R appeared first on Erik Marsja . In this post, we explore filling missing values with data.table in R and compare its speed to dplyr. We found that data.table outperforms dplyr in terms of efficiency,…
-
How to Find First Non-NA Value in data.table
The post How to Find First Non-NA Value in data.table appeared first on Erik Marsja . In this post, we explore how to find the first non-NA value in data.table, both for grouped and ungrouped data. We use practical examples, including a psychology research experiment, to…
-
How to Extract GPS Coordinates from a Photo: The USAID Mystery
The post How to Extract GPS Coordinates from a Photo: The USAID Mystery appeared first on Erik Marsja . Where did the USAID nutrition pack go? Using Python, we tracked down its exact location by extracting GPS coordinates from a photo. In this post, you'll learn how to pull…
-
How to Make a Heatmap in R
The post How to Make a Heatmap in R appeared first on Erik Marsja . In this post, we used R and ggplot2 to visualize correlations among BFI personality traits. We cleaned the data, computed the correlation matrix, and created a polished heatmap without grid lines. This approach…
-
Two-Sample Z Test in R: Short Guide to Proportions and Means
The post Two-Sample Z Test in R: Short Guide to Proportions and Means appeared first on Erik Marsja . Learn how to perform a two sample Z test in R to compare proportions and means between two groups. This short guide walks through examples using real numbers and shows both…
-
data.table Count Rows by Group
The post data.table Count Rows by Group appeared first on Erik Marsja . In this post, we explore how to use data.table to count rows by group in R. We cover using the .N operator and demonstrate how to group by one or more columns. This technique is quick and effective, making…
-
How to Get Number of Rows in R Using data.table
The post How to Get Number of Rows in R Using data.table appeared first on Erik Marsja . In this post, we explore how to count rows in R using nrow() for both data.frames and data.tables. We compare the performance of each method using a large dataset and discuss which one is…
-
How to Filter in data.table in R
The post How to Filter in data.table in R appeared first on Erik Marsja . Filtering data is a a common step in data analysis. In this post, we explore how to filter in data.table in R, including subsetting by conditions and selecting specific groups. We also show how to save the…
-
How to Sum Multiple Columns in data.table
The post How to Sum Multiple Columns in data.table appeared first on Erik Marsja . This post explores summing multiple columns in data.table, including group-wise summation and dynamic column selection with %in%. We also compare this approach with dplyr and base R. Whether…
-
How to Select Columns from data.table in R
The post How to Select Columns from data.table in R appeared first on Erik Marsja . Learn how to select columns in data.table using names, character vectors, and indices. This guide covers selecting single and multiple columns, using .SDcols, and indexing. With practical…