[R] matrix of mean values

arun smartpink111 at yahoo.com
Tue Oct 15 16:38:55 CEST 2013




Hi Nico,
Try:

setAs("character", "num.commas", 
        function(from) as.numeric(gsub(",", "", from) ) )
d1 <- read.csv("cont.txt",header=TRUE,sep="\t",colClasses=c("numeric","character","num.commas"))
colnames(d1)[-3] <- c("loc","variables")
library(reshape2)
 res <- dcast(d1,loc~variables,value.var="value",mean)

row.names(res) <- res[,1]
 res1 <- as.matrix(res[,-1])
 dim(res1)
#[1] 129 190

A.K.

On Tuesday, October 15, 2013 8:07 AM, Nico Met <nicomet80 at gmail.com> wrote:

Hi Arun, many thanks. Here I attached the data.

Regards

Nico



More information about the R-help mailing list