[R] Matching

Daniel Malter daniel at umd.edu
Sat Oct 29 21:28:56 CEST 2011


Your post is unlikely to solicit a helpful response. As you do not adhere to
the posting guide, it is quite impossible for us to figure out from your
description what is going wrong. Please provide a self-contained example
that reproduces the problem (i.e., code with simulated or actual data that
we can copy paste to the R-prompt). Moreover, chances are that when you try
to reproduce the error with simulated code, you will figure out what your
mistake is.

Best,
Daniel


shish matt wrote:
> 
> I have a spatial weight file in csv that I want as listw object in R.
> The file has the following 3 variables (left to right in the file) --
> OID_, NID and WEIGHTS. NID stands for the neighbors and OID_ as the
> origins. There are 217 origins with 4 neighbors each.
> 
> 
> I have been able to read the csv file as a data frame (test.csv). Then I
> tried to check whether the OID_ variable is in the right place in the
> dataframe. I used "match" for that using:
> o
> <- match(OID_, OID_)
> I am not sure whether this is the right way to match. Please advice.
> 
> Anyway, next I created a matrix object (m) using:
> 
> m
> <- as.matrix(test.csv[, -1])
> 
> Then I created object m1, using:
> 
> m1
> <- m[o, o]
> 
> Finally, I tried creating listw object using:
> mat2listw(m1)
> Here I get an error that x is not a square matrix.
> 
> Not sure what to do now. Any helo appreciated!
> 
> Thanks,
> Shishm
> 
> ______________________________________________
> R-help@ 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.
> 


--
View this message in context: http://r.789695.n4.nabble.com/Matching-tp3950158p3951527.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list