-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Award Numbers function #9
base: master
Are you sure you want to change the base?
Conversation
…and some of their information #182
#get outpath name from metapid | ||
systema <- getSystemMetadata(mn, metapid) | ||
systema_name <- systema@fileName | ||
outpath <- paste("/home/mnguyen/", systema_name, sep = "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a path to my user... not sure how else to create an outpath that could apply to any user
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good start. See if you can make some of the changes and then we can move forward from there
outpath <- paste("/home/mnguyen/", systema_name, sep = "") | ||
|
||
#download data from metapid | ||
download_data_objects(mn, c(metapid), c(outpath)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pretty useful: You can download dataone objects directly like this eml <- read_eml(rawToChar(dataone::getObject(mn, metapid)))
So you won't need to use download_data_objects
#the raw award string numbers | ||
raw_award_string <- c() | ||
funding <- eml@dataset@project@funding@para | ||
for(i in 1:length(funding)){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you change this to seq_along(funding)
then it handles the case where length = 0. Rather than the case of for in 1:0
which gives you an error
raw_award_string <- c() | ||
funding <- eml@dataset@project@funding@para | ||
for(i in 1:length(funding)){ | ||
award <- funding@.Data[[i]]@.Data[[1]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might be able to replace some of these with eml_get function. Look up the documentation with ?eml_get and see if you can use it to simplify some of the code
|
||
#get xml from metapid | ||
eml <- read_eml(eml_file) #read in eml_file | ||
list <- list() #will be output list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You generally don't want to name your objects using already existing names. Since list is already the name of a function you want to rename your list to something like "output"
No description provided.