Download data with R

Hi,

I am trying to download both figures and audio using KoboconnectR with this funciotion:

kobo_media_downloader(
url = “kf.kobotoolbox.org”,
uname = “myusername”,
pwd = “mypassword”,
assetid = Api$asset,
fsep = “;”,
sleep = 2,
identifier = “URL”,
timeoutval = 300,
destfolder = “Febrero”)

However, the file that are downloaded are not either .jpg nor .m4a.

How can I download this data?

Thanks

Welcome to the community, @ancuervo! Maybe you could follow this post discussed previously:

It should help you solve your issue!

Thanks @Kal_Lam for the link.
I also want to add that I’m adding a function to download media in the new version of robotoolbox.

Best,
Ahmadou

1 Like

@dickoa, :clap: :heart: :partying_face:

Thank you @dickoa . Could you please let me know when this function is ready?

Best,
Angela

1 Like

Hi @ancuervo

I pushed a new version on GitHub with a function kobo_attachment_download, you have three parameters: x the uid/kobo_asset, the folder and if you want an indicator of progress (default to FALSE),

kobo_attachment_download(uid, “my_folder_path”)

It’ll download everything in the attachments column and will push it to a folder. I prefixed each file the with the id number of the submission (_id column) to easily retrieve that information (through regex for e.g).
The other option is a folder by id but you can end up with a lot of sub-folders and CRAN doesn’t like package functions to create a folder without the specific consent of the user.

pak::pkg_install("dickoa/robotoolbox")

Let me know if it works as expected.

Best,
Ahmadou

1 Like

@dickoa, :clap: :heart: :partying_face:

Thank you! I will try it and let you know

1 Like