Hey guys,

thank you very much for your help.  Since I am a R-newbie I am still
checking out how your code works and how I could adapt it to my dataframe,
which has 124 rows and 41 columns/variables.  The first column would be
"name", the last ones, 40 and 41, contain the cells I want to average for
some rows. Is it possible to read the dataframe without copying the whole
thing into the text"" function (just tried it and got an error message)?

Thank you!

Verena


On Wed, May 28, 2014 at 3:48 AM, arun <smartpink111@yahoo.com> wrote:

> Hi,
> You can also try:
> dat <- read.table(text="Name C1 C2 C3
>   1  A  3  3  5
>   2  B  2  7  4
>   3  C  4  3  3
>   4  C  4  4  6
>   5  D  5  5  3",sep="",header=TRUE,stringsAsFactors=FALSE)
>
>
>  library(plyr)
>  ddply(dat,.(Name),numcolwise(mean,na.rm=TRUE))
> A.K.
>
>
> On Tuesday, May 27, 2014 4:08 PM, Verena Weinbir <vweinbir@gmail.com>
> wrote:
> Hello,
>
> I have a big dataframe, and want to average two specific cells of two
> specific rows and then replace those two rows with one row which contains
> the averaged cells. Example (row 3 and 4: Cells2 and Cells3 averaged and
> replaced)
>
>     NameC1 C2 C3
>   1  A  3  3  5
>   2  B  2  7  4
>   3  C  4  3  3
>   4  C  4  4  6
>   5  D  5  5  3
>
>
>
>     NameC1 C2  C3
>   1  A  3  3   5
>   2  B  2  7   4
>   3  C  4  3.5 4.5  4  D  5  5   3
>
>
> Many thanks in advance!
>
> Best,
>
> Verena
>
>     [[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]]

