Hi,
Try:
!colnames(example1)%in%omit
#[1] TRUE TRUE TRUE TRUE FALSE FALSE TRUE TRUE TRUE
cbind(example1, `MAX without
Restriction`=apply(example1[,!colnames(example1)%in% omit],1,max,na.rm=TRUE))
A.K.
Thank you again! But somehow the which(function) didn't work...
The problem is, tha
On Oct 9, 2013, at 3:31 PM, laro wrote:
> Thank you again! But somehow the which(function) didn't work...
> The problem is, that the columns I want to drop in further calculations will
> not have the same name, that's why I'm looking for a solution to make a
> vector of the columns that should be
Thank you again! But somehow the which(function) didn't work...
The problem is, that the columns I want to drop in further calculations will
not have the same name, that's why I'm looking for a solution to make a
vector of the columns that should be omitted, like
omit<-c("Restriction 1","Restricti
Hi,
No problem.
It depends upon how many columns you want to delete, or if they have any common
names as in "Restriction"
example1<-
as.matrix(read.table("example1.txt",header=TRUE,stringsAsFactors=FALSE,sep="\t",row.names=1,check.names=FALSE))
indx<- which(!grepl("Restriction", colnames(example
Thank you for the fast answer!
Is there any way to use the first solution way, but work with the column
names instead of the number of the column. Because in further calculation I
need to drop more columns than just the restriction ones and the real
dataset has to many columns to work with the pos
Hi,
Try:
example1<-
as.matrix(read.table("example1.txt",header=TRUE,stringsAsFactors=FALSE,sep="\t",row.names=1,check.names=FALSE))
example2 <- example1
example1New <- cbind(example1, `MAX without
Restriction`=apply(example1[,1:4],1,max,na.rm=TRUE))
#or
library(matrixStats)
`MAX without Restrict
6 matches
Mail list logo