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
d <- data.frame(alpha=1:3, beta=4:6, gamma=7:9) | |
# alpha beta gamma | |
# 1 4 7 | |
# 2 5 8 | |
# 3 6 9 | |
names(d) | |
# "alpha" "beta" "gamma" | |
The simplest way is to use rename() from the plyr package: |
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
# Andrzej Kostanski [email protected] | |
# sciezka do pliku z danym wejsciowymi | |
input_path<-"/Users/andi/Desktop/EM-ALGORITHM/r-generowanie/input.csv" | |
output_path<-"/Users/andi/Desktop/EM-ALGORITHM/r-generowanie/output.csv" | |
con<-file(input_path) | |
# n oznacza liczbe wszystkich losowan | |
n<-readLines(con,1) | |
close(con) |
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
troia_input<-subset(d_eval,select=c(person_id,document_id,documentevaluation_credibility)) |
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
troia_input_without_na <- troia_input[!is.na(troia_input$documentevaluation_credibility),] |
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
library(plyr) | |
#zwroci tabele zawierajaca w pierwszej kolumnie liczbe ile-krotnie strona zostala oceniona, a w drugiej ile stron z calego zbioru dotyczyla tylokrotna ocena. | |
count(count(d_eval,"document_id"),"freq") |
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
> m <- matrix(sample(c(NA, 1:10), 100, replace = TRUE), 10) | |
> d <- as.data.frame(m) | |
V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 | |
1 4 3 NA 3 7 6 6 10 6 5 | |
2 9 8 9 5 10 NA 2 1 7 2 | |
3 1 1 6 3 6 NA 1 4 1 6 | |
4 NA 4 NA 7 10 2 NA 4 1 8 | |
5 1 2 4 NA 2 6 2 6 7 4 | |
6 NA 3 NA NA 10 2 1 10 8 4 | |
7 4 4 9 10 9 8 9 4 10 NA |
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
wlasna<-function(lista) { | |
#l<-as.data.frame(lista) | |
print(class(lista)) | |
print(lista) | |
sumka=0 | |
for (i in 1:length(lista)){ | |
#print(i) | |
sumka=sumka+lista[i] | |
print(sumka) | |
} |
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
#wczytanie danych dotyczacych ocen stron przez mturkow | |
DANE_IBR="/Users/andi/Desktop/RECONCILE/IBR.csv" | |
DANE_BIG="/Users/andi/Desktop/RECONCILE/DANE_evaluations.csv" | |
d_eval<-read.csv(DANE_BIG, header=TRUE, sep=";") | |
library(matrixStats) | |
library(R.methodsS3) |
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
adamw_classifier<-function(lista){ | |
# co najmniej 2 oceny=5 -> strona trafia do klasy HC (Highly Credibly) | |
# co najmniej 2 oceny=4 -> strona trafia do klasy N (Neutral) | |
# co najmniej 2 oceny<4 -> strona trafia do klasy HNC (Highly Not Credible) | |
print(lista) | |
for (i in 1:length(lista)){ | |
lista[i]=notna(lista[i]) | |
} | |
print(lista) | |
df<-data.frame(table(lista)) |
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
#wczytanie danych dotyczacych ocen stron przez mturkow | |
d_eval<-read.csv("/Users/andi/Desktop/RECONCILE/DANE_evaluations.csv", header=TRUE, sep=";") | |
library(matrixStats) | |
library(R.methodsS3) | |