On Feb 22, 2010, at 6:40 AM, Simone R. Freitas wrote:

Dear all,

I intend to do some statistics with my raster table, like correlations or regression analysis. For that, I need that each pixel be in one line, that is, there is no count > 1. So, all columns should have the same number of
lines, when I compare (combine) rasters.

I'd like to know if there is a way to create lines and copy the values of the lines, when count is > 1. So, even though values were the same, and count twice (or more), I need that those values be repeated in different
lines.

Example:

My raster table now:

COUNT_Forest KTOTAL500X FOREST_BUF
1 28006 50
1 27953 50
1 12726 150
2 12725 1
1 12722 50
1 7600        1
2 586      1000
10 586        1

My new raster table (the ideal one):

COUNT_Forest KTOTAL500X FOREST_BUF
1 28006 50
1 27953 50
1 12726 150
1 12725 1
1 12725 1
1 12722 50
1 7600        1
1 586      1000
1 586      1000
1 586        1
1 586        1
1 586        1
1 586        1
1 586        1
1 586        1
1 586        1
1 586        1
1 586        1
1 586        1

> dta[ rep(row(dta)[ ,1], dta$COUNT_Forest), ]
    COUNT_Forest KTOTAL500X FOREST_BUF
1              1      28006         50
2              1      27953         50
3              1      12726        150
4              2      12725          1
4.1            2      12725          1
5              1      12722         50
6              1       7600          1
7              2        586       1000
7.1            2        586       1000
8             10        586          1
8.1           10        586          1
8.2           10        586          1
8.3           10        586          1
8.4           10        586          1
8.5           10        586          1
8.6           10        586          1
8.7           10        586          1
8.8           10        586          1
8.9           10        586          1

After that, I'd like to join tables using KTOTAL500X column. How can I do
that?


?merge


Thank you very much.

Best regards

Simone.
--------------------------------------------------
Simone R. Freitas
Universidade Federal do ABC (UFABC)
Centro de Ciências Naturais e Humanas (CCNH)
R. Catequese, 242
Bairro Jardim
09090-400 - Santo André - SP
Brasil
http://srfreitas.webs.com/

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

______________________________________________
R-help@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.

Reply via email to