Code Monkey home page Code Monkey logo

Comments (15)

brry avatar brry commented on July 19, 2024 1

Thanks for the example. It works on my computer. I wonder if this is related to #22.
Can you try clim <- readDWD(file, fread=FALSE)?

from rdwd.

brry avatar brry commented on July 19, 2024 1

I think I have a solution. Could you run updateRdwd() to have version 1.4.1 (2020-08-24) and then run the following two examples?

readDWD(file) # should run fine now with message "Reading file with readDWD.data() and fread=FALSE"
readDWD(file, fread=T) # should give warning [1] and then the error as before

Lastly, if you'd want to take the time, could you install Rtools (directly at C:/Rtools since compiler paths may not have spaces, as there would be with C:/Program Files/R/Rtools/) and see if both examples work fine? That would settle issue #22 for me.
Don't feel pressured, though, I don't want to be a burden on your time. I appreciate you pointing out this issue regardless :).

[1] system command 'unzip' could not be found. Expect trouble with data.table::fread.

from rdwd.

brry avatar brry commented on July 19, 2024

Could you post a reproducible example?

from rdwd.

Mightynasty avatar Mightynasty commented on July 19, 2024

Hi ! Here it is:
I used the example similar to the one in the docs:

link <- selectDWD(id = "150", res="daily", var="kl", per="recent")
file <- dataDWD(link, read=FALSE)
clim <- readDWD(file, varnames=FALSE)

The console response:

dataDWD -> dirDWD: adding to directory '.../DWDdata'
dataDWD -> newFilename: creating 1 file:
'.../DWDdata/daily_kl_recent_tageswerte_KL_00150_akt.zip'
Reading file with readDWD.data().
'unzip' is not recognized as an internal or external command,
operable program or batch file.
'(unzip -p .../DWDdata/daily_kl_recent_tageswerte_KL_00150_akt.zip produkt_klima_tag_20190221_20200819_00150.txt) > ...\AppData\Local\Temp\RtmpSYVSSB\file43042d986b3c' execution failed with error code 1File '...\AppData\Local\Temp\RtmpSYVSSB\file43042d986b3c' has size 0. Returning a NULL data.frame.File contains no rows: .../DWDdata/daily_kl_recent_tageswerte_KL_00150_akt.zip

from rdwd.

Mightynasty avatar Mightynasty commented on July 19, 2024

Perfect, it worked! Now I see it was NA by default.

from rdwd.

brry avatar brry commented on July 19, 2024

Could you try a few things so I can maybe find out where this comes from?
Do you get the same error for the last line here?

fp <- unzip(file, list=TRUE) # file produkt*, the actual datafile
fp <- fp$Name[grepl("produkt",fp$Name)]

dat <- data.table::fread(cmd=paste("unzip -p", file, fp), na.strings=berryFunctions::na9(nspace=0),
                                  header=TRUE, sep=";", stringsAsFactors=TRUE, data.table=FALSE)

And for the following?

dat <- data.table::fread(cmd=paste("unzip -p", file, fp), header=TRUE, sep=";")

from rdwd.

Mightynasty avatar Mightynasty commented on July 19, 2024

Same error for both:

unzip' is not recognized as an internal or external command,
operable program or batch file.

from rdwd.

brry avatar brry commented on July 19, 2024

Seems like unzip is only available if you have e.g. a git shell (source). I'll see if I can find an alternative online...

from rdwd.

Mightynasty avatar Mightynasty commented on July 19, 2024

Yes, like many commands, only working from the shell. Thanks a lot for you help and work!

from rdwd.

brry avatar brry commented on July 19, 2024

What output do you get with the following?

system("unzip", show.output.on.console=FALSE)
Sys.which("unzip") # gives me c:\\Rtools\\bin\\unzip.exe

I'm considering keeping the default for fread as NA but not only checking for data.table but also for the unzip command...

from rdwd.

Mightynasty avatar Mightynasty commented on July 19, 2024

Hi, I tried both, the second one still with the same warning and error.
Rtools are now directly in C: drive and I restarted everything.
But since the readDWD works it's great! Thank you.

from rdwd.

brry avatar brry commented on July 19, 2024

Thanks so much for checking!
One last question, for clarity: with Rtools installed and R restarted, does it still not work with fread=T? Does it find Sys.which("unzip")?

from rdwd.

Mightynasty avatar Mightynasty commented on July 19, 2024

The Sys.which("unzip") just gives this output:
unzip ""
As for the fread=T, still the same.

from rdwd.

brry avatar brry commented on July 19, 2024

Maybe Rtools was not added to the path. Well, it was worth a try. If you're happy with how it works, so am I.

Thank you so much for trying some things out!

from rdwd.

brry avatar brry commented on July 19, 2024

I just had the same problem on my laptop.
It was easy to solve by adding rtools40 to the PATH. I now have instructions for that online:
https://bookdown.org/brry/rdwd/fread.html

from rdwd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.