ImageMagick in R

I want to use ImageMagick in R, but R will not let me install it.

install.packages("ImageMagick") Installing package into 'C:/Users/FSFH-2/Documents/R/win-library/3.0' (as 'lib' is unspecified) Warning message: package 'ImageMagick' is not available (for R version 3.0.1) 

I get the impression that I have the latest version of R, so what's going on here?

In addition, I loaded ImageMagick into windows, but I cannot figure out how to get it in R. Help!

+4
source share
7 answers

you need to install the package named "installr" before installing ImageMagick.

Simple steps:

  • Tools-> InstallPackages-> installr
  • From the command line R
    • require(installr)
    • install.ImageMagick() (This command installs the latest version by default, and you can specify the URl of the required version)

The package will be installed !!!

+9
source

Now there is a magick package that wraps around the ImageMagick STL .

It can be installed simply using install.packages("magick")

There is a blog post explaining what you can do with it here: https://ropensci.org/blog/2016/08/23/z-magick-release

+8
source

Just go to http://www.imagemagick.org/script/binary-releases.php#windows to download and install ImageMagick on Windows. After that, enter a command (for example, convert ...) in cmd.exe to verify that ImageMagick exists. At this time, I know that we can only use it in cmd.exe, not in R.

+2
source

If you are working on a Mac, then for me it was just necessary to use Homebrew in the terminal (if you don’t have homegrown or something like that, get it! ).

I installed ImageMagick and then I had to install the animation in R.

In terminal:

 sudo brew install ImageMagick 

... it installs several package dependencies and ends.

In the R console after that (in R, Rstudio, Emacs, ...):

 install.packages("animation") 

Now try ?gganimate and run the examples below to check it out!

The examples in the help file worked without problems for me. This works very well in Rstudio, Rstudio is written just like a web browser is under the hood. I personally use ESS in Emacs, which usually opens an X11 (or Quartz) window for building. However, using gg_animate opens the default browser and displays the output there.

+1
source

I used these commands in RStudio.

  • install.packages ('installr')
  • library (installr)
  • install.ImageMagick ()

It has the latest version of ImageMagick installed.

+1
source

If you are using Mac OS or Linux, you can install ImageMagick on your system and then use it from R using the system () function. I do not know if ImageMagick works with Windows.

0
source

If you are on a Mac, then the port in the terminal just worked for me.

I installed ImageMagick and then I had to install the animation in R.

In terminal:

 sudo port install ImageMagick 

... it installs several package dependencies and ends.

In studio R after that:

 install.packages("animation") 

and then verify by running the following example:

 saveGIF({ for (i in 1:10) plot(runif(10), ylim = 0:1) }) 

If the above conversion was successful, the 'convert' option should not be NULL

0
source

Source: https://habr.com/ru/post/1490697/


All Articles