Closed
Description
Dear OpenalexR support team,
Please could you advise on improving this R script using openalexR which was working last week but is now reporting an error. I have reinstalled the openalexR package today.
I have a dataframe called UoA_researchers imported from a csv file containing Openalex IDs.
# create a dataframe the size of the number of researchers in the input file
data <- numeric(length(UoA_researchers$OpenalexID))
# populate the dataframe with the results of our Openalex searches
for(i in seq_along(UoA_researchers))
{
# For Loop to run repeated searches of Openalex
data <- oa_fetch(
identifier = UoA_researchers$OpenalexID,
entity = "authors",
mailto = "my_email@example.com", # politeness, please use your own email address
verbose = FALSE
)
}
# let's have a look at the retrieved data
head(data)
# add some context to each line
data <- data |>
select(display_name, id, orcid) |>
mutate(uoa = "20", unit = "Social Work and Social Policy")
# and write the results to a file. Change the filename to reflect the UoA.
write_csv(data, "openalex_researchers_UoA20.csv")
=====
However, I am getting an error message:
Error in if (is.na(sub_affiliation[[1]])) { :
the condition has length > 1
5.
authors2df(data, verbose)
4.
FUN(X[[i]], ...)
3.
lapply(final_res, oa2df, entity = entity, options = options,
abstract = abstract, count_only = count_only, group_by = group_by,
verbose = verbose)
2.
do.call(rbind, lapply(final_res, oa2df, entity = entity, options = options,
abstract = abstract, count_only = count_only, group_by = group_by,
verbose = verbose))
1.
oa_fetch(identifier = UoA_researchers$OpenalexID, entity = "authors",
mailto = "pka@dmu.ac.uk", verbose = FALSE)
Metadata
Metadata
Assignees
Labels
No labels