如何在R 2.15中读取.jpeg [英] how to read.jpeg in R 2.15
问题描述
这看起来非常微不足道,但我无法用jpeg或任何类型的图像读入R 2.15。在R 2.10中,我可以使用 rimage
库或 ReadImage
库 - 例如read.jpeg - 但似乎在R 2.15及更高版本中无法做到这一点。有什么想法?
It seems very trivial but I can't read in jpeg, or any type of image into R 2.15. In R 2.10 I could do it using rimage
library or ReadImage
library - with read.jpeg for example - but there seems to be no way to do it in R 2.15 and later versions. Any thoughts on this?
library('ReadImages')
Error in library("ReadImages") : there is no package called ‘ReadImages’ >
install.packages('ReadImages') Installing package(s) into ‘C:/Program Files/R/R-2.15.1/library’ (as ‘lib’ is unspecified)
Warning in install.packages : package ‘ReadImages’ is not available (for R version 2.15.1)
推荐答案
正如评论中指出的那样,试试jpeg包。
As pointed out in comments, try the jpeg package.
install.packages("jpeg") ## if necessary
library(jpeg)
## get help
library(help = jpeg)
## get more help
?readJPEG
示例,来自帮助:
# read a sample file (R logo)
img <- readJPEG(system.file("img", "Rlogo.jpg", package="jpeg"))
另一种选择是rgdal,它可以从大量的格式中读取。绘图和操作的处理方式不同。
Another option is rgdal, which can read from a massive bestiary of formats. Plotting and manipulation are handled differently.
install.packages("rgdal") ## if necessary
library(rgdal)
img <- readGDAL(file.path(R.home(), "doc", "html", "logo.jpg"))
CRAN上还有readbitmap包,总是值得基本搜索包列表以寻找你想要的东西。
There is also the readbitmap package on CRAN, it's always worth a basic search of the packages list for what you are looking for.
这篇关于如何在R 2.15中读取.jpeg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!