Hello Alok,

We really need more details about what you are trying to acheive in order to
help you.

c(X, Y) concatenates the objects X and Y. The result will be a vector. If X
and Y happen to be m x n matrices, the result will be a vector of length 2 *
m * n: probably not what you want.

You can see this for yourself. Eg:

 X <- matrix(1, 3, 3)
Y <- matrix(2, 3, 3)
c(X, Y)

If you were hoping to combine the information in corresponding pixels of the
matrices X and Y, you will need to have a clear idea of *how* you would like
the information to be combined. ie: Are you looking for the mean value of
the pixels, or is some other operation required?

Eg 2:

X <- matrix(1:9, 3, 3)
Y <- matrix(2, 3, 3)
X + Y / 2

Hope that helps.

Greg


2009/1/7 Alok K. Bohara, PhD <bohara@unm.edu>

> Hi:
>
> Let me start by saying that I am new to R.  I converted two pixel ascii
> matrices into image files:
>
> X_im <- im(X)   # X is an ascii pixel matrix
> Y_im <- im(Y)  # Y is an ascii pixel matrix
>
> How can I combine these two images into 1) one datafile "XY_im", 2) save it
>  and 3) read it after loading (e.g., x <- XY_im$X_im. and plot it.)
>
> I tried doing this:
>
> XY_im <- c(X_im,Y_im)
> save(XY _im, file = "XM_im.Rdata")
> load("XY_im.Rdata")
> x<- XY_im$X_im    # It does not like $ and says it is atomic something...
> plot(x)  # of course it does not work either.
>
> What am I doing wrong?  Any tips?
>
> Thanks you.
>
> Alok Bohara
>
>
> --
> Alok K. Bohara, Ph.D.
> Professor
> Department of Economics
> University of New Mexico
> Albuquerque, NM 87131,USA
> Ph: 505-277-5903/5304(w)
> Fax:505-277-9445
> email: bohara@unm.edu
> http://www.unm.edu/~econ/faculty/professors.html
> Nepal Study Center: http://nepalstudycenter.unm.edu
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]


