One more option:
transform(test, Y = NULL)
On Tue, Feb 23, 2010 at 9:04 AM, Knut Krueger wrote:
> Hi to all,
> test <- data.frame("X"=c(1:4),"Y"=c(5:8),"Z"=c(8:11))
> test <- test[,-2]
>
> Is there a way to specify the col name "Y" to delete instead the number?
>
> Kind regards Knut
>
> __
test$Y<-NULL
test["Z"]<-NULL
>>> Todd Ogden 23/02/2010 16:02:01 >>>
There might be more elegant ways, but this will do it:
test<-test[-match("Y",names(test))]
On Feb 23, 2010, at 7:04 AM, Knut Krueger wrote:
> Hi to all,
> test <- data.frame("X"=c(1:4),"Y"=c(5:8),"Z"=c(8:11))
> test <- test[,
There might be more elegant ways, but this will do it:
test<-test[-match("Y",names(test))]
On Feb 23, 2010, at 7:04 AM, Knut Krueger wrote:
Hi to all,
test <- data.frame("X"=c(1:4),"Y"=c(5:8),"Z"=c(8:11))
test <- test[,-2]
Is there a way to specify the col name "Y" to delete instead the
nu
On Feb 23, 2010, at 10:13 AM, adam naples wrote:
try
test <- subset(test, select = -c(Y))
That approach has the deficiency (or feature?) that it will throw an
error if Y is not a column in test, whereas test[ , -grep("Y",
names(test))] will not.
However, the grep approach will return a
i'd use:
test[["Y"]] <- NULL
b
On Tue, Feb 23, 2010 at 4:13 PM, adam naples wrote:
> try
>
> test <- subset(test, select = -c(Y))
>
> The key is the minus sign before c() in the select argument.
> You can put in as many columns as you like.
> -a
>
> On Feb 23, 2010, at 11:02 AM, David Winsemiu
try
test <- subset(test, select = -c(Y))
The key is the minus sign before c() in the select argument.
You can put in as many columns as you like.
-a
On Feb 23, 2010, at 11:02 AM, David Winsemius wrote:
>
> On Feb 23, 2010, at 6:04 AM, Knut Krueger wrote:
>
>> Hi to all,
>> test <- data.fram
Hi Knut,
> test <- data.frame("X"=c(1:4),"Y"=c(5:8),"Z"=c(8:11))
> test <- test[,-2]
>
> Is there a way to specify the col name "Y" to delete instead the number?
test[,colnames(test)!="Y"]
test[,!colnames(test)%in%"Y"]
test[,-grep("Y",colnames(test))]
bw,
On Feb 23, 2010, at 6:04 AM, Knut Krueger wrote:
Hi to all,
test <- data.frame("X"=c(1:4),"Y"=c(5:8),"Z"=c(8:11))
test <- test[,-2]
Is there a way to specify the col name "Y" to delete instead the
number?
I believe that negative indexing only works with numeric arguments.
You could du
8 matches
Mail list logo