Skip to content
Back to formatted view

Raw Message

Message-ID: <CAErHZW0q1pGqhkjD5FCRTOp24QTcwzE=WoYrewH30NzmuA3Ywg@mail.gmail.com>
Date: 2011-10-07T15:03:04Z
From: Ana
Subject: function - access column

How can I call matrix$col, inside a function?
The matrix name is one of the variables of the function, while the
column name I get by assuming that it should have a certain
characters.

something like this

function(matrix){
colname=as.name(grep("[A-T a-t]ting",colnames(matrix),value=TRUE))
output=2*(matrix$colname)
return(output)
}

The name of the column is Testing.