On 14/01/2013 16:26, Suzen, Mehmet wrote:
Similar issue with URLs:
Not a similar issue at all: a URL is not a file. That most functions in
R itself open connections including URLs does not mean that contributed
packages do. The package help is quite specific about its requirements.
source: Either name of the file to read from or a raw vector
representing the JPEG file content.
Which suggests to you how you can do this, apart from download.file, of
course. Something like
readJPEG(readBin(yesWeCan, "raw", 1e6))
yesWeCan <-
"http://upload.wikimedia.org/wikipedia/commons/9/9d/Barack_Obama.jpg"
url(yesWeCan)
description
"http://upload.wikimedia.org/wikipedia/commons/9/9d/Barack_Obama.jpg"
class
"url"
mode
"r"
text
"text"
opened
"closed"
can read
"yes"
can write
"no"
readJPEG(yesWeCan)
Error in readJPEG(yesWeCan) :
unable to open
http://upload.wikimedia.org/wikipedia/commons/9/9d/Barack_Obama.jpg
On 14 January 2013 14:57, Yi Yuan <lamban...@gmail.com> wrote:
I installed jpeg package and tried to use
kim<-readJPEG("kim.jpeg") to read in a jpeg file, but R gave me an error:
Error in readJPEG("kim.jpeg") : unable to open kim.jpeg
I already put "kim.jpeg" in Rstudio's default working directory: "E:\home
work\Rstudio". So I don't think it's a problem caused by omitting the file's
path. But I tried with the full path version just in case and still got the
"unable to open" error:
kim<-readJPEG("E:\\ home work\\Rstudio\\kim.jpeg")
Error in readJPEG("E:\\ home work\\Rstudio\\kim.jpeg") :
unable to open E:\ home work\Rstudio\kim.jpeg
So now I really don't know what is wrong.
[[alternative HTML version deleted]]
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
--
Brian D. Ripley, rip...@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.