Collecting individual tweets using the R-script "almEventFetch"

145 views
Skip to first unread message

claudia....@student.hu-berlin.de

unread,
Dec 4, 2013, 11:45:30 AM12/4/13
to plos-api-...@googlegroups.com
Dear Developers

In order to collect individual tweets for a set of PLOS papers based on their DOIs, I tried to execute the R-script " almEventFetch" (https://github.com/articlemetrics/plosOpenR/commit/794864a1997f65abb0ae7e34fe9364bf649c3075).

Before doing so, I installed the rplos-package from https://github.com/articlemetrics/rplos and registered for an API key that I put in my .Rprofile file as described.

When executing the script, R told me that  the function "almplosallviews" could not be found. I changed it to "alm" but unfortunately, R gave me the same response.


My question is now as follows: What changes do I have to make to the script in order to get it running? Or is their another R script available which can be used in order to fetch individual tweets? I am particularly interested in the following information: user (author of the tweet), link to the tweet, date of the tweet and the content of the tweet itself.


I thank you in advance for your support.

Kind regards

Claudia Lienhard
Master's student at the School of Library and Information Science at the Humboldt-Universität zu Berlin

Martin Fenner

unread,
Dec 4, 2013, 11:52:01 AM12/4/13
to plos-api-...@googlegroups.com
Claudia,

the rplos package has undergone significant changes, and the relevant code is now in the alm package. The alm package has a new function called „almevents“ that shows individual tweets per paper and you don’t need the script almEventFetch anymore. The rOpenSci tutorial page at http://ropensci.org/tutorials/alm_tutorial.html includes an example with information about tweets, including user, content of tweet and date.

Best,

Martin

--
You received this message because you are subscribed to the Google Groups "PLOS API Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plos-api-develo...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

claudia....@student.hu-berlin.de

unread,
Dec 5, 2013, 7:34:03 AM12/5/13
to plos-api-...@googlegroups.com
Dear Martin

Thank you for the quick and useful answer!

When looking at the tutorial, I wondered if there is also an example available for collecting detailed tweet data for several DOIs (e.g. by importing data from a .csv-file).
And another question: Is there a limit concerning the numbers of DOIs per request?

Thanks again for your help.

Best regards
Claudia
To unsubscribe from this group and stop receiving emails from it, send an email to plos-api-developers+unsub...@googlegroups.com.

Martin Fenner

unread,
Dec 5, 2013, 7:38:25 AM12/5/13
to plos-api-...@googlegroups.com
Claudia,

the limit of DOIs per request is 50, and the almevents library automatically breaks up the DOis in batches of 30. You can therefore import the data from a CSV file. Let me know if you need some example code.

Best,

Martin

Am 05.12.2013 um 13:34 schrieb claudia....@student.hu-berlin.de<mailto:claudia....@student.hu-berlin.de>:

Dear Martin

Thank you for the quick and useful answer!

When looking at the tutorial, I wondered if there is also an example available for collecting detailed tweet data for several DOIs (e.g. by importing data from a .csv-file).
And another question: Is there a limit concerning the numbers of DOIs per request?

Thanks again for your help.

Best regards
Claudia

On Wednesday, December 4, 2013 5:52:01 PM UTC+1, Martin Fenner wrote:
Claudia,

the rplos package has undergone significant changes, and the relevant code is now in the alm package. The alm package has a new function called „almevents“ that shows individual tweets per paper and you don’t need the script almEventFetch anymore. The rOpenSci tutorial page at http://ropensci.org/tutorials/alm_tutorial.html includes an example with information about tweets, including user, content of tweet and date.

Best,

Martin

Am 04.12.2013 um 17:45 schrieb claudia....@student.hu-<http://student.hu-berlin.de/>berlin.de<http://student.hu-berlin.de/>:

Dear Developers

In order to collect individual tweets for a set of PLOS papers based on their DOIs, I tried to execute the R-script " almEventFetch" (https://github.com/articlemetrics/plosOpenR/commit/794864a1997f65abb0ae7e34fe9364bf649c3075).

Before doing so, I installed the rplos-package from https://github.com/articlemetrics/rplos and registered for an API key that I put in my .Rprofile file as described.

When executing the script, R told me that the function "almplosallviews" could not be found. I changed it to "alm" but unfortunately, R gave me the same response.


My question is now as follows: What changes do I have to make to the script in order to get it running? Or is their another R script available which can be used in order to fetch individual tweets? I am particularly interested in the following information: user (author of the tweet), link to the tweet, date of the tweet and the content of the tweet itself.


I thank you in advance for your support.

Kind regards

Claudia Lienhard
Master's student at the School of Library and Information Science at the Humboldt-Universität zu Berlin

--
You received this message because you are subscribed to the Google Groups "PLOS API Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email toplos-api-devel...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "PLOS API Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plos-api-develo...@googlegroups.com<mailto:plos-api-develo...@googlegroups.com>.
________________________________
Confidentiality Notice: This email and any attachments are solely for the use of the intended recipient, contain confidential and proprietary information, and may be privileged. If you are not the intended recipient (or authorized to receive messages for, or deliver them to, the intended recipient), you may not use, copy, disclose or distribute this email and any attachments. If you think you received this email in error, please notify the sender by return email or by telephone, and delete this email and any attachments from your system.

Disclaimer/Virus Notice: The views or opinions expressed in this email are those of the sender and do not necessarily represent those of Public Library of Science unless otherwise specifically stated. Neither PLOS nor any of its agents accept any responsibility for any viruses that may be contained in this email or any attachments, and it is your responsibility to scan the email and any attachments.

claudia....@student.hu-berlin.de

unread,
Dec 5, 2013, 10:03:25 AM12/5/13
to plos-api-...@googlegroups.com
Dear Martin

Some example code would be great.

Best regards
Claudia


On Thursday, December 5, 2013 1:38:25 PM UTC+1, Martin Fenner wrote:
Claudia,

the limit of DOIs per request is 50, and the almevents library automatically breaks up the DOis in batches of 30. You can therefore import the data from a CSV file. Let me know if you need some example code.

Best,

Martin

To unsubscribe from this group and stop receiving emails from it, send an email toplos-api-developers+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google Groups "PLOS API Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plos-api-developers+unsub...@googlegroups.com<mailto:plos-api-developers+unsub...@googlegroups.com>.

scott_chamberlain

unread,
Dec 5, 2013, 7:02:13 PM12/5/13
to plos-api-...@googlegroups.com
Hi Claudia, 

I am a developer of rplos and alm packages.  How can I help?  What are you searching for?

Scott

On Thursday, December 5, 2013 7:03:25 AM UTC-8, claudia....@student.hu-berlin.de wrote:
Dear Martin

Some example code would be great.

Best regards
Claudia

On Thursday, December 5, 2013 1:38:25 PM UTC+1, Martin Fenner wrote:
Claudia,

the limit of DOIs per request is 50, and the almevents library automatically breaks up the DOis in batches of 30. You can therefore import the data from a CSV file. Let me know if you need some example code.

Best,

Martin

Martin Fenner

unread,
Dec 6, 2013, 3:40:53 AM12/6/13
to plos-api-...@googlegroups.com
Claudia,

a simple example (using the 5 most-tweeted PLOS articles, http://alm.plos.org/sources/twitter) would be the following:

library(alm)

dois <- c("10.1371/journal.pbio.1001535","10.1371/journal.pone.0046362","10.1371/journal.pmed.0020124","10.1371/journal.pntd.0001969","10.1371/journal.pone.0040259")
api_key <- "YOUR_KEY"
events <- almevents(doi=dois, source="twitter",key=api_key)

The variable „events“ now contains close to 5,000 tweets (username, text, datetime), grouped by DOI. You will need to do some reformatting, depending on what you want to do with the information. Scott can give you a more detailed example, but I have the advantage of being in your time zone (I’m based in Hannover, Germany).

Best,

Martin


Am 06.12.2013 um 01:02 schrieb scott_chamberlain <myrmec...@gmail.com<mailto:myrmec...@gmail.com>>:

Hi Claudia,

I am a developer of rplos and alm packages. How can I help? What are you searching for?

Scott

On Thursday, December 5, 2013 7:03:25 AM UTC-8, claudia....@student.hu-berlin.de<http://student.hu-berlin.de> wrote:
Dear Martin

Some example code would be great.

Best regards
Claudia

On Thursday, December 5, 2013 1:38:25 PM UTC+1, Martin Fenner wrote:
Claudia,

the limit of DOIs per request is 50, and the almevents library automatically breaks up the DOis in batches of 30. You can therefore import the data from a CSV file. Let me know if you need some example code.

Best,

Martin

Am 05.12.2013 um 13:34 schrieb claudia....@student.hu-berlin.de<mailto:claudia....@student.hu-berlin.de>:

Dear Martin

Thank you for the quick and useful answer!

When looking at the tutorial, I wondered if there is also an example available for collecting detailed tweet data for several DOIs (e.g. by importing data from a .csv-file).
And another question: Is there a limit concerning the numbers of DOIs per request?

Thanks again for your help.

Best regards
Claudia

On Wednesday, December 4, 2013 5:52:01 PM UTC+1, Martin Fenner wrote:
Claudia,

the rplos package has undergone significant changes, and the relevant code is now in the alm package. The alm package has a new function called „almevents“ that shows individual tweets per paper and you don’t need the script almEventFetch anymore. The rOpenSci tutorial page at http://ropensci.org/tutorials/alm_tutorial.html includes an example with information about tweets, including user, content of tweet and date.

Best,

Martin

Am 04.12.2013 um 17:45 schrieb claudia....@student.hu<http://student.hu>-<http://student.hu-berlin.de/>berlin.de<http://berlin.de/><http://student.hu-berlin.de/>:

Dear Developers

In order to collect individual tweets for a set of PLOS papers based on their DOIs, I tried to execute the R-script " almEventFetch" (https://github.com/articlemetrics/plosOpenR/commit/794864a1997f65abb0ae7e34fe9364bf649c3075).

Before doing so, I installed the rplos-package from https://github.com/articlemetrics/rplos and registered for an API key that I put in my .Rprofile file as described.

When executing the script, R told me that the function "almplosallviews" could not be found. I changed it to "alm" but unfortunately, R gave me the same response.


My question is now as follows: What changes do I have to make to the script in order to get it running? Or is their another R script available which can be used in order to fetch individual tweets? I am particularly interested in the following information: user (author of the tweet), link to the tweet, date of the tweet and the content of the tweet itself.


I thank you in advance for your support.

Kind regards

Claudia Lienhard
Master's student at the School of Library and Information Science at the Humboldt-Universität zu Berlin

--
You received this message because you are subscribed to the Google Groups "PLOS API Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email toplos-api-devel...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google Groups "PLOS API Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plos-api-develo...@googlegroups.com<mailto:plos-api-develo...@googlegroups.com>.
For more options, visit https://groups.google.com/groups/opt_out.


________________________________
Confidentiality Notice: This email and any attachments are solely for the use of the intended recipient, contain confidential and proprietary information, and may be privileged. If you are not the intended recipient (or authorized to receive messages for, or deliver them to, the intended recipient), you may not use, copy, disclose or distribute this email and any attachments. If you think you received this email in error, please notify the sender by return email or by telephone, and delete this email and any attachments from your system.

Disclaimer/Virus Notice: The views or opinions expressed in this email are those of the sender and do not necessarily represent those of Public Library of Science unless otherwise specifically stated. Neither PLOS nor any of its agents accept any responsibility for any viruses that may be contained in this email or any attachments, and it is your responsibility to scan the email and any attachments.

--
You received this message because you are subscribed to the Google Groups "PLOS API Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plos-api-develo...@googlegroups.com<mailto:plos-api-develo...@googlegroups.com>.
Message has been deleted

Martin Fenner

unread,
Dec 6, 2013, 1:07:49 PM12/6/13
to plos-api-...@googlegroups.com
Claudia,

I am happy to help. You will need to talk to the Twitter API directly to get more information about the Twitter user account and/or the Tweet. For PLOS ALM data R is a good choice, both because the excellent alm and rplos R packages and because a number of people have worked with the API using R. Three examples from 2013 are the following publications, and the data and R scripts are available for all of them:

http://dx.doi.org/10.3789/isqv25no2.2013.02
http://dx.doi.org/10.3233/978-1-61499-270-7-77
http://dx.doi.org/10.1371/journal.pbio.10016

Kind regards,

Martin


Am 06.12.2013 um 17:07 schrieb <claudia....@student.hu-berlin.de<mailto:claudia....@student.hu-berlin.de>> <claudia....@student.hu-berlin.de<mailto:claudia....@student.hu-berlin.de>>:

Dear Martin, dear Scott

I highly appreciate your help and support!

Just let me give you the reason why I contacted you. With regard to my master's thesis, I plan to analyse the tweets of PLOS-articles concerning their content and authors.
I am particulary interested in the following questions: Who are the twitterers (origin, professional background)? Are the twitterers connected on Twitter? What types of motivation for twittering on scientific articles can be distinguished?

Of course, I will have to narrow down these questions but I've just started to work on the topic and my first step is to check what information on tweets and authors can be obtained by querying the corresponding APIs (PLOS and Twitter).
I plan to use R to collect the data and as a non-specialist I am really thankful for your support.

@Martin: The script you sent me is a really good starting point for my further research. It is really great that so much detailed information concerning the tweets can be obtained from the ALM-API.

At http://article-level-metrics.plos.org/plos-alm-data/, I also discovered a cumulative ALM report (as of 27.8.2013): How frequently is this report updated?

Best wishes & a nice weekend
Claudia



On Friday, December 6, 2013 9:40:53 AM UTC+1, Martin Fenner wrote:
Claudia,

a simple example (using the 5 most-tweeted PLOS articles, http://alm.plos.org/sources/twitter) would be the following:

library(alm)

dois <- c("10.1371/journal.pbio.1001535","10.1371/journal.pone.0046362","10.1371/journal.pmed.0020124","10.1371/journal.pntd.0001969","10.1371/journal.pone.0040259")
api_key <- "YOUR_KEY"
events <- almevents(doi=dois, source="twitter",key=api_key)

The variable „events“ now contains close to 5,000 tweets (username, text, datetime), grouped by DOI. You will need to do some reformatting, depending on what you want to do with the information. Scott can give you a more detailed example, but I have the advantage of being in your time zone (I’m based in Hannover, Germany).

Best,

Martin


Am 06.12.2013 um 01:02 schrieb scott_chamberlain <myrmec...@gmail.com<http://gmail.com/><mailto:myrmec...@gmail.com<http://gmail.com/>>>:

Hi Claudia,

I am a developer of rplos and alm packages. How can I help? What are you searching for?

Scott

On Thursday, December 5, 2013 7:03:25 AM UTC-8, claudia....@student.hu-berlin.<http://student.hu-berlin.de/>de<http://student.hu-berlin.de/><http://student.hu-berlin.de<http://student.hu-berlin.de/>> wrote:
Dear Martin

Some example code would be great.

Best regards
Claudia

On Thursday, December 5, 2013 1:38:25 PM UTC+1, Martin Fenner wrote:
Claudia,

the limit of DOIs per request is 50, and the almevents library automatically breaks up the DOis in batches of 30. You can therefore import the data from a CSV file. Let me know if you need some example code.

Best,

Martin

Am 05.12.2013 um 13:34 schrieb claudia....@student.hu-berlin.<http://student.hu-berlin.de/>de<http://student.hu-berlin.de/><mailto:claudia....@student.hu-berlin.de<http://student.hu-berlin.de/>>:

Dear Martin

Thank you for the quick and useful answer!

When looking at the tutorial, I wondered if there is also an example available for collecting detailed tweet data for several DOIs (e.g. by importing data from a .csv-file).
And another question: Is there a limit concerning the numbers of DOIs per request?

Thanks again for your help.

Best regards
Claudia

On Wednesday, December 4, 2013 5:52:01 PM UTC+1, Martin Fenner wrote:
Claudia,

the rplos package has undergone significant changes, and the relevant code is now in the alm package. The alm package has a new function called „almevents“ that shows individual tweets per paper and you don’t need the script almEventFetch anymore. The rOpenSci tutorial page at http://ropensci.org/tutorials/alm_tutorial.html includes an example with information about tweets, including user, content of tweet and date.

Best,

Martin

claudia....@student.hu-berlin.de

unread,
Dec 19, 2013, 2:47:22 AM12/19/13
to plos-api-...@googlegroups.com
Dear Martin, dear Scott

May I ask another questin concerning the script below:

When running the script in R, I get the following information "
 invalid input '@elanaorfield Keep doing yo thang. 🠶🠕🠾 http://t.co/t4XOGgCP' in 'utf8towcs'

I guess that this means that I somehow need to disable conversion to UTF8. I tried to do it like that


dois <- c("10.1371/journal.pbio.1001535","10.1371/journal.pone.0046362","10.1371/journal.pmed.0020124","10.1371/journal.pntd.0001969","10.1371/journal.pone.0040259")
api_key <- "XtkS2oVqVcKMyzZZpj9q" 
events <- almevents(doi=dois, source="twitter", key=api_key, forceUtf8Conversion = FALSE)

But unfortunately, adding "forceUTf8Conversion = FALSE" is not accepted by R.

Can you help me to solve this problem?

Thank you again
Claudia
To unsubscribe from this group and stop receiving emails from it, send an email toplos-api-developers+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google Groups "PLOS API Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plos-api-developers+unsub...@googlegroups.com<mailto:plos-api-developers+unsub...@googlegroups.com>.
For more options, visit https://groups.google.com/groups/opt_out.


________________________________
Confidentiality Notice: This email and any attachments are solely for the use of the intended recipient, contain confidential and proprietary information, and may be privileged. If you are not the intended recipient (or authorized to receive messages for, or deliver them to, the intended recipient), you may not use, copy, disclose or distribute this email and any attachments. If you think you received this email in error, please notify the sender by return email or by telephone, and delete this email and any attachments from your system.

Disclaimer/Virus Notice: The views or opinions expressed in this email are those of the sender and do not necessarily represent those of Public Library of Science unless otherwise specifically stated. Neither PLOS nor any of its agents accept any responsibility for any viruses that may be contained in this email or any attachments, and it is your responsibility to scan the email and any attachments.

--
You received this message because you are subscribed to the Google Groups "PLOS API Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plos-api-developers+unsub...@googlegroups.com<mailto:plos-api-developers+unsub...@googlegroups.com>.

scott_chamberlain

unread,
Dec 19, 2013, 11:16:27 AM12/19/13
to plos-api-...@googlegroups.com
Hi Claudia, 

I don't get any errors on the code you posted in your message. Where do you get the error? Further, I have never seen forceUtf8Conversion other than in the twitteR package. Are you getting the error using the almevents function?  

Scott

Brett Buttliere

unread,
Jul 23, 2015, 6:46:14 AM7/23/15
to PLOS API Developers, mfe...@plos.org
Martin, your comments are seriously excellent. thank you! :D 

Brett
Reply all
Reply to author
Forward
0 new messages