문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top