I'm new to Julia and I want to use COBRA Package.
For adding COBRA I use command :
Pkg.add("COBRA")
But when running, I get these errors:
INFO: Building WinRPM
WARNING: skipping repodata/repomd.xml, not in cache -- call WinRPM.update() to download
WARNING: skipping repodata/repomd.xml, not in cache -- call WinRPM.update() to download
INFO: Downloading https://cache.julialang.org/http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Leap_42.2/repodata/repomd.xml
WARNING: Unknown download failure, error code: 2148270086
WARNING: Retry 1/5 downloading: https://cache.julialang.org/http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Leap_42.2/repodata/repomd.xml
until:
WARNING: Unknown download failure, error code: 2148270086
WARNING: Retry 5/5 downloading: https://cache.julialang.org/http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Leap_42.2/repodata/repomd.xml
WARNING: received error 0 while downloading
https://cache.julialang.org/http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Leap_42.2/repodata/repomd.xml
After these errors, I have checked the link and I've found out the source is not there, anymore.
So then I ran this command as said above:
WinRPM.update()
But it has thrown this error:
ERROR: UndefVarError: WinRPM not defined
Please Help me to add COBRA to Julia. I'm using version 0.6.4 because Cobra does not work on the next versions.(Windows 10)
Any help would be appreciated.
The problem, as you've mentioned, is that the original sources used by the package aren't valid URLs anymore. The proper way to solve this is to open a pull request with the package to change the URLs (which I've now done here ). As a stopgap measure, here's a hacky way to work around this issue for now:
Do a Pkg.add("WinRPM"). This might trigger the same warnings as above, ignore these.
Next, using WinRPM to load the package we added
Now, the source URLs are read from the sources.list file (linked above) into a global WinRPM.sources variable. We're going to edit this variable's contents to point to new working URLs. (This is generally a terrible idea, to directly poke into the internals of a module and change things.)
julia> WinRPM.sources[:] = replace.(WinRPM.sources, "Leap_42.3" => "Leap_15.3")
2-element Vector{String}:
"https://cache.julialang.org/http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Leap_15.3"
"https://cache.julialang.org/http://download.opensuse.org/repositories/windows:/mingw:/win64/openSUSE_Leap_15.3"
A WinRPM.update() should now work, and download things into a local cache.
I'm using version 0.6.4 because Cobra does not work on the next versions.
I hope you mean Julia 1.6.4 here, or version 0.6.4 of something else in the stack. If you mean Julia version 0.6.4, you might face further problems down the road and find it hard to get support for such an old version.
While running
frama-c-gui aluminium
on open suse 13.1 gives a warning message:
[gui] warning: Mime type 'text/x-csrc' not found
What could be the cause and solution for this?
frama-c is relying on the gtksourceview library to provide syntax highlighting in the GUI (both for the normalized code and the original source view). It thus asks gtksourceview for the language definition corresponding to the text/x-csrc mime type, corresponding to C source files. The warning is emitted if gtksourceview does not find such language definition.
You might want to check whether your installation of gtksourceview indeed includes proper language definitions (on my Debian, this is located under /usr/share/gtksourceview-2.0/language-specs/, and if not whether there is some package that could provide them.
I am using devtools::check(document=FALSE,args=c('--no-multiarch')) to perform the checks for my package.
When the above command performs R --vanilla CMD check "C:\sometmpfolder/mypackage.tar.gz" --timings --no-multiarch,
it stops at
* checking Rd cross-references ...
i.e., this is the last line in mypackage.Rcheck/00check.log. There is no error message - the check seems to freeze.
I use roxygen2 to create my documentation. The cross references that I use are of the form \link{somefunction} and \link[somepkg]{somefunction}.
I am running R 3.1.2 on a Win 7 machine.
But I think that I have seen a similar behaviour with earlier versions of R and without roxygen2 as well.
Do you guys know why the check stops at the cross-references?
It turned out that an incorrect statement of the form
\link[somepkg]{somefunction}
was the problem. In my case I used the incorrect command \link[reshape]{melt} although it should be \link[reshape2]{melt}.
This caused the Rd cross-reference check to take forever (actually, it finished after nearly one hour). After correcting to \link[reshape2]{melt} the Rd cross-reference check only took a minute or so.
I would like to produce a log-file which keeps track of all commands (stdin), results (stdout) and errors/warnings/messages (stderr) in the R console.
I am aware that there are a lot of logging-packages and I tried several like TeachingDemos (seems to ignore stderr completely) or R2HTML (seems to ignore messages), however, none of them seems to include everything from stderr.
Only knitr and markdown seem to be able to include everything into a single file. But using this workaround, I have to write R-scripts and I cannot freely write commands in the console. Furthermore, I cannot include the knitr or markdown command in the same R-script (which is of course a minor problem).
Here is an example:
library(TeachingDemos)
library(R2HTML)
library(TraMineR)
logdir <- "mylog.dir"
txtStart(file=paste(logdir,"test.txt", sep=""), commands=TRUE,
results=TRUE, append=FALSE)
HTMLStart(outdir = logdir, file = "test", echo=TRUE, HTMLframe=FALSE)
## Messages, warnings and errors
message("Print this message.")
warning("Beware.")
"a" + 1
geterrmessage()
## Some example application with the TraMiner package
## which uses messages frequently
data(mvad)
mvad.seq <- seqdef(mvad[, 17:86])
mvad.ham <- seqdist(mvad.seq, method="HAM")
txtStop()
HTMLStop()
If you are running R from a Unix/Linux/Mac/etc. terminal, you can do:
R | tee mydir/mylog.txt
On windows, you can run the script in
R CMD BATCH yourscript.R
and your result will appear in the same folder as yourscript.out
On unices, I've often used the following code idiom with bash:
Some Command 2>&1 | tee NameOfOutputFile.txt
The "2>&1" says to take stderr and redirect it to stdout, which then gets piped to "tee". I will be experimenting with this and other ways of logging an R session.
Another unix trick is the "script" command, which starts a subshell whose I/O (basically everything you type and see in return) is logged to the specified file. And then exit the shell to end the script. Again, subject to experimentation. Since "sink" is native to R, I'll be trying that first.
By the way, I picked these tricks up using solaris, but they work the same running Cygwin, the unix emulator on Windows. Long time ago, I found that my Cygwin images were more up-to-date than the institutional installations of Solaris because the administrators had much more responsibility than just keeping the Solaris up-to-date. Mind you, the institutional machines were more powerful, so even though Cygwin was way more convenient, my personal machine simply didn't fill the need.
AFTERNOTE:
I took example code from page 99 of Shumway's Time Series Analysis and Its Applications With R examples. Here are the contents of a test file palette.R:
r
plot(gnp)
acf2(gnp, 50)
gnpgr = diff(log(gnp)) # growth rate
plot(gnpgr)
acf2(gnpgr, 24)
sarima(gnpgr, 1, 0, 0) # AR(1)
sarima(gnpgr, 0, 0, 2) # MA(2)
ARMAtoMA(ar=.35, ma=0, 10) # prints psi-weights
quit("no")
exit
I invoked it using:
script < palette.R
It captures the commands from palette.R and the corresponding output. So, seems usable for batch mode. For interactive mode, I'm going to go with my original plan and use sink.
I had a similar problem and in my case, I was unable to redirect truly all the output into my log file, as it was dependent on R running in interactive mode.
Specifically, in my log file, I wanted to be able to keep track of the progress bar generated by the rjags::update() function which, however, requires interactive mode:
The progress bar is suppressed if progress.bar is "none" or NULL, if
the update is less than 100 iterations, or if R is not running
interactively.
Therefore, I needed to trick R into thinking that it was running interactively, while it was in fact run from a bash script (interactive_R.sh, below) using here document:
interactive_R.sh
#!/bin/bash
R --interactive << EOT
# R code starts here
print(interactive())
quit("no")
# R code ends here
EOT
(Sidenote: Make sure to avoid the $ character in your R code, as this would not be processed correctly - for example, retrieve a column from a data.frame() by using df[["X1"]] instead of df$X1.)
Then you can simply run this script and send its contents into a log file using the bash command below:
$ ./interactive_R.sh > outputFile.log 2>&1
Your log file will then look as follows:
outputFile.log
R version 4.0.2 (2020-06-22) -- "Taking Off Again"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-conda_cos6-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
>
> # R code starts here
> print(interactive())
[1] TRUE
> quit("no")
I'm trying to test out the Winston plotting engine in Julia. I installed the package but I'm getting some errors now when I try to compile one of the examples:
> julia example1.jl
Warning: could not import Base.haskey into Inifile
Warning: could not import Graphics.set_source into Color
ERROR: no method haskey(Dict{String,Dict{String,String}},ASCIIString)
in read at /Users/thinkpad20/.julia/IniFile/src/IniFile.jl:41
in read at /Users/thinkpad20/.julia/IniFile/src/IniFile.jl:67
in anonymous at /Users/thinkpad20/.julia/Winston/src/Winston.jl:39
in include_from_node1 at loading.jl:88
in reload_path at loading.jl:111
in require at loading.jl:46
in include_from_node1 at loading.jl:88
in process_options at client.jl:253
in _start at client.jl:334
at /Users/thinkpad20/.julia/Winston/src/Winston.jl:31
at /Users/thinkpad20/.julia/Winston/examples/example1.jl:3
can anyone tell me what's going on? It seems to be that it can't find Base.haskey, but I'm not sure how to address that.
Try inspecting Base.VERSION
haskey was introduced in Julia v0.2 (still pre-release as of this writing), I suspect that you are running a version 0.1.x
The real problem is inside of the Winston package. It sounds like they have their REQUIRES information set up wrong. You should file an issue here: https://github.com/nolta/Winston.jl
You can also download pre-release version of 0.2 for windows and mac here: https://code.google.com/p/julialang/downloads/list