Conversation
…last names less likely to discard information
|
last chance to review @dmullen17 I'd like to merge this soon |
dmullen17
left a comment
There was a problem hiding this comment.
Looks great to me! I tested all of the edge cases I could think of but wasn't able to make it fail ungracefully. Added a couple general syntax comments but none of those changes are necessary.
| result <- lapply(award_nums, function(x){ | ||
| url <- paste0("https://api.nsf.gov/services/v1/awards.json?id=", x ,"&printFields=coPDPI,pdPIName,title") | ||
|
|
||
| t <- jsonlite::fromJSON(url) |
There was a problem hiding this comment.
Any reason this is named t? Doesn't need to be changed just wondering
There was a problem hiding this comment.
not really, just a short placeholder name. response would be a natural name but the return value for fromJSON already has response in it
R/eml.R
Outdated
|
|
||
| # create function to extract first name and middle initial (if present) | ||
| # as firstName, and whatever else exists as lastName | ||
| extract_name <- function(x){ |
There was a problem hiding this comment.
should this be defined outside the function body as a helper?
There was a problem hiding this comment.
hm. I don't think so. This is pretty specific to how the NSF API formats the names and I can't imagine it would be that useful anywhere else. Maybe it isn't good practice to define a function within another function though?
There was a problem hiding this comment.
That was my thought but it doesn't really matter. No need to move it.
R/eml.R
Outdated
| proj <- list(title = titles, personnel = p_list, award = awards) | ||
| } | ||
|
|
||
|
|
There was a problem hiding this comment.
Do you want to explicitly return(proj) here? I expected its behavior to print the project section to the console when I didn't assign it to a variable.
|
Thanks for the suggestions @dmullen17! merging in now |
This function generates an EML project section from a list of NSF award numbers
I'm VERY excited about it 🚀