Skip to content

Instantly share code, notes, and snippets.

View allatambov's full-sized avatar

Alla Tambovtseva allatambov

  • Moscow
View GitHub Profile
install.packages("tidyverse")
library(tidyverse)
anames <- read.csv("https://allatambov.github.io/twimc/names.csv", encoding = "UTF-8")
names18 <- anames %>% filter(Year == 2018 & Month == "январь")
names18_f <- names18 %>% filter(Sex == "female")
names18_m <- names18 %>% filter(Sex == "male")
tree <- read.csv("https://allatambov.github.io/rprog/data/firtree.csv", encoding = "UTF-8")
table(tree$ftype)
barplot(table(tree$ftype), col = c("forestgreen", "green4", "springgreen3", "springgreen3"),
main = "Хвойные деревья", xlab = "Виды деревьев", ylab = "Частоты",
axes = FALSE)
axis(2, at = seq(from = 0, to = 350, by = 20))
######### DATA LOADING #########
popular <- read.csv("https://raw.githubusercontent.com/allatambov/allatambov.github.io/master/rprog21/history.csv",
stringsAsFactors = TRUE)
summary(popular)
n <- nrow(popular)
######### DATA FILTERING #########
library(shiny)
### PUT HERE CODE FOR LOADING dat AND FOR NA-DELETION ###
dat <- read.csv("https://vincentarelbundock.github.io/Rdatasets/csv/carData/Chile.csv")
dat <- na.omit(dat)
reg_values <- sort(c("All", unique(dat$region)))
reg_names <- c("All", "Central", "Metropolitan Santiago area", "North",
"South", "City of Santiago")
#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
# summary - different to vector, data.frame, model
v <- c(1, 6, 7)
class(v)
summary(v)
mtcars
class(mtcars)
summary(mtcars)
### Titanic data ###
# http://campus.lakeforest.edu/frank/FILES/MLFfiles/Bio150/Titanic/TitanicMETA.pdf
titan <- read.csv("https://allatambov.github.io/psms/titanic.csv")
summary(titan)
table(titan$Survived, titan$Pclass)
chisq.test(titan$Survived, titan$Pclass)
library(RSelenium)
rd <- rsDriver(browser="chrome",
extraCapabilities = list("/Users/allat/Desktop/chromedriver"), check = F,
chromever="83.0.4103.14")
browser <- rd$client
browser$navigate("https://twitter.com/explore")
# $python since:2020-05-20 until:2020-05-25
keyword <- "$python"
revelio <- function(object){NA}
setGeneric("revelio")
setMethod("revelio", signature(object = "Cauldron"),
function(object) {
y <- -10:10
x <- y ** 2
z <- seq(20, 80, length.out = 100)
plot(x, y, type = 'l', ylim=c(-4, 4),
xlab = "", ylab = "", axes=FALSE)
lines(-x + 100, y)
#install.packages("RSelenium")
library(RSelenium)
rd <- rsDriver(browser="firefox", check = F)
browser <- rd$client
browser$navigate("https://twitter.com/explore")
input <- browser$findElement(using = "xpath", "//input[@enterkeyhint='search']")
input$sendKeysToElement(list("$python", key = 'enter'))