Hi Nico,
Try:
dat<-read.table("pollShed.txt", header = T, sep = "\t",dec=",")
as.vector(sapply(split(dat,dat$name1),nrow))
#[1] 86 10 43 3 20 7 25 12 18 3 7 12 12 14 3 14 25 175
59
#[20] 49 16 3 16 14 25 14 19 3 18 7 4 3 45 14 16 3 12
238
#[39]
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,v
Try:
d1$value<-as.numeric(gsub(",","",as.character(d1$value)))
library(reshape2)
res <- dcast(d1,loc~variables,value.var="value",mean)
A.K.
- Original Message -
From: Nico Met
To: R help
Cc:
Sent: Tuesday, October 8, 2013 10:47 AM
Subject: [R] matrix of mean values
Dear all, I have a
To make it matrix:
>
>
> row.names(res)<- res[,1]
> res1<- as.matrix(res[,-1])
> A.K.
>
>
>
> - Original Message -
> From: arun
> To: Nico Met
> Cc: R help
> Sent: Tuesday, October 8, 2013 10:54 AM
> Subject: Re: [R] matrix of
To make it matrix:
row.names(res)<- res[,1]
res1<- as.matrix(res[,-1])
A.K.
- Original Message -
From: arun
To: Nico Met
Cc: R help
Sent: Tuesday, October 8, 2013 10:54 AM
Subject: Re: [R] matrix of mean values
Try:
d1$value<-as.numeric(gsub(",","
5 matches
Mail list logo