[R-sig-eco] ezANOVA package for a rm-ANOVA, Question about Design

2012-06-29 Thread Nils Gülzow
> Dear List,
>
> I have a problem with the ezANOVA package using for rm ANOVA or a  
> problem with my statistic design of the experiment. (or  both ;-))
>
> My file looks like this, dput(head(reg,20))

> structure(list(sample = c(13L, 14L, 15L, 13L, 14L, 15L, 13L,
14L, 15L, 13L, 14L, 15L, 13L, 14L, 15L, 13L, 14L, 15L, 1L, 2L
), days = c(7L, 7L, 7L, 14L, 14L, 14L, 21L, 21L, 21L, 28L, 28L,
28L, 35L, 35L, 35L, 42L, 42L, 42L, 7L, 7L), treat = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 2L, 2L), .Label = c("asynchron", "control", "synchron"), class =  
"factor"),
 repl = c(1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L,
 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L), disp = structure(c(2L, 2L,
 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
 2L, 2L, 2L), .Label = c("high", "low", "medium"), class =  
"factor"),
 gbiov = c(205088809L, 236043290L, 182258079L, 356710654L,
 519036032L, 423556500L, 265916788L, 260495312L, 424304021L,
 456717288L, 412530454L, 495216491L, 360012083L, 246070292L,
 351623075L, 99075488L, 141565279L, 109303015L, 157719021L,
 275901505L), rich = c(15L, 15L, 15L, 12L, 12L, 10L, 10L,
 10L, 10L, 8L, 7L, 9L, 9L, 9L, 8L, 6L, 8L, 8L, 15L, 15L),
 evenness = c(0.810893754, 0.766130198, 0.82401103, 0.422734873,
 0.365797654, 0.406629574, 0.317890623, 0.434262493, 0.475385016,
 0.311819454, 0.307131166, 0.321269955, 0.365280751, 0.505205296,
 0.43643584, 0.484220445, 0.455471176, 0.423730082, 0.811921742,
 0.833306048)), .Names = c("sample", "days", "treat", "repl",
"disp", "gbiov", "rich", "evenness"), row.names = c(NA, 20L), class =  
"data.frame")

> I would like to compare within SSw (treatment,dispersal) over time  
> (days= between, SSb) for the listed variables gbiov, rich, evenness  
> (dv), of course a single analysis for each variable. I used the  
> repl. column as the SS identifier for the replicates, so I have for  
> each combination of dispersal x treatment 4 replicates.
>
> My problem in my dataframe is, that for the combination (asynchron x  
> low) I have only three replicates (one is missing) and by checking  
> with ezDesign, I add the missing replicates by reseting to zero for  
> each time point, but still I get error message, except when I add  
> days to the within-SSw and omit between-SSb. But that makes no sence  
> to me.

> My code is:
test<-ezANOVA(data=reg,dv=.(gbiov),wid=.(repl),within=. 
(treat,disp),between=.(days))

Error term is:
Warnung: Converting "repl" to factor for ANOVA.
Warnung: "days" will be treated as numeric.
Fehler in ezANOVA_main(data = data, dv = dv, wid = wid, within =  
within,  :
   One or more cells is missing data. Try using ezDesign() to check  
your data.

>
> Perhaps, the SS identifier makes no sence?! Or my design is wrong  
> and I have no within and between conditions Or it is a problem of  
> one missing replicate
>
>
> Thanks in advance for solving the problem
>
> Best,
> Nils






Nils Gülzow

Müllerstr. 21
26384 Wilhelmshaven
Tel.: 04421/3597682
E-mail: nils.guel...@gmx.de







[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] Carrying capacity in R

2012-06-29 Thread Manuel Spínola
Thank you very much Peter.

Manuel

2012/6/28 Peter Solymos 

> Manuel,
>
> As a starter you can fit nonlinear models using growth functions, and
> calculate carrying capacity from estimated model parameters
> (stats:::nle, lme4:::nlmer).
>
> I am not sure if this is of big help as it is still in development,
> but our PVAClone R package is almost ready for its 1st CRAN submission
> and can be found at the developmental R-Forge site:
> https://r-forge.r-project.org/projects/dcr/
>
> The PVAClone package offers likelihood based population viability
> analysis in the presence of observation error and missing data.
> Currently it can be used to fit and compare support for models based
> on Gompertz and Ricker growth models with no observation error, Normal
> or Poisson observation error as described in these papers (other
> growth models and forecasting is soon to be added):
>
> Ponciano, J. M. et al. 2009. Hierarchical models in ecology:
> confidence intervals, hypothesis testing, and model selection using
> data cloning. Ecology 90, 356-362.
>
> Nadeem, K., Lele S. R., 2012.  Likelihood based population viability
> analysis in the presence of observation error. Oikos. doi:
> 10./j.1600-0706.2011.20010.x
>
> Cheers,
>
> Peter
>
> --
> Péter Sólymos, Dept Biol Sci, Univ Alberta, T6G 2E9, Canada AB
> soly...@ualberta.ca, Ph 780.492.8534, http://psolymos.github.com
> Alberta Biodiversity Monitoring Institute, http://www.abmi.ca
> Boreal Avian Modelling Project, http://www.borealbirds.ca
>
>
> 2012/6/28 Manuel Spínola :
> > Dear list members,
> >
> > Is there any package (and function) to assess carrying capacity for
> > biological population?
> >
> > Best,
> >
> > Manuel
> >
> > --
> > *Manuel Spínola, Ph.D.*
> > Instituto Internacional en Conservación y Manejo de Vida Silvestre
> > Universidad Nacional
> > Apartado 1350-3000
> > Heredia
> > COSTA RICA
> > mspin...@una.ac.cr
> > mspinol...@gmail.com
> > Teléfono: (506) 2277-3598
> > Fax: (506) 2237-7036
> > Personal website: Lobito de río <
> https://sites.google.com/site/lobitoderio/>
> > Institutional website: ICOMVIS 
> >
> >[[alternative HTML version deleted]]
> >
> >
> > ___
> > R-sig-ecology mailing list
> > R-sig-ecology@r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
> >
>



-- 
*Manuel Spínola, Ph.D.*
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
mspin...@una.ac.cr
mspinol...@gmail.com
Teléfono: (506) 2277-3598
Fax: (506) 2237-7036
Personal website: Lobito de río 
Institutional website: ICOMVIS 

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


[R-sig-eco] Re-arrange data frame

2012-06-29 Thread Manuel Spínola
Dear List members,

How can I re-arrange a data frame as detailed below.

old data frame

Item  col1  col2 col3 col4

item1  12116  7
item2  108 5  4
item3  3  5 4  3

New data frame

item1  12   11
item1   6 7
item2  108
item2   5 4
item3  3  5
item3  4  3

Best,

Manuel


-- 
*Manuel Spínola, Ph.D.*
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
mspin...@una.ac.cr
mspinol...@gmail.com
Teléfono: (506) 2277-3598
Fax: (506) 2237-7036
Personal website: Lobito de río 
Institutional website: ICOMVIS 

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] Re-arrange data frame

2012-06-29 Thread Peter Solymos
Manuel,

You haven't specified the general problem, but for this particular
situation this is how you can do it:

x <- data.frame(array(1:12, c(3,4), list(paste("item", 1:3),
paste("col", 1:4
x <- data.frame(Item=rownames(x), x)
y <- data.frame(Item=x$Item[rep(1:3, each=2)],
matrix(as.matrix(x[,-1]), 6, 2, byrow=TRUE))

Cheers,

Peter

--
Péter Sólymos, Dept Biol Sci, Univ Alberta, T6G 2E9, Canada AB
soly...@ualberta.ca, Ph 780.492.8534, http://psolymos.github.com
Alberta Biodiversity Monitoring Institute, http://www.abmi.ca
Boreal Avian Modelling Project, http://www.borealbirds.ca


2012/6/29 Manuel Spínola :
> Dear List members,
>
> How can I re-arrange a data frame as detailed below.
>
> old data frame
>
> Item      col1  col2 col3 col4
>
> item1      12    11    6      7
> item2      10    8     5      4
> item3      3      5     4      3
>
> New data frame
>
> item1      12   11
> item1       6     7
> item2      10    8
> item2       5     4
> item3      3      5
> item3      4      3
>
> Best,
>
> Manuel
>
>
> --
> *Manuel Spínola, Ph.D.*
> Instituto Internacional en Conservación y Manejo de Vida Silvestre
> Universidad Nacional
> Apartado 1350-3000
> Heredia
> COSTA RICA
> mspin...@una.ac.cr
> mspinol...@gmail.com
> Teléfono: (506) 2277-3598
> Fax: (506) 2237-7036
> Personal website: Lobito de río 
> Institutional website: ICOMVIS 
>
>        [[alternative HTML version deleted]]
>
>
> ___
> R-sig-ecology mailing list
> R-sig-ecology@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] Re-arrange data frame

2012-06-29 Thread Baldwin, Jim -FS
Here is an alternative approach that takes a few more steps and assumes the 
original data frame is named d0:

# Split into two data frames
d1 <- d0[,c(1:3)]
d2 <- d0[,c(1,4,5)]

# Rename the columns in the second one so that the names match
names(d2) <- names(d1)

# Concatenate the two identically named data frames
d0.combined <- rbind(d1,d2)

# Sort by Item (assuming it needs to be sorted which matches your example)
d0.combined <- d0.combined[order(d0.combined$Item),]

Jim Baldwin
USDA Forest Service


-Original Message-
From: r-sig-ecology-boun...@r-project.org 
[mailto:r-sig-ecology-boun...@r-project.org] On Behalf Of Peter Solymos
Sent: Friday, June 29, 2012 9:45 AM
To: Manuel Spínola
Cc: r-sig-ecology@r-project.org
Subject: Re: [R-sig-eco] Re-arrange data frame

Manuel,

You haven't specified the general problem, but for this particular situation 
this is how you can do it:

x <- data.frame(array(1:12, c(3,4), list(paste("item", 1:3), paste("col", 
1:4 x <- data.frame(Item=rownames(x), x) y <- 
data.frame(Item=x$Item[rep(1:3, each=2)], matrix(as.matrix(x[,-1]), 6, 2, 
byrow=TRUE))

Cheers,

Peter

--
Péter Sólymos, Dept Biol Sci, Univ Alberta, T6G 2E9, Canada AB 
soly...@ualberta.ca, Ph 780.492.8534, http://psolymos.github.com Alberta 
Biodiversity Monitoring Institute, http://www.abmi.ca Boreal Avian Modelling 
Project, http://www.borealbirds.ca


2012/6/29 Manuel Spínola :
> Dear List members,
>
> How can I re-arrange a data frame as detailed below.
>
> old data frame
>
> Item  col1  col2 col3 col4
>
> item1  12116  7
> item2  108 5  4
> item3  3  5 4  3
>
> New data frame
>
> item1  12   11
> item1   6 7
> item2  108
> item2   5 4
> item3  3  5
> item3  4  3
>
> Best,
>
> Manuel
>
>
> --
> *Manuel Spínola, Ph.D.*
> Instituto Internacional en Conservación y Manejo de Vida Silvestre
> Universidad Nacional Apartado 1350-3000 Heredia COSTA RICA
> mspin...@una.ac.cr mspinol...@gmail.com
> Teléfono: (506) 2277-3598
> Fax: (506) 2237-7036
> Personal website: Lobito de río
> 
> Institutional website: ICOMVIS 
>
>[[alternative HTML version deleted]]
>
>
> ___
> R-sig-ecology mailing list
> R-sig-ecology@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology




This electronic message contains information generated by the USDA solely for 
the intended recipients. Any unauthorized interception of this message or the 
use or disclosure of the information it contains may violate the law and 
subject the violator to civil or criminal penalties. If you believe you have 
received this message in error, please notify the sender and delete the email 
immediately.
___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] Question about gls output

2012-06-29 Thread Drew Tyre
Basil - you should do it for exactly the reason they state:
On page 138 of Zuur et al. (2009) they make the following statement
about a fitted model:

…there is a high correlation between the intercept and the slope for
arrival. This is because all arrival values are between 22 and 30 …
The intercept is the value of the response if all explanatory values
are 0 … which is obviously far outside the range of the sampled
arrival time variables. A small change in the slope can therefore have
a large change in the intercept, hence the high correlation. It would
be better to center arrival time around 0 and refit all the models.

To demonstrate, lets simulate some data using the parameters from the
fitted model:

set.seed(483709)
X = runif(100, 22, 30)
Y = 1.18 - 0.03 * X + rnorm(100, 0, 0.3)
head(cbind(X, Y))
##  X   Y
## [1,] 23.07 0.39927
## [2,] 25.73 0.02561
## [3,] 23.05 0.46457
## [4,] 26.87 0.47211
## [5,] 26.98 0.26696
## [6,] 28.76 0.50536
test.lm = lm(Y ~ X)
summary(test.lm, correlation = TRUE)
##
## Call:
## lm(formula = Y ~ X)
##
## Residuals:
## Min  1Q  Median  3Q Max
## -0.7461 -0.1892 -0.0008  0.1733  0.6620
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept)   1.0661 0.31243.41  0.00094 ***
## X-0.0247 0.0121   -2.04  0.04443 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.282 on 98 degrees of freedom
## Multiple R-squared: 0.0406,  Adjusted R-squared: 0.0308
## F-statistic: 4.15 on 1 and 98 DF,  p-value: 0.0444
##
## Correlation of Coefficients:
##   (Intercept)
## X -1.00
##
plot(Y ~ X)
abline(test.lm)

Notice that the correlation between the intercept and the slope is
extremely high - couldn't be higher, in fact! This does not affect the
quality of the estimate of the intercept. So now lets try the
suggested fix and see what happens.

CX = scale(X, center = TRUE, scale = FALSE)
test.Clm = lm(Y ~ CX)
summary(test.Clm, correlation = TRUE)
##
## Call:
## lm(formula = Y ~ CX)
##
## Residuals:
## Min  1Q  Median  3Q Max
## -0.7461 -0.1892 -0.0008  0.1733  0.6620
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept)   0.4327 0.0282   15.36   <2e-16 ***
## CX   -0.0247 0.0121   -2.040.044 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.282 on 98 degrees of freedom
## Multiple R-squared: 0.0406,  Adjusted R-squared: 0.0308
## F-statistic: 4.15 on 1 and 98 DF,  p-value: 0.0444
##
## Correlation of Coefficients:
##(Intercept)
## CX 0.00
##
So the estimate of the intercept is now much more accurate (compare
the t-values), while the estimate of the slope has gotten a bit worse.
Moreover, the correlation is now about as small as it could possibly
be. So if you want an accurate estimate of the intercept, you should
center your data.

On Thu, Jun 28, 2012 at 1:32 PM, Basil Iannone  wrote:
> Dear R users,
>
> First, I apologize. This question is not code related, but I figured I
> should ask it here given the large amount of questions pertaining to lme
> and gls models that I see posted.
>
> I am analyzing the effects of two variables (LDH and SI3) on total soil C.
> The model that I am using for this analysis is a gls model, which is below:
>
> m2<-gls(C~LDH + SI3, method = "ML", weights = vpDist)
>
> What I want to know is, can anyone guide me to a reference where I can read
> about, understand, and interpret the correlations given in the gls model
> output for correlations among parameter estimates? I have read through
> Pinheiro and Bates and Zuur (2009)'s books on mixed effects models (which
> also cover gls models), and searched the web, but I have found very little
> on this part of the model output.
>
> I ask, because I want to know if I should be concerned by a high
> correlation value between two parameters (e.g. between LDH and Intercept ~
> 0.92; see below). Zuur (2009) on page 138 gives an example of a lme model
> with a high correlation value between an explanatory value and the
> intercept and then suggests centering the explanatory value by subtracting
> the mean of the explanatory value from all individual values for this term.
> I, however, am unclear as to why one should do this, particularly if
> someone is interested in generating a reliable estimate for the intercept.
>
> Thanks again for any suggestions that anyone has for me.
>
> The output for my model is:
>
>> summary(m2)
> Generalized least squares fit by maximum likelihood
>  Model: C ~ LDH + SI3
>  Data: NULL
>       AIC      BIC    logLik
>  440.6114 453.4332 -215.3057
>
> Variance function:
>  Structure: Power of variance covariate
>  Formula: ~DistHyp
>  Parameter estimates:
>     power
> -0.7507717
>
> Coefficients:
>                Value Std.Error   t-value p-value
> (Intercept)  5.515769 2.3318502  2.365404  0.0201
> LDH         -1.671476 0.5551217 

Re: [R-sig-eco] Re-arrange data frame

2012-06-29 Thread Baldwin, Jim -FS
Sorry.  It looked fine when I sent it.  Below I've added back in the line feeds 
that somehow disappeared.

Jim


-Original Message-
From: r-sig-ecology-boun...@r-project.org 
[mailto:r-sig-ecology-boun...@r-project.org] On Behalf Of Baldwin, Jim -FS
Sent: Friday, June 29, 2012 10:28 AM
To: Peter Solymos; Manuel Spínola
Cc: r-sig-ecology@r-project.org
Subject: Re: [R-sig-eco] Re-arrange data frame

Here is an alternative approach that takes a few more steps and assumes the 
original data frame is named d0:

# Split into two data frames
d1 <- d0[,c(1:3)]
d2 <- d0[,c(1,4,5)]

# Rename the columns in the second one so that the names match
names(d2) <- names(d1)

# Concatenate the two identically named data frames

 d0.combined <- rbind(d1,d2)

# Sort by Item (assuming it needs to be sorted which matches your example)

 d0.combined <- d0.combined[order(d0.combined$Item),]

Jim Baldwin
USDA Forest Service


-Original Message-
From: r-sig-ecology-boun...@r-project.org 
[mailto:r-sig-ecology-boun...@r-project.org] On Behalf Of Peter Solymos
Sent: Friday, June 29, 2012 9:45 AM
To: Manuel Spínola
Cc: r-sig-ecology@r-project.org
Subject: Re: [R-sig-eco] Re-arrange data frame

Manuel,

You haven't specified the general problem, but for this particular situation 
this is how you can do it:

x <- data.frame(array(1:12, c(3,4), list(paste("item", 1:3), paste("col", 
1:4 x <- data.frame(Item=rownames(x), x) y <- 
data.frame(Item=x$Item[rep(1:3, each=2)], matrix(as.matrix(x[,-1]), 6, 2, 
byrow=TRUE))

Cheers,

Peter

--
Péter Sólymos, Dept Biol Sci, Univ Alberta, T6G 2E9, Canada AB 
soly...@ualberta.ca, Ph 780.492.8534, http://psolymos.github.com Alberta 
Biodiversity Monitoring Institute, http://www.abmi.ca Boreal Avian Modelling 
Project, http://www.borealbirds.ca


2012/6/29 Manuel Spínola :
> Dear List members,
>
> How can I re-arrange a data frame as detailed below.
>
> old data frame
>
> Item  col1  col2 col3 col4
>
> item1  12116  7
> item2  108 5  4
> item3  3  5 4  3
>
> New data frame
>
> item1  12   11
> item1   6 7
> item2  108
> item2   5 4
> item3  3  5
> item3  4  3
>
> Best,
>
> Manuel
>
>
> --
> *Manuel Spínola, Ph.D.*
> Instituto Internacional en Conservación y Manejo de Vida Silvestre 
> Universidad Nacional Apartado 1350-3000 Heredia COSTA RICA 
> mspin...@una.ac.cr mspinol...@gmail.com
> Teléfono: (506) 2277-3598
> Fax: (506) 2237-7036
> Personal website: Lobito de río
> 
> Institutional website: ICOMVIS 
>
>[[alternative HTML version deleted]]
>
>
> ___
> R-sig-ecology mailing list
> R-sig-ecology@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology




This electronic message contains information generated by the USDA solely for 
the intended recipients. Any unauthorized interception of this message or the 
use or disclosure of the information it contains may violate the law and 
subject the violator to civil or criminal penalties. If you believe you have 
received this message in error, please notify the sender and delete the email 
immediately.
___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] Re-arrange data frame

2012-06-29 Thread David Valentim Dias
You can check reshape or melt functions. They do exactly what you want.

2012/6/29 Baldwin, Jim -FS 

> Sorry.  It looked fine when I sent it.  Below I've added back in the line
> feeds that somehow disappeared.
>
> Jim
>
>
> -Original Message-
> From: r-sig-ecology-boun...@r-project.org [mailto:
> r-sig-ecology-boun...@r-project.org] On Behalf Of Baldwin, Jim -FS
> Sent: Friday, June 29, 2012 10:28 AM
> To: Peter Solymos; Manuel Spínola
> Cc: r-sig-ecology@r-project.org
> Subject: Re: [R-sig-eco] Re-arrange data frame
>
> Here is an alternative approach that takes a few more steps and assumes
> the original data frame is named d0:
>
> # Split into two data frames
> d1 <- d0[,c(1:3)]
> d2 <- d0[,c(1,4,5)]
>
> # Rename the columns in the second one so that the names match
> names(d2) <- names(d1)
>
> # Concatenate the two identically named data frames
>
>  d0.combined <- rbind(d1,d2)
>
> # Sort by Item (assuming it needs to be sorted which matches your example)
>
>  d0.combined <- d0.combined[order(d0.combined$Item),]
>
> Jim Baldwin
> USDA Forest Service
>
>
> -Original Message-
> From: r-sig-ecology-boun...@r-project.org [mailto:
> r-sig-ecology-boun...@r-project.org] On Behalf Of Peter Solymos
> Sent: Friday, June 29, 2012 9:45 AM
> To: Manuel Spínola
> Cc: r-sig-ecology@r-project.org
> Subject: Re: [R-sig-eco] Re-arrange data frame
>
> Manuel,
>
> You haven't specified the general problem, but for this particular
> situation this is how you can do it:
>
> x <- data.frame(array(1:12, c(3,4), list(paste("item", 1:3), paste("col",
> 1:4 x <- data.frame(Item=rownames(x), x) y <-
> data.frame(Item=x$Item[rep(1:3, each=2)], matrix(as.matrix(x[,-1]), 6, 2,
> byrow=TRUE))
>
> Cheers,
>
> Peter
>
> --
> Péter Sólymos, Dept Biol Sci, Univ Alberta, T6G 2E9, Canada AB
> soly...@ualberta.ca, Ph 780.492.8534, http://psolymos.github.com Alberta
> Biodiversity Monitoring Institute, http://www.abmi.ca Boreal Avian
> Modelling Project, http://www.borealbirds.ca
>
>
> 2012/6/29 Manuel Spínola :
> > Dear List members,
> >
> > How can I re-arrange a data frame as detailed below.
> >
> > old data frame
> >
> > Item  col1  col2 col3 col4
> >
> > item1  12116  7
> > item2  108 5  4
> > item3  3  5 4  3
> >
> > New data frame
> >
> > item1  12   11
> > item1   6 7
> > item2  108
> > item2   5 4
> > item3  3  5
> > item3  4  3
> >
> > Best,
> >
> > Manuel
> >
> >
> > --
> > *Manuel Spínola, Ph.D.*
> > Instituto Internacional en Conservación y Manejo de Vida Silvestre
> > Universidad Nacional Apartado 1350-3000 Heredia COSTA RICA
> > mspin...@una.ac.cr mspinol...@gmail.com
> > Teléfono: (506) 2277-3598
> > Fax: (506) 2237-7036
> > Personal website: Lobito de río
> > 
> > Institutional website: ICOMVIS 
> >
> >[[alternative HTML version deleted]]
> >
> >
> > ___
> > R-sig-ecology mailing list
> > R-sig-ecology@r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
> >
>
> ___
> R-sig-ecology mailing list
> R-sig-ecology@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>
>
>
>
> This electronic message contains information generated by the USDA solely
> for the intended recipients. Any unauthorized interception of this message
> or the use or disclosure of the information it contains may violate the law
> and subject the violator to civil or criminal penalties. If you believe you
> have received this message in error, please notify the sender and delete
> the email immediately.
> ___
> R-sig-ecology mailing list
> R-sig-ecology@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
> ___
> R-sig-ecology mailing list
> R-sig-ecology@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>



-- 
Currículo: http://lattes.cnpq.br/7541377569511492

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology