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
# Optimal Sample Allocation in case of non-response | |
require(ggplot2) | |
# 3D Scatterplot | |
require(rgl) | |
require(foreach) | |
require(doMC) | |
registerDoMC(cores = detectCores()) |
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
### Plotting in R on Google Maps | |
require(ggmap) | |
require(data.table) | |
### 1 ### | |
# If you have coordinates available, go to 2 | |
# This is a way how to get some coordinates |
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
extr.ciems <- function(adr_txt) { | |
# Konvertē visu uz mazajiem burtiem | |
adr_txt <- tolower(adr_txt) | |
# Teksta fragmenti, kas neder | |
pattern <- " nov| pag|\"|[0-9]|\\." | |
# Sadala adresi pa fragmentiem, izvēlas derīgos, apgriež otrādi un paņem 1. | |
x <- sapply(strsplit(adr_txt, split = ", "), | |
function(txt) trim(rev(grep(pattern, txt, | |
value = T, invert = T))[1])) | |
# Izlabo kļūdu, kad beidzas ar ā |
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
### Apsekojumu statistika | |
### Praktiskie darbi 2 | |
# Direktorija datiem | |
# Pirmajā reizē ir jāizveido | |
dir.data <- "~/ApsStat/Data" | |
# Saite uz datu failu | |
file.data <- file.path("http://home.lu.lv/~pm90015/work/LU", | |
"ApsekojumuStatistika/Data/Population.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
### Apsekojumu statistika | |
### Praktiskie darbi 3 | |
# Bibliotekas #### | |
# Bibliotēku instalācija, ja nepieciešams | |
# install.packages(c("Rcpp", "BalacedSampling", "sampling")) | |
require(data.table) | |
require(sampling) |
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
### Apsekojumu statistika | |
### Praktiskie darbi 4 | |
# Bibliotekas #### | |
require(data.table) | |
require(sampling) | |
require(foreach) | |
require(ggplot2) | |
require(tools) |
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
### Apsekojumu statistika | |
### Praktiskie darbi 5 | |
### Precizitātes novērtēšana | |
# Bibliotekas #### | |
require(data.table) | |
require(sampling) | |
require(foreach) | |
require(ggplot2) |
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
# Stirnu buks | |
# 2017 | |
# Pokaiņi | |
# Distance: Buks | |
require(rvest) | |
require(data.table) | |
require(ggplot2) | |
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://codegolf.stackexchange.com/questions/138570/disappearing-elements | |
f=function(S,X)Reduce(`[`,-X-1,S,,T) | |
f(el(strsplit("codegolf", "")), c(1, 4, 4, 0, 2)) | |
f(el(strsplit("abc", "")), 0) | |
f(el(strsplit("abc", "")), vector("integer")) |
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
1 | |
1 0 1 | |
0 0 1 0 0 |
OlderNewer