[R] How to avoid $ operator is invalid for atomic vectors Thu Nov 6 19:04:49 CET 2008

2013-09-29 Thread Bruce Petrovics
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

[R] How to avoid $ operator is invalid for atomic vectors

2008-11-06 Thread cruz
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

Re: [R] How to avoid $ operator is invalid for atomic vectors

2008-11-06 Thread Erik Iverson
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?

Re: [R] How to avoid $ operator is invalid for atomic vectors

2008-11-06 Thread anna freni sterrantino
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

Re: [R] How to avoid $ operator is invalid for atomic vectors

2008-11-06 Thread Nordlund, Dan (DSHS/RDA)
-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

Re: [R] How to avoid $ operator is invalid for atomic vectors

2008-11-06 Thread cruz
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

Re: [R] How to avoid $ operator is invalid for atomic vectors

2008-11-06 Thread cruz
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

Re: [R] How to avoid $ operator is invalid for atomic vectors

2008-11-06 Thread Jeffrey Horner
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

Re: [R] How to avoid $ operator is invalid for atomic vectors

2008-11-06 Thread John Kane
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

Re: [R] How to avoid $ operator is invalid for atomic vectors

2008-11-06 Thread Patrick Burns
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