How to write the Mesh from PubMed into a data frame
I recently downloaded the RISmed package to download a little under 500,000 article abstracts from PubMed, and I'm trying to input this data into a data frame. My problem comes when trying to include the Mesh data i get the error message
'Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, : arguments imply differing number of rows:'
Is there a way to nest this information into a data frame for analysis?
RCT_topic <- 'randomized clinical trial'
RCT_query <- EUtilsSummary(RCT_topic, mindate=2016, maxdate=2017, retmax=100)
summary(RCT_query)
RCT_records <- EUtilsGet(RCT_query)
RCT_data <- data.frame('PMID'=PMID(RCT_records),
'Title'=ArticleTitle(RCT_records),
'Abstract'=AbstractText(RCT_records),
'YearPublished'=YearPubmed(RCT_records),
'Month.Published'=MonthPubmed(RCT_records),
'Country'=Country(RCT_records),
'Grant'=GrantID(RCT_records),
'Acronym'=Acronym(RCT_records),
'Agency'=Agency(RCT_records),
'Mesh'=Mesh(RCT_records))
r mesh pubmed
add a comment |
I recently downloaded the RISmed package to download a little under 500,000 article abstracts from PubMed, and I'm trying to input this data into a data frame. My problem comes when trying to include the Mesh data i get the error message
'Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, : arguments imply differing number of rows:'
Is there a way to nest this information into a data frame for analysis?
RCT_topic <- 'randomized clinical trial'
RCT_query <- EUtilsSummary(RCT_topic, mindate=2016, maxdate=2017, retmax=100)
summary(RCT_query)
RCT_records <- EUtilsGet(RCT_query)
RCT_data <- data.frame('PMID'=PMID(RCT_records),
'Title'=ArticleTitle(RCT_records),
'Abstract'=AbstractText(RCT_records),
'YearPublished'=YearPubmed(RCT_records),
'Month.Published'=MonthPubmed(RCT_records),
'Country'=Country(RCT_records),
'Grant'=GrantID(RCT_records),
'Acronym'=Acronym(RCT_records),
'Agency'=Agency(RCT_records),
'Mesh'=Mesh(RCT_records))
r mesh pubmed
1
Welcome to SO. - Your question will become more clear when you include a MCVE. stackoverflow.com/help/mcve
– Florian
Nov 24 '18 at 3:04
add a comment |
I recently downloaded the RISmed package to download a little under 500,000 article abstracts from PubMed, and I'm trying to input this data into a data frame. My problem comes when trying to include the Mesh data i get the error message
'Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, : arguments imply differing number of rows:'
Is there a way to nest this information into a data frame for analysis?
RCT_topic <- 'randomized clinical trial'
RCT_query <- EUtilsSummary(RCT_topic, mindate=2016, maxdate=2017, retmax=100)
summary(RCT_query)
RCT_records <- EUtilsGet(RCT_query)
RCT_data <- data.frame('PMID'=PMID(RCT_records),
'Title'=ArticleTitle(RCT_records),
'Abstract'=AbstractText(RCT_records),
'YearPublished'=YearPubmed(RCT_records),
'Month.Published'=MonthPubmed(RCT_records),
'Country'=Country(RCT_records),
'Grant'=GrantID(RCT_records),
'Acronym'=Acronym(RCT_records),
'Agency'=Agency(RCT_records),
'Mesh'=Mesh(RCT_records))
r mesh pubmed
I recently downloaded the RISmed package to download a little under 500,000 article abstracts from PubMed, and I'm trying to input this data into a data frame. My problem comes when trying to include the Mesh data i get the error message
'Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, : arguments imply differing number of rows:'
Is there a way to nest this information into a data frame for analysis?
RCT_topic <- 'randomized clinical trial'
RCT_query <- EUtilsSummary(RCT_topic, mindate=2016, maxdate=2017, retmax=100)
summary(RCT_query)
RCT_records <- EUtilsGet(RCT_query)
RCT_data <- data.frame('PMID'=PMID(RCT_records),
'Title'=ArticleTitle(RCT_records),
'Abstract'=AbstractText(RCT_records),
'YearPublished'=YearPubmed(RCT_records),
'Month.Published'=MonthPubmed(RCT_records),
'Country'=Country(RCT_records),
'Grant'=GrantID(RCT_records),
'Acronym'=Acronym(RCT_records),
'Agency'=Agency(RCT_records),
'Mesh'=Mesh(RCT_records))
r mesh pubmed
r mesh pubmed
edited Nov 25 '18 at 21:39
marc_s
578k12911161262
578k12911161262
asked Nov 24 '18 at 2:08
Manny MaManny Ma
25
25
1
Welcome to SO. - Your question will become more clear when you include a MCVE. stackoverflow.com/help/mcve
– Florian
Nov 24 '18 at 3:04
add a comment |
1
Welcome to SO. - Your question will become more clear when you include a MCVE. stackoverflow.com/help/mcve
– Florian
Nov 24 '18 at 3:04
1
1
Welcome to SO. - Your question will become more clear when you include a MCVE. stackoverflow.com/help/mcve
– Florian
Nov 24 '18 at 3:04
Welcome to SO. - Your question will become more clear when you include a MCVE. stackoverflow.com/help/mcve
– Florian
Nov 24 '18 at 3:04
add a comment |
1 Answer
1
active
oldest
votes
Consider using a tibble:
library(RISmed)
library(dplyr) # tibble and other functions
RCT_topic <- 'randomized clinical trial'
RCT_query <- EUtilsSummary(RCT_topic, mindate=2016, maxdate=2017, retmax=100)
summary(RCT_query)
RCT_records <- EUtilsGet(RCT_query)
RCT_data <- data_frame('PMID'=PMID(RCT_records),
'Title'=ArticleTitle(RCT_records),
'Abstract'=AbstractText(RCT_records),
'YearPublished'=YearPubmed(RCT_records),
'Month.Published'=MonthPubmed(RCT_records),
'Country'= Country(RCT_records),
'Grant' =GrantID(RCT_records),
'Acronym' =Acronym(RCT_records),
'Agency' =Agency(RCT_records),
'Mesh'=Mesh(RCT_records))
The Mesh
column is now a list of dataframes:
select(RCT_data, PMID, Mesh)
# # A tibble: 100 x 2
# PMID Mesh
# <chr> <list>
# 1 29288775 <data.frame [21 × 2]>
# 2 29288545 <data.frame [19 × 2]>
# 3 29288510 <data.frame [15 × 2]>
# 4 29288507 <data.frame [19 × 2]>
# 5 29288478 <data.frame [16 × 2]>
# 6 29288309 <data.frame [19 × 2]>
# 7 29288191 <data.frame [11 × 2]>
# 8 29288190 <data.frame [23 × 2]>
# 9 29288184 <data.frame [21 × 2]>
# 10 29288175 <data.frame [12 × 2]>
# # ... with 90 more rows
OMG it works like a charm thank you very much,
– Manny Ma
Nov 24 '18 at 4:09
saving this data frame wouldn't work for a csv correct? what would be the correct format to be able to export data frame ingrained with data frames?
– Manny Ma
Nov 26 '18 at 21:39
Usually, you would raise follow-up questions as a new question. This will allow others to find the answer. In the mean time, you can check out github.com/tidyverse/tibble/issues/202 (or just save it as an RDS file).
– Weihuang Wong
Nov 27 '18 at 3:40
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53454612%2fhow-to-write-the-mesh-from-pubmed-into-a-data-frame%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Consider using a tibble:
library(RISmed)
library(dplyr) # tibble and other functions
RCT_topic <- 'randomized clinical trial'
RCT_query <- EUtilsSummary(RCT_topic, mindate=2016, maxdate=2017, retmax=100)
summary(RCT_query)
RCT_records <- EUtilsGet(RCT_query)
RCT_data <- data_frame('PMID'=PMID(RCT_records),
'Title'=ArticleTitle(RCT_records),
'Abstract'=AbstractText(RCT_records),
'YearPublished'=YearPubmed(RCT_records),
'Month.Published'=MonthPubmed(RCT_records),
'Country'= Country(RCT_records),
'Grant' =GrantID(RCT_records),
'Acronym' =Acronym(RCT_records),
'Agency' =Agency(RCT_records),
'Mesh'=Mesh(RCT_records))
The Mesh
column is now a list of dataframes:
select(RCT_data, PMID, Mesh)
# # A tibble: 100 x 2
# PMID Mesh
# <chr> <list>
# 1 29288775 <data.frame [21 × 2]>
# 2 29288545 <data.frame [19 × 2]>
# 3 29288510 <data.frame [15 × 2]>
# 4 29288507 <data.frame [19 × 2]>
# 5 29288478 <data.frame [16 × 2]>
# 6 29288309 <data.frame [19 × 2]>
# 7 29288191 <data.frame [11 × 2]>
# 8 29288190 <data.frame [23 × 2]>
# 9 29288184 <data.frame [21 × 2]>
# 10 29288175 <data.frame [12 × 2]>
# # ... with 90 more rows
OMG it works like a charm thank you very much,
– Manny Ma
Nov 24 '18 at 4:09
saving this data frame wouldn't work for a csv correct? what would be the correct format to be able to export data frame ingrained with data frames?
– Manny Ma
Nov 26 '18 at 21:39
Usually, you would raise follow-up questions as a new question. This will allow others to find the answer. In the mean time, you can check out github.com/tidyverse/tibble/issues/202 (or just save it as an RDS file).
– Weihuang Wong
Nov 27 '18 at 3:40
add a comment |
Consider using a tibble:
library(RISmed)
library(dplyr) # tibble and other functions
RCT_topic <- 'randomized clinical trial'
RCT_query <- EUtilsSummary(RCT_topic, mindate=2016, maxdate=2017, retmax=100)
summary(RCT_query)
RCT_records <- EUtilsGet(RCT_query)
RCT_data <- data_frame('PMID'=PMID(RCT_records),
'Title'=ArticleTitle(RCT_records),
'Abstract'=AbstractText(RCT_records),
'YearPublished'=YearPubmed(RCT_records),
'Month.Published'=MonthPubmed(RCT_records),
'Country'= Country(RCT_records),
'Grant' =GrantID(RCT_records),
'Acronym' =Acronym(RCT_records),
'Agency' =Agency(RCT_records),
'Mesh'=Mesh(RCT_records))
The Mesh
column is now a list of dataframes:
select(RCT_data, PMID, Mesh)
# # A tibble: 100 x 2
# PMID Mesh
# <chr> <list>
# 1 29288775 <data.frame [21 × 2]>
# 2 29288545 <data.frame [19 × 2]>
# 3 29288510 <data.frame [15 × 2]>
# 4 29288507 <data.frame [19 × 2]>
# 5 29288478 <data.frame [16 × 2]>
# 6 29288309 <data.frame [19 × 2]>
# 7 29288191 <data.frame [11 × 2]>
# 8 29288190 <data.frame [23 × 2]>
# 9 29288184 <data.frame [21 × 2]>
# 10 29288175 <data.frame [12 × 2]>
# # ... with 90 more rows
OMG it works like a charm thank you very much,
– Manny Ma
Nov 24 '18 at 4:09
saving this data frame wouldn't work for a csv correct? what would be the correct format to be able to export data frame ingrained with data frames?
– Manny Ma
Nov 26 '18 at 21:39
Usually, you would raise follow-up questions as a new question. This will allow others to find the answer. In the mean time, you can check out github.com/tidyverse/tibble/issues/202 (or just save it as an RDS file).
– Weihuang Wong
Nov 27 '18 at 3:40
add a comment |
Consider using a tibble:
library(RISmed)
library(dplyr) # tibble and other functions
RCT_topic <- 'randomized clinical trial'
RCT_query <- EUtilsSummary(RCT_topic, mindate=2016, maxdate=2017, retmax=100)
summary(RCT_query)
RCT_records <- EUtilsGet(RCT_query)
RCT_data <- data_frame('PMID'=PMID(RCT_records),
'Title'=ArticleTitle(RCT_records),
'Abstract'=AbstractText(RCT_records),
'YearPublished'=YearPubmed(RCT_records),
'Month.Published'=MonthPubmed(RCT_records),
'Country'= Country(RCT_records),
'Grant' =GrantID(RCT_records),
'Acronym' =Acronym(RCT_records),
'Agency' =Agency(RCT_records),
'Mesh'=Mesh(RCT_records))
The Mesh
column is now a list of dataframes:
select(RCT_data, PMID, Mesh)
# # A tibble: 100 x 2
# PMID Mesh
# <chr> <list>
# 1 29288775 <data.frame [21 × 2]>
# 2 29288545 <data.frame [19 × 2]>
# 3 29288510 <data.frame [15 × 2]>
# 4 29288507 <data.frame [19 × 2]>
# 5 29288478 <data.frame [16 × 2]>
# 6 29288309 <data.frame [19 × 2]>
# 7 29288191 <data.frame [11 × 2]>
# 8 29288190 <data.frame [23 × 2]>
# 9 29288184 <data.frame [21 × 2]>
# 10 29288175 <data.frame [12 × 2]>
# # ... with 90 more rows
Consider using a tibble:
library(RISmed)
library(dplyr) # tibble and other functions
RCT_topic <- 'randomized clinical trial'
RCT_query <- EUtilsSummary(RCT_topic, mindate=2016, maxdate=2017, retmax=100)
summary(RCT_query)
RCT_records <- EUtilsGet(RCT_query)
RCT_data <- data_frame('PMID'=PMID(RCT_records),
'Title'=ArticleTitle(RCT_records),
'Abstract'=AbstractText(RCT_records),
'YearPublished'=YearPubmed(RCT_records),
'Month.Published'=MonthPubmed(RCT_records),
'Country'= Country(RCT_records),
'Grant' =GrantID(RCT_records),
'Acronym' =Acronym(RCT_records),
'Agency' =Agency(RCT_records),
'Mesh'=Mesh(RCT_records))
The Mesh
column is now a list of dataframes:
select(RCT_data, PMID, Mesh)
# # A tibble: 100 x 2
# PMID Mesh
# <chr> <list>
# 1 29288775 <data.frame [21 × 2]>
# 2 29288545 <data.frame [19 × 2]>
# 3 29288510 <data.frame [15 × 2]>
# 4 29288507 <data.frame [19 × 2]>
# 5 29288478 <data.frame [16 × 2]>
# 6 29288309 <data.frame [19 × 2]>
# 7 29288191 <data.frame [11 × 2]>
# 8 29288190 <data.frame [23 × 2]>
# 9 29288184 <data.frame [21 × 2]>
# 10 29288175 <data.frame [12 × 2]>
# # ... with 90 more rows
edited Nov 25 '18 at 21:39
marc_s
578k12911161262
578k12911161262
answered Nov 24 '18 at 3:42
Weihuang WongWeihuang Wong
9,6801835
9,6801835
OMG it works like a charm thank you very much,
– Manny Ma
Nov 24 '18 at 4:09
saving this data frame wouldn't work for a csv correct? what would be the correct format to be able to export data frame ingrained with data frames?
– Manny Ma
Nov 26 '18 at 21:39
Usually, you would raise follow-up questions as a new question. This will allow others to find the answer. In the mean time, you can check out github.com/tidyverse/tibble/issues/202 (or just save it as an RDS file).
– Weihuang Wong
Nov 27 '18 at 3:40
add a comment |
OMG it works like a charm thank you very much,
– Manny Ma
Nov 24 '18 at 4:09
saving this data frame wouldn't work for a csv correct? what would be the correct format to be able to export data frame ingrained with data frames?
– Manny Ma
Nov 26 '18 at 21:39
Usually, you would raise follow-up questions as a new question. This will allow others to find the answer. In the mean time, you can check out github.com/tidyverse/tibble/issues/202 (or just save it as an RDS file).
– Weihuang Wong
Nov 27 '18 at 3:40
OMG it works like a charm thank you very much,
– Manny Ma
Nov 24 '18 at 4:09
OMG it works like a charm thank you very much,
– Manny Ma
Nov 24 '18 at 4:09
saving this data frame wouldn't work for a csv correct? what would be the correct format to be able to export data frame ingrained with data frames?
– Manny Ma
Nov 26 '18 at 21:39
saving this data frame wouldn't work for a csv correct? what would be the correct format to be able to export data frame ingrained with data frames?
– Manny Ma
Nov 26 '18 at 21:39
Usually, you would raise follow-up questions as a new question. This will allow others to find the answer. In the mean time, you can check out github.com/tidyverse/tibble/issues/202 (or just save it as an RDS file).
– Weihuang Wong
Nov 27 '18 at 3:40
Usually, you would raise follow-up questions as a new question. This will allow others to find the answer. In the mean time, you can check out github.com/tidyverse/tibble/issues/202 (or just save it as an RDS file).
– Weihuang Wong
Nov 27 '18 at 3:40
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53454612%2fhow-to-write-the-mesh-from-pubmed-into-a-data-frame%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Welcome to SO. - Your question will become more clear when you include a MCVE. stackoverflow.com/help/mcve
– Florian
Nov 24 '18 at 3:04