Skip to content

Instantly share code, notes, and snippets.

View Elaine-AL's full-sized avatar
🏢
Working from home

Elaine AL Elaine-AL

🏢
Working from home
View GitHub Profile
@Elaine-AL
Elaine-AL / update_migrate.R
Created February 22, 2021 13:09 — forked from arcaravaggi/update_migrate.R
Update R and migrate R packages to new installation from within the console
#From https://stackoverflow.com/questions/1401904/painless-way-to-install-a-new-version-of-r
# Run in the old version of R (or via RStudio)
setwd("C:/Temp/")
packages <- installed.packages()[,"Package"]
save(packages, file="Rpackages")
# INSTALL NEW R VERSION
if(!require(installr)) { install.packages("installr"); require(installr)} #load / install+load installr
# See here for more on installr: https://www.r-statistics.com/2013/03/updating-r-from-r-on-windows-using-the-installr-package/
@Elaine-AL
Elaine-AL / dates.r
Last active November 13, 2019 08:55
Getting the first day of every month for a specific range of dates
start_date = "2018/12/5"
end_date = "2019/7/27"
data.frame(start = seq.Date(from = floor_date(as.Date("2018/12/3"), "month"),
to = floor_date(as.Date("2019/7/26"), "month"),
by = "month")
)
# Here are the results!!
# start
@Elaine-AL
Elaine-AL / apps_average_rating.py
Created May 10, 2019 18:51
My first python program!
open_file = open("AppleStore.csv")
from csv import reader
read_file = reader(open_file)
apps_dataset = list(read_file)
rating_sum = 0
for each_row in apps_dataset[1: ]:
rating = float(each_row[7])
rating_sum += rating