I used Julia 1.7
The command
dfc = DataFrame(XLSX.readtable("data.xlsx","sheet1")...) worked good
After migrating to Julia 1.8 the same command stopped working and generated the following error message:
ERROR: MethodError: no method matching iterate(::XLSX.DataTable)
Closest candidates are:
iterate(!Matched::Union{LinRange, StepRangeLen}) at range.jl:872
iterate(!Matched::Union{LinRange, StepRangeLen}, !Matched::Integer) at range.jl:872
iterate(!Matched::T) where T<:Union{Base.KeySet{<:Any, <:Dict}, Base.ValueIterator{<:Dict}} at dict.jl:712
what has changed with that command with the new release?
Looking forward to some information
This has nothing to do with the Julia version you are using, and everything with the XLSX.jl version you are using. The XLSX documentation actually has a while section devoted to this here. The relevant bit for you is that readtable now returns a Tables.jl compatible table and so can passed into the DataFrame constructor directly, so instead of
DataFrame(XLSX.readtable(myfile, sheet)...)
You do
DataFrame(XLSX.readtable(myfile, sheet))
(note the lack of the splatting operator)
Note that these kinds of issues are expected when you move between breaking releases of a package according to Semver, so either between major releases (version 1.x to version 2.x) or between minor releases pre 1.0 (eg 0.5.x to 0.6.x). If you want to avoid these issues you should work with project specific environments so that the Manifest records the versions of all packages you are using and they don't change unless you manually do ] up for that specific environment.
Related
I'm having this weird issue where my target, which interfaces a slightly customized python module (installed with pip install --editable) through reticulate, gives different results when it's being called from an interactive session in R from when targets is being started from the command line directly, even when I make sure the other argument(s) to tar_make are identical (callr_function = NULL, which I use for interactive debugging). The function is deterministic and should be returning the exact same result but isn't.
It's tricky to provide a reproducible example but if truly necessary I'll invest the required time in it. I'd like to get tips on how to debug this and identify the exact issue. I already safeguarded against potential pointer issues; the python object is not getting passed around between different targets/environments (anymore), rather it's immediately used to compute the result of interest. I also checked that the same python version is being used by printing the result of reticulate::pyconfig() to screen. I also verified both approaches are using the same version of the customized module.
Thanks in advance..!
Basically, I have an MIP completely defined, everything is working, until I attempt to solve via GLPK, when it gives me the following error: UndefVarError: floatmax not defined
I tried defining floatmax as anything, but to no avail. I'm completely stuck. Here's an image of my code and the problem:
1
It looks like you have an old version of Compat installed. Try running Pkg.update(). floatmax is defined on Julia 0.6 beginning with Compat 1.1.0. I fixed the version requirements here: https://github.com/JuliaOpt/GLPKMathProgInterface.jl/pull/55.
The problem is that you are working under Julia 0.6 and floatmax is internally used by the GLPKMathProgInterface.jl package.
Possible solutions are:
Swithch to Julia 1.0 (recommended)
Install an older version of GLPKMathProgInterface.jl before it was ported to Julia 1.0; release v0.4.2 should be ok
Manually add the following definition in the source file GLPKMathProgInterface.jl before include section:
floatmax(::Type{Float64}) = prevfloat(Float64(Inf))
(I have not run it as I do not have Julia 0.6 any more, but it should work; the risk is that even if you fix this some more fixes like this might be needed - so option 3 is not really recommended, but it might work so I am giving it)
Forgive my ignorance. I need to do calculate backward slices for a project. After some searching, I came across frama-c. I downloaded the package on my ubuntu system which got me Frama-c Version: Fluorine-20130601. I am trying to use it for the first time. When finding out the undefined functions in my project almost all library functions are undefined, even printf, scanf etc(Neither code nor specification for function printf). According to the tutorial, I have to add stubs for all the undefined functions. Do I really have to add code for every library function that I am using even printf? Please guide.
You should update to Frama-C Phosphorus, which brings tons of improvements regarding Variadic functions. In particular, specifications are automatically generated for printf/scanf-like functions when they are called on a constant format string. For non-variadic functions, some basic implementations are available in the directory $FRAMA_C_INSTALL/share/libc/*.c (in recent releases of Frama-C).
This is an issue I am encountering for different pieces of codes I am writing in R.
Basically, I would like to generate a window that displays a picture (a .png file). Following for instance guidances from this or this, I come up with this kind of code:
library(tcltk)
tmpFile <- tempfile(fileext = ".png")
download.file("https://www.r-project.org/logo/Rlogo.png", tmpFile)
tcl("image","create","photo", "imageLogo", file=tmpFile)
win1 <- tktoplevel()
tkpack(ttklabel(win1, image="imageLogo", compound="image"))
This works fine under Mac OS, but not on Linux nor on Windows, where I am displayed such an error message:
[tcl] couldn't recognize data in image file
I can find some workarounds when I want to display graphs, using for instance packages tkrplot or igraph. Nonetheless, I would be really eager to understand why I got such errors when running my scripts on Linux or Windows, whereas it works just fine on Mac OS.
Apologies in case this issue is obvious, but I haven't found anything about potential differences with the tcltk package depending on the OS.
Tk's native support for PNG was added in 8.6. Prior to that, you need to have the tkimg extension loaded into Tk to add the image format handler required. If your installation of Tcl/Tk that R is using is set up right, you can probably make it work with:
tclRequire("Img")
once you've initialised things sufficiently. Yes, the name used internally is “Img” for historical reasons, but that's just impossible to search for! (This is the key thing in this mailing list message from way back.)
However, upgrading the versions of Tcl and Tk to 8.6 is likely to be a better move.
Finally and a bit lately, I would like to close this issue and sum up the different suggestions that were kindly made in response of my question:
R comes along with Tcl 8.5, even with the latest version 3.3.2, which means that there is no way for embedding a PNG file with the usual command into a window created thanks to Tcl/Tk. For some reasons it is working on Mac OS, but do not expect this to work easily on other OSs.
In order to display pictures, graphs, etc. in a window generated by Tcl/Tk in R, better look for either using the GIF support (when possible) or trying alternative solutions (see the question for possible alternative options).
In case one really wants to display PNG files, the solution consists of installing Tcl 8.5 (for instance ActiveTcl) along with the extension Img. In order to use the Tcl/Tk package that you've just installed on your computer, you can refer to the R FAQ for Windows for instance (as stated in the FAQ, you need to install Tcl 8.5 - I tried with Tcl 8.6, thereby hoping to solve my issue, but it didn't work). Basically, you need to set up an environment variable (MY_TCLTK) and put the path where the package Tcl/Tk is installed. Needless to be said, Tcl/Tk is commonly used in R in order to implement GUIs; if you have to go through very complex procedures to set up the system, the package definitely loses its advantages.
Finally, since Tcl 8.6 should be available soon or later with R (already implemented in the devel version), this issue will be de facto outdated.
A professor shared his R code, where he start by redefining an existing function f from package X.X.1. The package has been updated since then, so that now I have package X.X.3 installed.
His modified code and the function code in version X.X.3 are almost the same, aside from little things which don't really impact its purpose.
I wonder whether it's possible to look for its code in older versions (aka X.X.1) of the package (to see what has changed) WITHOUT having to download the older versions (I've seen from other SO questions that it is possible to download the older versions of the package, but I'd prefer just looking at the older codes, if possible), and so to avoid rewriting the version I have now.