SHARE
TWEET

Untitled

a guest Sep 17th, 2019 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. articles <- read.csv(url("https://raw.githubusercontent.com/go95/big_data_intro/master/Abdulkadiroglou.csv"))
  2. citationNumbers <- articles[,9]
  3. citationNumbersSorted <- sort(citationNumbers)
  4. len <- length(citationNumbersSorted)
  5. indexMatrix <- matrix(0:0, nrow = len, ncol = 2)
  6. currentValue <- 0
  7. counter <- 1
  8. for (i in 1:length(citationNumbersSorted)) {
  9.     if(!is.na(citationNumbersSorted[i]) && currentValue != citationNumbersSorted[i]) {
  10.         indexMatrix[counter, 1] <- citationNumbersSorted[i]
  11.         indexMatrix[counter, 2] <- len - i + 1
  12.         currentValue <- citationNumbersSorted[i]
  13.         counter <- counter + 1
  14.     }
  15. }
  16. hirschIndex <- indexMatrix[1,1]
  17. for(i in 2:length(indexMatrix)) {
  18.     if(indexMatrix[i, 1] > indexMatrix[i, 2]) {
  19.         break
  20.     }
  21.     hirschIndex <- indexMatrix[i, 1]
  22. }
  23. print(hirschIndex)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top