0

I calculate internal PageRank of website urls in RStudio+igraph, running following script:

library("igraph")
links <- read.csv("C:/Users/me/Desktop/urls.csv", skip = 1)
links <- subset(links, select=c(Source,Destination))
g <- graph.data.frame(links)
pr <- page.rank(g, algo = "prpack", vids = V(g), directed = TRUE, damping = 0.85)
values <- data.frame(pr$vector)
values$names <- rownames(values)
row.names(values) <- NULL
values <- values[c(2,1)]
names(values)[1] <- "url"
names(values)[2] <- "pr"
write.csv(values, file = "C:/Users/me/Desktop/pr.csv")

Some pageranks are calculated well and get correct numbers, which should be less then 1.

But for some urls, not depending on are there query strings in url or not, pagerank caclulation results look like 9.50442542379295e-05, which are displayed in Excel like 9,50E+09.

What are these numbers and why the calculation fails in those cases? What could i do to calculate correctly? Or is this just other number format, which i'm not familiar with?

Evgeniy
  • 2,337
  • 2
  • 28
  • 68
  • 1
    That just looks like [scientific notation](https://en.wikipedia.org/wiki/Scientific_notation) or (E notation on that page). How exactly does the "calculation fail"? – MrFlick May 30 '17 at 12:58
  • well, my guess seems to be correct - its just another number format, i'm not familiar with – Evgeniy May 30 '17 at 13:11

1 Answers1

2

That's probably just scientific notation. You can disable it either globally:

options(scipen=999)

(revert it back with:)

options(scipen=0)

or just for the function (as suggested here):

format(values, scientific=FALSE)
InspectorSands
  • 2,859
  • 1
  • 18
  • 33