[R] Help: Split-Split model nested in a nested structure

2014-02-22 Thread Zia Ahmed
Dear list members.
We are trying see effect of N on yield of three wheat genotypes under late
and early planting conditions in saline and non-saline environments. Our
experimental structure as follows:

Districts (2: DIST01 and DIST02) - Not randomly selected

ENV (Saline and Non-Saline) - One  saline and non-saline environment (eg.
village) were selected in each district (not random).

*SOWING Time  (Late and Early):* 8 farmers' fields were selected randomly
in each environment or village.  These are spatially distributed in a
village. Among them, 4 were grouped as early and 4 were grouped as a late
sowing group.

*N_TREAT  (N0 and N100)* - Then, each farmer field was splitted  into
two  main
plots where two N-treatment were assigned randomly.

*GENOTYPE ( G1,  G2, G3*) - Then, N-main plots were further splited into
three subplots here 3 wheat varieties were  assigned  randomly.

This experiment was repeated for two years. Farmers' fields in Year 1 and
Year 2 were not same. We are not interested to see the District effect on
wheat yield here. Rather, we like to see the effect of saline environment,
sowing time, N  and genotype and their interaction  on wheat yield for year
1 and year 2 separately.
We are using the following ANOVA model. We do not know whether we are
missing something here.  Help will be highly arreciated.
Regards
Zia Ahmed, CIMMYT

model-aov(YIELD~ENV*SOWING*N_RATE*GEN+Error(FARMERS/N_RATE/GEN),
data=mydata)

summary(model)



# District: two

DIST-as.factor(rep(c(DIST01,DIST02),each=96))

# ENV: Saline and Non-saline environment

ENV-as.factor(rep(rep(c(Saline,Non-saline),each=48),2))

# Farmers 16

FARMERS-as.factor(rep(c(F1,F2,F3,F4,F5,F6,F7,F8,

 F9,F10,F11,
F12,F13,F14,F15,F16),each=12))

# Showing Date: two

SOWING-as.factor(rep(rep(c(Early,Late),each=6),16))

# Nitrogen treatments: N0 and N100

N_RATE-as.factor(rep(rep(c(N0,N100),each=3),32))

# Genotype

GEN-as.factor(rep(rep(c(V1,V2,V3),each=1),64))

# Response: Wheat Yield

set.seed(1234)

YIELD - rnorm(n=192, mean=3.0, sd=0.5)

# Create Data Frame

mydata-data.frame(DIST,ENV, FARMERS,SOWING,N_RATE,GEN,YIELD)

mydata




[[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 to split a ID column in a data.frame and create a new ID column

2012-03-16 Thread gianni lavaredo
Dear Researchers,

I have a data.frame with 2 columns like this:

mydf -
data.frame(value=c(1,2,3,4,5),ID=c(Area_1,Area_2,Area_3,Area_4,Area_5))

 mydf
  value ID
1 1 Area_1
2 2 Area_2
3 3 Area_3
4 4 Area_4
5 5 Area_5


I need to convert the *ID *in the following version
 mydf
  value ID  newID
1 1 Area_1   AreaSample1
2 2 Area_2   AreaSample2
3 3 Area_3   AreaSample3
4 4 Area_4   AreaSample4
5 5 Area_5   AreaSample5

some people know the right function to split ID and create a new column

Thanks in advance
Gianni

[[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.


Re: [R] help to split a ID column in a data.frame and create a new ID column

2012-03-16 Thread Jorge I Velez
Hi Gianni,

Thank you for the reproducible example!

Try

mydf$newID - with(mydf, gsub(_, Sample, ID))
mydf

HTH,
Jorge.-


On Fri, Mar 16, 2012 at 7:54 AM, gianni lavaredo  wrote:

 Dear Researchers,

 I have a data.frame with 2 columns like this:

 mydf -

 data.frame(value=c(1,2,3,4,5),ID=c(Area_1,Area_2,Area_3,Area_4,Area_5))

  mydf
  value ID
 1 1 Area_1
 2 2 Area_2
 3 3 Area_3
 4 4 Area_4
 5 5 Area_5


 I need to convert the *ID *in the following version
  mydf
  value ID  newID
 1 1 Area_1   AreaSample1
 2 2 Area_2   AreaSample2
 3 3 Area_3   AreaSample3
 4 4 Area_4   AreaSample4
 5 5 Area_5   AreaSample5

 some people know the right function to split ID and create a new column

 Thanks in advance
 Gianni

[[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.


[[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 needed: Split-split plot analysis

2010-03-13 Thread Safe Environment
Hello,
I am very new to R but would like to use the software to analyse the
attached data. The experiment followed a split-split plot design
There were two blocks and the whole plot is CO2 with two levels. The
sub-plot is soil temperature with three levels and the sub-sub plot is soil
moisture content with three levels (low, intermediate and high-similar for
soil temperature). I had 7 plants per treatment combination and 252 plants
in total. CO2, soil temperature and moisture are fixed factors. Blocks are
always random.
What package do I need to perform a split-split plot analysis? Can someone
help me with the code for the analysis? Thank you.


Sincerely,

Forest Member
__
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.


Re: [R] Help needed: Split-split plot analysis

2010-03-13 Thread RICHARD M. HEIBERGER
It looks like you need something like this.  The data you attached didn't
make
it through the email system.

## you might need
install.packages(HH)  ## do this once

library(HH)  ## do this every time you start a new R session
interaction2wt(y ~ Block + CO2 + temp + moisture)

## the rest is standard R from the stats package
safe.aov - aov(y ~ CO2*temp*moisture + Error(Block/CO2), data=safe)
model.tables(safe.aov)
anova(safe.aov)


Rich

[[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 with split.

2010-02-25 Thread rkevinburton
I read in the documentation for split:

‘split’ divides the data in the vector ‘x’ into the groups defined by ‘f’. 

But I am still unclear as to its function. Take for example:

x - 1:4
split(x, c(0,1))
$`0`
[1] 1 3

$`1`
[1] 2 4

I am not clear on how this result is reached.

Thank you.

Kevin

__
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.


Re: [R] Help with split.

2010-02-25 Thread Peter Dalgaard

rkevinbur...@charter.net wrote:

I read in the documentation for split:

‘split’ divides the data in the vector ‘x’ into the groups defined by ‘f’. 


But I am still unclear as to its function. Take for example:

x - 1:4
split(x, c(0,1))
$`0`
[1] 1 3

$`1`
[1] 2 4

I am not clear on how this result is reached.


Usual recycling rule: Same result as split(x, c(0,1,0,1)).



--
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

__
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.