0 3
So, if you are not assigning :
#Asse[2,4] <-2000
Then, Asse[,4] will be all zeros.
Asse[,!colSums(abs(Asse))==0] #will remove the columns which are all zeros
#or
Asse[,!apply(Asse,2,function(x) all(x==0))]
#will get the results you wanted.
A.K.
- Original Message -
Fr
Hi,
I edited the code sorry,
I forgot the line before
Can you have look again please?
Thanks
--
View this message in context:
http://r.789695.n4.nabble.com/Remove-Column-from-matrix-tp4650334p4650348.html
Sent from the R help mailing list archive at Nabble.com.
___
Hello,
Three things:
1. You don't need an explicit comparison to TRUE,
if(all(Asse[,"SSdiff"]==0)){
will do the same.
2. Your matrix Asse doesn't have colnames, try to see the output of
colnames(Asse)
You forgot to assign colnames(Asse) <- namVar.
3. Even if it did, SSdiff is the 4th column,
Hi,,
Can I get help with this. I need to remove a column form the matrix if that
specific column has his all entry zero, here the code I wrote but it is not
working can you help me please
namVar <-
c("TrlgWSST","TrlgWSSE","TrlgWSSR","SSdiff","TrlgWMSE","TrlgWR2","TrlgWR2adj","TrlgSSE","TrlgMSE","T
Hi frespider,
I think the problem is first that you are referring to column names that you
haven't yet defined. To add the column names you can use the dimnames
argument of the matrix function.
Asse <- matrix(0,nrow=5,ncol=length(namVar), dimnames = list(NULL, namVar))
JoAnn
--
View this mes
esh
To: r-help@r-project.org
Cc:
Sent: Friday, August 24, 2012 8:11 PM
Subject: [R] remove column
*Hi all,*
I'm trying to filter a file through the columns. This file below is a
example of my data frame. My true data frame has seven hundred thousand
columns and 500 hundred lines. I
On 25-08-2012, at 02:11, Kate Dresh wrote:
> *Hi all,*
>
>
>
> I'm trying to filter a file through the columns. This file below is a
> example of my data frame. My true data frame has seven hundred thousand
> columns and 500 hundred lines. I need to identify and to remove all columns
> that al
*Hi all,*
I'm trying to filter a file through the columns. This file below is a
example of my data frame. My true data frame has seven hundred thousand
columns and 500 hundred lines. I need to identify and to remove all columns
that all elements equal a number 1. In this my case, columns were de
; "8", "9"), class = "AsIs")
>> 1
>> 4 7
>> 2
>> 5 8
>> 3
>&
>
- Original Message
From: Benilton Carvalho <[EMAIL PROTECTED]>
To: joseph <[EMAIL PROTECTED]>
Cc: r-help@r-project.org
Sent: Monday, February 18, 2008 11:47:50 AM
Subject: Re: [R] remove column names from a data frame
apparently you want to check the "Introduction t
7
2 5
8
3 6
9
>
----- Original Message
From: Benilton Carvalho <[EMAIL PROTECTED]>
To: joseph <[EMAIL PRO
Try this:
names(df) <- NA
or
names(df) <- make.names(seq(ncol(df)))
On 18/02/2008, joseph <[EMAIL PROTECTED]> wrote:
>
>
> I want to remove the column names from a data frame. I do
> it the long way, can any body show me a better way ?
>
>
> df= data.frame(chrN= c("chr1", "chr2", "chr3"), star
apparently you want to check the "Introduction to R" document I
found it very useful when I started working with R:
http://cran.r-project.org/doc/manuals/R-intro.pdf
try:
names(df) <- NULL
b
ps: "df" is the name of the function to get the density for an F
distribution...
On Feb 18,
I want to remove the column names from a data frame. I do
it the long way, can any body show me a better way ?
df= data.frame(chrN= c(chr1, chr2, chr3), start= c(1,
2, 3), end= c(4, 5, 6), score= c(7, 8, 9))
df
#I write a txt file without row or column names
write.table(df,"df1.txt"
14 matches
Mail list logo