Read-pnm-error
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up read.pnm() - error trying to read pgm image up vote 1 down vote favorite 1 I'm trying to read a pgm file in R. I set my wd to where the image is and then simply try to read it: setwd("~/3 Diplomado/5 Multivariado/lfwcrop_grey/faces") library(pixmap) x <- read.pnm(system.file("Aaron_Guiel_0001.pgm", package="pixmap")[1]) But I get the following error: Error in if (ch == "#") { : argument is of length zero In addition: Warning message: In file(file, open = "rb") : file("") only supports open = "w+" and open = "w+b": using the former Not sure what it is. I think it simply doesnt find the image. What am I doing wrong? any hints? Thank you in advanced! J. image r pgm share|improve this question edited Oct 10 '12 at 19:02 Gavin Simpson 105k13210304 asked Oct 10 '12 at 18:34 JEquihua 471829 Why not using x=read.pnm(file = "Aaron_Guiel_0001.pgm")? Can you provide a sample file? –Ali Oct 10 '12 at 18:57 Not sure, I checked the package example and that was the sintax they used (the one I copied). Yours works fine for me. Thank you. Do you know what is the convenience of doing it as I tried to, even though it failed for me? –JEquihua Oct 10 '12 at 20:03 I have added the answer to your question. –Ali Oct 10 '12 at 21:14 add a comment| 1 Answer 1 active oldest votes up vote 1 down vote accepted Simply try this one: x=read.pnm(file = "Aaron_Guiel_0001.pgm") The system.file() is used to find the full path of the files included in packages. It is used in the package example, but you don't need to use it while reading your own file. share|improve this answer answered Oct 10 '12 at 20:58 Ali 3,84222865 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you're looking for? Browse other questions tagged image r pgm or ask yo
into R? read.pnm throws error Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] On Fri, 21 Nov 2003 15:57:35 -0800, you wrote: >Hi, http://stackoverflow.com/questions/12826051/read-pnm-error-trying-to-read-pgm-image > >Is there a way to read .bmp files into R? I have tried read.pnm from pixmap >package. It returned > >Error in pm.readmagicnumber(con) : Not a PNM format file > >Anyother ways to load bitmap https://stat.ethz.ch/pipermail/r-help/2003-November/042615.html images? .bmp format is fairly simple, and is well documented (e.g. see www.wotsit.org). It wouldn't be hard to write a reader using connections. The only difficulty is that several pixel formats are available. However, if you have control of the creation of the files, you can choose 24 bit BMPs, which are the simplest to read. Duncan Murdoch Previous message: [R] How to read .bmp files into R? read.pnm throws error Next message: [R] How to read .bmp files into R? read.pnm throws error Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] More information about the R-help mailing list
"Re: [R] Two y-axes for a plot" Previous message: Brett Magill: "Re: [R] problems with by()" Message-id: