This file contains 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
library(readxl) | |
Stardew_Valley <- read_excel("C:/Users/KGBLAND/endereco_do_arquivo/Stardew_Valley.xlsx") | |
head(Stardew_Valley) | |
names(Stardew_Valley) | |
# Essa variável é quantitativa | |
table(Stardew_Valley$Custo_na_Cidade) | |
# Transformando em variavel quantitativa | |
Stardew_Valley$Custo_na_Cidade<-as.numeric(Stardew_Valley$Custo_na_Cidade) |
This file contains 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
#-------------------------------------------------------------------- | |
# codigo para baixar dados do site | |
#-------------------------------------------------------------------- | |
url_do_rds <- "https://github.com/DATAUNIRIO/Base_de_dados/raw/master/basometro.RDS" | |
url_do_rds <- "https://github.com/DATAUNIRIO/Base_de_dados/raw/master/CARROS.RData" | |
url_do_rds <- "https://github.com/DATAUNIRIO/Base_de_dados/raw/master/BasesEstados.xlsx" | |
#download.file(url,"basometro.RDS",method="curl") # linux | |
download.file(url_do_rds,"basometro.RDS",mode="wb") # windows |
This file contains 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
#------------------------------------------------------------------------------ | |
# CARREGAR A BIBLIOTECA R | |
#------------------------------------------------------------------------------ | |
library(dplyr) | |
#------------------------------------------------------------------------------ | |
# CARREGAR A BASE DE DADOS | |
#------------------------------------------------------------------------------ | |
#load("/home/steven/Área de Trabalho/atendimento/ana_paula_lima/banco/Latinobarometro2016Esp_v20170205.rdata") | |
#load("/home/steven/Área de Trabalho/atendimento/ana_paula_lima/banco/Latinobarometro_2020_Esp_Rdata_v1_0.rdata") |
This file contains 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
#https://dplyr.tidyverse.org/reference/select.html | |
library(dplyr) | |
data("mtcars") | |
dim(mtcars) | |
names(mtcars) | |
banco_inclusao_variaveis <- mtcars %>% select(mpg,disp,hp) | |
banco_exclusao_variaveis <- mtcars %>% select(-c(vs,am,gear)) | |
dim(mtcars) | |
dim(banco_inclusao_variaveis) |
This file contains 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
import os | |
os.getcwd() | |
os.chdir('/home/steven/Documentos/diretorio_py') | |
#-------------------------------------------------------------------------- | |
from GoogleNews import GoogleNews | |
import pandas as pd | |
from time import strftime |
This file contains 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
library(readr) | |
QE <- read_csv('https://raw.githubusercontent.com/DATAUNIRIO/Base_de_dados/master/QE.csv') | |
names(QE) | |
plot(QE$Horas_estudo,QE$Estresse) | |
abline(lsfit(QE$Horas_estudo,QE$Estresse),col="red") | |
modelo <- lm(Estresse~Horas_estudo,data=QE) | |
summary(modelo) | |
residuos <- residuals(modelo) |
This file contains 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
# Aula de integração do R com o Python | |
# Objetivo: Raspar dados de uma tabela com o python e fazer um histograma com o R | |
# Parte 2: script do python | |
import requests | |
from bs4 import BeautifulSoup | |
import os | |
import csv | |
import pandas as pd |
This file contains 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
# Aula de integração do R com o Python | |
# Objetivo: Raspar dados de uma tabela com o python e fazer um histograma com o R | |
# Parte 1 e 3: scripts do R | |
# https://rpubs.com/gomes555/reticulate | |
# https://beatrizmilz.github.io/python-brasil-2021-reticulate/ | |
# https://beatrizmilz.com/blog/2021-python-serie/semana-1-parte-1/ | |
#----------------------------------------------------------------------------- | |
# Parte 0 | |
#----------------------------------------------------------------------------- |
This file contains 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
# Como fazer uma tabela da coluna B com a categoria A selecionada da coluna C | |
# passo 1 - carregar a base de dados | |
load("C:/Users/Hp/Desktop/Base_de_dados-master/Titanic.RData") | |
# passo 2 - grafico de pizza - programação classica | |
pie(table(Titanic$Sobreviveu),col=c("red","blue")) | |
# passo 3 - grafico de pizza com o pipe |
This file contains 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: "Desvio-Padrão e duas variáveis qualitativas" | |
subtitle: "proporção e tabelas" | |
author: "Prof. Steven Dutt Ross" | |
date: "25/04/2022" | |
output: | |
html_document: | |
theme: darkly | |
highlight: tango | |
toc: true |