Thanks for your R help, posted at
https://stat.ethz.ch/pipermail/r-help/2008-November/179050.html
I also found this very helpful at
http://stackoverflow.com/questions/11105234/filtering-out-rows-in-a-matrix-containing-only-0-in-r:
Filtering out rows in a matrix containing only 0 in
Hi,
I am writing this in a wrong way, can someone please correct me?
A - matrix()
length(A) - 6
dim(A) - c(3,2)
colnames(A) - c(X,Y)
A
X Y
[1,] NA NA
[2,] NA NA
[3,] NA NA
A$X
Error in A$X : $ operator is invalid for atomic vectors
Thanks,
cruz
Hello -
cruz wrote:
Hi,
I am writing this in a wrong way, can someone please correct me?
A - matrix()
length(A) - 6
dim(A) - c(3,2)
colnames(A) - c(X,Y)
A
X Y
[1,] NA NA
[2,] NA NA
[3,] NA NA
A$X
Error in A$X : $ operator is invalid for atomic vectors
A[, X] may be what you want?
Hi Cruz
you don't need to assign dimension or classes to your objects.
It's easier if you do like this
a=c(0,1,2,4,1,1)
length(a)
[1] 6
b=matrix(a,3,2,byrow=T)
b
[,1] [,2]
[1,]01
[2,]24
[3,]11
of course you can change the colnames and assign what
you prefer
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of anna freni
sterrantino
Sent: Thursday, November 06, 2008 10:00 AM
To: cruz; r-help@r-project.org
Subject: Re: [R] How to avoid $ operator is invalid for
atomic vectors
Hi Cruz
you don't need to
Thanks for all the responses, they are all very helpful:)
you don't need to assign dimension or classes to your objects.
It's easier if you do like this
this is something that really bothers me, when I need to define an
object which i will later fill with data, the dimension of this object
Does that answer your question?
Thanks:)
I received one from Erin:
x - NULL
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide
cruz wrote on 11/06/2008 12:16 PM:
Thanks for all the responses, they are all very helpful:)
you don't need to assign dimension or classes to your objects.
It's easier if you do like this
this is something that really bothers me, when I need to define an
object which i will later fill with
Does this help
(mylist - list(NULL))
(mylist[[3]] - data.frame(a=1:4, b=letters[1:4]))
mylist
(mylist[[2]] - matrix(1:12, nrow=4))
mylist
--- On Thu, 11/6/08, cruz [EMAIL PROTECTED] wrote:
From: cruz [EMAIL PROTECTED]
Subject: Re: [R] How to avoid $ operator is invalid for atomic vectors
cruz wrote:
Thanks for all the responses, they are all very helpful:)
you don't need to assign dimension or classes to your objects.
It's easier if you do like this
this is something that really bothers me, when I need to define an
object which i will later fill with data, the
10 matches
Mail list logo