This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.chrome.options import Options | |
from selenium.webdriver.chrome.service import Service | |
from bs4 import BeautifulSoup as bs | |
from datetime import datetime | |
import pygsheets | |
import pandas as pd | |
from time import sleep |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rm(list = ls()) | |
library(pdftools) | |
library(magick) | |
library(mbanalytics) | |
library(R6) | |
statement = "E:/Reports/improptu/Oct/KaribuStatement.pdf" | |
# pdf_file <- pdf_convert(statement,pages = 1,dpi = 100) | |
file = pdf_text(pdf = statement) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rm(list = ls()) | |
library(tidyverse) | |
library(R6) | |
# datastes ------ | |
set.seed(1) | |
population1 = tibble(x = rnorm(20.00, 20, 5), | |
y = rnorm(20.00, 15, 5),) | |
population2 = tibble(x = rpois(3231, 50), | |
y = rnorm(3231, 45),) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Basic Statistics" | |
author: "George" | |
date: "8/2/2021" | |
output: html_document | |
--- | |
```{r setup, include=FALSE} | |
knitr::opts_chunk$set(echo = TRUE) | |
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script simulates a simple core banking system in R.Its an illustration of Object oriented programming in R | |
CBS <- R6Class(classname = "CBS",public = list( | |
accs = tibble("Full Name" = NA,"IDNo" = NA,'AccountNo' = NA,'AccountBalance' = NA,'LoanBalance' = NA), | |
bank_name = NA, | |
initialize = function(accs = NULL,bank_name) { | |
self$bank_name = bank_name | |
cat(paste(' --------- \n This is ',self$bank_name,'. \n --------- \n')) | |
}, | |
create_account = function(FirstName=NULL,SecondName=NULL,IDNo=NULL) { | |
FirstName = readline(prompt = "Enter FirstName: ") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# want to keep retryng until a condition is met then run your script?here you go...... | |
library(futile.logger) | |
library(utils) | |
eod_check <- function(){ | |
eod_file = readxl::read_excel('D:/test.xlsx') | |
return(eod_file$Status) | |
} | |
retry_until <- function(expr, maxErrors=5, sleep=0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# i used these linses of code to scrap african gendernames from the internet for one of my projects, it may not help you | |
library(rvest) | |
library(mbanalytics) | |
url = "https://www.momjunction.com/baby-names/african/page/%s/" | |
Allnames = 1:20%>% | |
map_df(~sprintf(url,.) %>% | |
read_html() %>% html_table(fill = T) %>% as.data.frame() %>% | |
select(NAMES,GENDER) %>% filter(!grepl("googletag.cmd.",NAMES),GENDER != "Unisex") %>% | |
mutate(GENDER = ifelse(GENDER == "Boy","M","F"), NAMES = tolower(NAMES))) %>% | |
rename_all(tolower) |