en
Feedback
Steves Data and R channel

Steves Data and R channel

Open in Telegram

Talk mainly about data, R, SQL etc.

Show more
375
Subscribers
No data24 hours
+17 days
-230 days
Posts Archive
In the next month or so, I'm going to "close" the channel. I won't be posting anymore. If you are looking for a good channel I suggest you follow https://t.me/ramikrispinds

I'm not yet back to writing my blog because I'm not feeling it at the moment, still on break. Here, though is a basic usage article for using my #RandomWalker #RStats library. https://www.spsanderson.com/RandomWalker/articles/basic-concepts.html

Here is today's #R #Blog #Post on using the unname() function. Post: https://www.spsanderson.com/steveondata/posts/2025-12-01/

Here I am using my #RandomWalker #RStats package to graph possible animal foraging paths. Many things can be done with some i
+1
Here I am using my #RandomWalker #RStats package to graph possible animal foraging paths. Many things can be done with some imagination :) Reference Link: https://www.spsanderson.com/RandomWalker/articles/multi-dimensional-walks.html#use-cases

Got some documentation vignettes going up. Starting with #RandomWalker Home Wiki: https://www.spsanderson.com/RandomWalker/articles/home.html #RStats #R #Random

Today's blog post is about for loops with a range in R Post: https://www.spsanderson.com/steveondata/posts/2025-11-17/ #R #RStats #ForLoop #Range

I most likely will not post this week, I’ll see how my back is next week

Today's Python article, remember, I'm learning so be kind or rewind :) Post: https://www.spsanderson.com/steveondata/posts/2025-11-06/ #Python #TextMessage #Email #Gmail #Twillio #Text

Loops in R? Got you covered. Here is today's post regarding nested for loops. Post: https://www.spsanderson.com/steveondata/posts/2025-11-03/

Here is this weeks R post, it deals with using ollama for RAG. Post: https://www.spsanderson.com/steveondata/posts/2025-10-29/

Today's Python post is about time, datetime, and schedule.
import time

# Measure how long code takes to run
start_time = time.time()

# Your code here
end_time = time.time()
print(f"Execution time: {end_time - start_time} seconds")

# Pause execution for 3 seconds
time.sleep(3)
print("This prints after 3 seconds!")
Post: https://www.spsanderson.com/steveondata/posts/2025-10-23/

My new course with LinkedIn for Learning - Build with AI: SQL Agents with Large Language Models is out! 🚀 Here is what it covers 👇🏼 https://open.substack.com/pub/ramikrispin/p/new-course-build-sql-ai-agent-from?r=1x99er&utm_medium=ios

Today's blog post is a simple one, but still important to your data. Looking at dropping NA values. Post: https://www.spsanderson.com/steveondata/posts/2025-10-20/

Looking at the AIC of my global package downloads using all available util_*_aic functions in my TidyDensity package #R #RSta
Looking at the AIC of my global package downloads using all available util_*_aic functions in my TidyDensity package #R #RStats

I came across a problem yesterday where I wanted to combine .md files from sub directories and place the combined file in each respective directory, so I wrote this:
# Libraries ----
library(tidyverse)

# Directory ----
## Make a list of input directories ----
base_path <- "C:/file/path/"
input_dirs <- list.dirs(base_path)[-1]
input_dir_tbl <- tibble(
  input_dir = input_dirs
) |>
  mutate(output_dir = paste0(input_dir, "/", basename(input_dir), "_combined_files.md"))

input_dir_tbl |>
  group_split(input_dir) |>
  imap(
    .f = function(obj, id){
      input_dir = obj$input_dir
      output_dir = obj$output_dir

      # Check if the directory exists
      if (!dir.exists(input_dir)) {
        stop(paste("Error: Directory", input_dir, "does not exist."))
      }

      # List all .md files in the directory ----
      cat("Searching for .md files in:", input_dir, "\n")
      md_files <- list.files(path = input_dir, pattern = "\\.md$", full.names = TRUE)

      # Check if any .md files were found
      if (length(md_files) == 0) {
        stop("No .md files found in the specified directory.")
      }

      cat("Found", length(md_files), ".md files:\n")
      for (file in md_files) {
        cat("-", basename(file), "\n")
      }

      # Read and combine the contents of all .md files
      cat("\nReading and combining files...\n")
      combined_content <- character(0)

      for (file in md_files) {
        cat("Processing:", basename(file), "\n")
        
        # Add a header separator for each file (optional)
        file_header <- paste("\n<!-- Content from:", basename(file), "-->\n")
        combined_content <- c(combined_content, file_header)
        
        # Read the file content
        file_content <- readLines(file, warn = FALSE)
        combined_content <- c(combined_content, file_content)
        
        # Add some spacing between files
        combined_content <- c(combined_content, "\n")
      }

      # Write the combined content to the output file
      cat("Writing combined content to:", output_dir, "\n")
      writeLines(combined_content, output_dir)

      cat("Successfully combined", length(md_files), ".md files into", output_dir, "\n")
      cat("Total lines written:", length(combined_content), "\n")
    }
  )
Link: https://github.com/spsanderson/random_r_projects/blob/main/combine_md_files.R

I forgot to post my latest Python blog post. So here it is: Post: https://www.spsanderson.com/steveondata/posts/2025-10-01/ Here is a link to audio and video both generated by NotebookLM from Google/Gemini, look on September 30 Dots: https://app.dotadda.io/teams/ab732481-52f3-4388-896c-23d34e828b35/dots?date=2025-09-08&timespan=month #Python

I had shown how to use different imputation methods with healthyR.ai and so now I made a blogpost using that and hai_scale_data() Post: https://www.spsanderson.com/steveondata/posts/2025-09-29/

Visualizing a few different method of imputation using my healthyR.ai package. I'm using the hai_impute_data() function. Refe
+3
Visualizing a few different method of imputation using my healthyR.ai package. I'm using the hai_impute_data() function. Reference: https://www.spsanderson.com/healthyR.ai/reference/hai_data_impute.html

TL;DR: Today I learned how to use Python to work with PDF and Word documents. I shared some simple code and tips for beginners. 🐍📄📝 In today's article, I talk about how you can use Python to handle PDF and Word files. I tried out some beginner-friendly code to pull text from PDFs, combine files, and even make new Word documents. For example, I used the PyPDF2 library to read text from a PDF file:
import PyPDF2

with open('document.pdf', 'rb') as pdf:
    reader = PyPDF2.PdfFileReader(pdf)
    text = reader.getPage(0).extractText()
    print(text)
I also used python-docx to create a Word document with just a few lines of code:
from docx import Document

doc = Document()
doc.add_heading('Hello, Python!', 0)
doc.add_paragraph('This was created automatically.')
doc.save('hello.docx')
I want to mention that I am still learning as I write this series. There might be mistakes or things I could do better. If you notice anything or have advice, please let me know. I appreciate any feedback and hope these examples help you get started with Python and document automation. Thanks for reading. If you have questions or suggestions, feel free to share. #Python #Automation #LearningTogether 🔗 Read more: https://www.spsanderson.com/steveondata/posts/2025-09-24/ My main source of learning: https://automatetheboringstuff.com/2e/chapter15/