Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- articles <- read.csv(url("https://raw.githubusercontent.com/go95/big_data_intro/master/Abdulkadiroglou.csv"))
- citationNumbers <- articles[,9]
- citationNumbersSorted <- sort(citationNumbers)
- len <- length(citationNumbersSorted)
- indexMatrix <- matrix(0:0, nrow = len, ncol = 2)
- currentValue <- 0
- counter <- 1
- for (i in 1:length(citationNumbersSorted)) {
- if(!is.na(citationNumbersSorted[i]) && currentValue != citationNumbersSorted[i]) {
- indexMatrix[counter, 1] <- citationNumbersSorted[i]
- indexMatrix[counter, 2] <- len - i + 1
- currentValue <- citationNumbersSorted[i]
- counter <- counter + 1
- }
- }
- hirschIndex <- indexMatrix[1,1]
- for(i in 2:length(indexMatrix)) {
- if(indexMatrix[i, 1] > indexMatrix[i, 2]) {
- break
- }
- hirschIndex <- indexMatrix[i, 1]
- }
- print(hirschIndex)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement