[R] showing the image

Greg Snow
2008-09-04T21:12:53Z

Here is one approach:

> tmp <- scan(what='')
1:  "#444444" "#444444" "#434343"
"#404040" "#3D3D3D" "#3D3D3D" "#3E3E3E"
8:  "#414141" "#414141" "#414141"
"#404040" "#3F3F3F" "#3F3F3F" "#3F3F3F"
15:  "#3E3E3E" "#3E3E3E" "#3F3F3F"
"#404040" "#404040" "#404040" "#404040"
22:  "#3E3E3E" "#3D3D3D" "#3E3E3E"
"#404040" "#414141" "#414141" "#404040"
29:  "#3E3E3E" "#3E3E3E" "#3F3F3F"
"#3F3F3F" "#3F3F3F" "#3F3F3F" "#3E3E3E"
36:  "#3E3E3E" "#3F3F3F" "#3E3E3E"
"#3D3D3D" "#3B3B3B" "#3C3C3C" "#3B3B3B"
43:
Read 42 items
> tmp <- factor(tmp)
>
> tmp2 <- matrix(as.numeric(tmp), nrow=6, byrow=TRUE)
>
> image(tmp2, col=levels(tmp))
>

But the image is pretty gray.

Hope this helps,

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
(801) 408-8111



> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of rostam shahname
> Sent: Thursday, September 04, 2008 2:28 PM
> To: r-help at r-project.org
> Subject: [R] showing the image
>
> Hi everyone,
>
> I have a matrix containing color values of an image same as following,
>
> [1,] "#444444" "#444444" "#434343"
"#404040" "#3D3D3D"
> "#3D3D3D" "#3E3E3E"
> [2,] "#414141" "#414141" "#414141"
"#404040" "#3F3F3F"
> "#3F3F3F" "#3F3F3F"
> [3,] "#3E3E3E" "#3E3E3E" "#3F3F3F"
"#404040" "#404040"
> "#404040" "#404040"
> [4,] "#3E3E3E" "#3D3D3D" "#3E3E3E"
"#404040" "#414141"
> "#414141" "#404040"
> [5,] "#3E3E3E" "#3E3E3E" "#3F3F3F"
"#3F3F3F" "#3F3F3F"
> "#3F3F3F" "#3E3E3E"
> [6,] "#3E3E3E" "#3F3F3F" "#3E3E3E"
"#3D3D3D" "#3B3B3B"
> "#3C3C3C" "#3B3B3B"
>
>
> I wonder if there is any function that helps me to show the image.
>
> Thanks,
> Rostam
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>