Hello,
I’m having trouble connecting the Altmetric api w/ R. I can perform the two major functions (altmetrics()) and (altmetric_data()) with no problem. However, is there a way to get more info than what I’m currently getting (which would be what is documented on the rAltmetrics OpenSci and GH: http://ropensci.github.io/rAltmetric/) when I perform a call. The information I’m referring to is in this sample api response: https://help.altmetric.com/support/solutions/articles/6000086844-sample-api-response. It includes more in-depth information about an article. Am I missing something important? I have an api key as well, but it produces the same results. Thank you for your help in advance!
Here’s what I have so far:
library(ggplot2)
library(reshape2)
library(RCurl)
library(rAltmetric)
library(plyr)
library(png)
url <- "https://api.altmetric.com/v1/"
key <- “myKey"
altmetric_data(altmetrics(pmid = "/21148220",
apikey = getOption(“myKey")))
path <- “should this be included?"
I don’t want R to automatically turn character strings in factors variables, so I turned this feature off:
options(stringsAsFactors = FALSE)
@karthik
Hi @JasJaxon
Sorry for the delay. I realized it’s been so many years since I wrote rAltmetric
and the infrastructure underlying it is so dated. I just pushed a substantial update to the package (I have not finished the generic plot method but that’s not critical).
So reinstall the package first:
install_github("ropensci/rAltmetric")
Version should be rAltmetric * 0.7.9000
Then run
library(rAltmetric)
library(dplyr)
df <- altmetrics(pmid = "21148220") %>% altmetric_data
names(df)
will reveal more than 80 fields.
[1] "title"
[2] "doi"
[3] "pmid"
[4] "pmc"
[5] "tq1"
[6] "tq2"
[7] "tq3"
[8] "tq4"
[9] "tq5"
[10] "altmetric_jid"
[11] "issns1"
[12] "issns2"
[13] "journal"
[14] "cohorts.doc"
[15] "cohorts.pub"
[16] "cohorts.com"
[17] "cohorts.sci"
[18] "abstract"
[19] "abstract_source"
[20] "context.all.count"
[21] "context.all.mean"
[22] "context.all.rank"
[23] "context.all.pct"
[24] "context.all.higher_than"
[25] "context.journal.count"
[26] "context.journal.mean"
[27] "context.journal.rank"
[28] "context.journal.pct"
[29] "context.journal.higher_than"
[30] "context.similar_age_3m.count"
[31] "context.similar_age_3m.mean"
[32] "context.similar_age_3m.rank"
[33] "context.similar_age_3m.pct"
[34] "context.similar_age_3m.higher_than"
[35] "context.similar_age_journal_3m.count"
[36] "context.similar_age_journal_3m.mean"
[37] "context.similar_age_journal_3m.rank"
[38] "context.similar_age_journal_3m.pct"
[39] "context.similar_age_journal_3m.higher_than"
[40] "type"
[41] "altmetric_id"
[42] "schema"
[43] "is_oa"
[44] "publisher_subjects.name"
[45] "publisher_subjects.scheme"
[46] "cited_by_fbwalls_count"
[47] "cited_by_feeds_count"
[48] "cited_by_gplus_count"
[49] "cited_by_posts_count"
[50] "cited_by_qna_count"
[51] "cited_by_tweeters_count"
[52] "cited_by_accounts_count"
[53] "last_updated"
[54] "score"
[55] "history.1y"
[56] "history.6m"
[57] "history.3m"
[58] "history.1m"
[59] "history.1w"
[60] "history.6d"
[61] "history.5d"
[62] "history.4d"
[63] "history.3d"
[64] "history.2d"
[65] "history.1d"
[66] "history.at"
[67] "url"
[68] "added_on"
[69] "published_on"
[70] "subjects"
[71] "scopus_subjects1"
[72] "scopus_subjects2"
[73] "readers.citeulike"
[74] "readers.mendeley"
[75] "readers.connotea"
[76] "readers_count"
[77] "images.small"
[78] "images.medium"
[79] "images.large"
[80] "details_url"
Is this what you were looking for?
1 Like
Hello Karthik,
I do appreciate your response. Yes, this a more detailed response, however,
no it does not contain the fields I was looking for.
I was not sure if the package produced responses similar to those from the
api’s documentation. I am looking for twitter timestamps for multiple
articles, like the response here, for example: https://api.altmetric.com/docs/call_fetch.html
Thank you.
Hi @JasJaxon
Sorry I missed this. I’ll update the package again shortly to see if I can grab these additional metrics.
1 Like