[R] array

2007-08-07 Thread Tiandao Li
Hello, I have some files generated from microarray experiments. I used scan() to read the files, and assigned each file to a unique name with many rows and columns. Now I want to create a array (ArrayA) with unique names, and I can use ArrayA[1,2][[6]] to refer the data in each file. Is there any

Re: [R] array

2007-08-07 Thread Roland Rau
Hi, Tiandao Li wrote: Hello, I have some files generated from microarray experiments. I used scan() to read the files, and assigned each file to a unique name with many rows and columns. Now I want to create a array (ArrayA) with unique names, and I can use ArrayA[1,2][[6]] to refer the

[R] array

2007-08-07 Thread Tiandao Li
Hello, I have 30 GenePix tab-delimited files generated from 10 microarray experiments, each has 3 replicates. I used scan() to read the files, and assigned each file to a unique name (such as A1, A2, A3 for experment A, and B1, B2, and B3 for experiment B) with 1000 rows and 56 columns. Now I

Re: [R] array loop

2007-08-01 Thread Petr PIKAL
Hi Dong GUO 郭东 [EMAIL PROTECTED] napsal dne 31.07.2007 15:27:35: Thanks, Petr. I changed the equation mark from = to -, then, it works fine. Dont know what difference it has made between the = and -.. from help page The operators - and = assign into the environment in which they are

Re: [R] array loop

2007-08-01 Thread Dong GUO 郭东
Thanks again, Petr. Following the reference, that would be true that = only assign values to the top level...So apparently using '-' is the safe all the time to assign values. Dong On 8/1/07, Petr PIKAL [EMAIL PROTECTED] wrote: Hi Dong GUO ¹ù¶« [EMAIL PROTECTED] napsal dne 31.07.2007

Re: [R] array loop

2007-07-31 Thread Dong GUO 郭东
Thanks, Petr. I changed the equation mark from = to -, then, it works fine. Dont know what difference it has made between the = and -.. Regards, Dong On 7/31/07, Petr PIKAL [EMAIL PROTECTED] wrote: Hi as you say that the computing is part of a function than the best way to see what is

[R] array writing and their filenames

2007-07-30 Thread Dong GUO 郭东
Hi, I want to save a array (say, array[6,7,8]) write a cvs file. How can I do that??? can I write in one file? if I could not write in one file, i want to use a loop to save in different files (in the matrix[6,7,8], should be 8 csv files), such as the filename structure should be: file =filename

Re: [R] array writing and their filenames

2007-07-30 Thread Dong GUO 郭东
Many thanks to Edna and Roland. I followed the suggestions, and it worked well. Regards, Dong On 7/30/07, Edna Bell [EMAIL PROTECTED] wrote: #Original 3x4x2 array xb , , 1 [,1] [,2] [,3] [,4] [1,] 0.4 0.9 5.6 0.1 [2,] 0.3 2.3 3.3 0.7 [3,] 0.6 0.8 0.2 0.7 , , 2

[R] array loop

2007-07-30 Thread Dong GUO 郭东
Dear all, here are two arrays: region(26,31,8), nation(8) I tried to get a new array, say, giGi(26,31,8) giGi - array(0,dim = c(region_dim)) for (i in (1:region_dim[3])) { giGi[,,i] = region[,,i]-nation[,i] } As the above is part of function, but results shows only giGi[,,1] has the right

Re: [R] array writing and their filenames

2007-07-30 Thread Roland Rau
Dong GUO 郭东 wrote: Hi, I want to save a array (say, array[6,7,8]) write a cvs file. How can I do that??? can I write in one file? For array[6,7,8], you don't need a csv(!) file since it is only a scalar. If this is what you want, check ?write.table But what you probably meant is how to

Re: [R] array searches

2007-02-23 Thread Murali Menon
holtman [EMAIL PROTECTED] To: Murali Menon [EMAIL PROTECTED] CC: r-help@stat.math.ethz.ch Subject: Re: [R] array searches Date: Fri, 16 Feb 2007 10:21:40 -0500 try this: x - scan(textConnection(30/01/2007 0 + 31/01/2007 -1 + 01/02/2007 -1 + 02/02/2007 -1 + 03/02/2007 1 + 04

[R] array searches

2007-02-16 Thread Murali Menon
Folks, I have a dataframe comprising a column of dates and a column of signals (-1, 0, 1) that looks something like this: 30/01/2007 0 31/01/2007 -1 01/02/2007 -1 02/02/2007 -1 03/02/2007 1 04/02/2007 1 05/02/2007 1 06/02/2007 1 07/02/2007 1

Re: [R] array searches

2007-02-16 Thread jim holtman
try this: x - scan(textConnection(30/01/2007 0 + 31/01/2007 -1 + 01/02/2007 -1 + 02/02/2007 -1 + 03/02/2007 1 + 04/02/2007 1 + 05/02/2007 1 + 06/02/2007 1 + 07/02/2007 1 + 08/02/2007 1 + 09/02/2007 0 + 10/02/2007 0 + 11/02/2007 0 +

Re: [R] array vs matrix vs dataframe?

2006-10-01 Thread Duncan Murdoch
On 10/1/2006 7:02 PM, r user wrote: What is the difference among an array, a dataframe and a matrix? Really, r, I think this is pretty well documented. Could you let us know what you've read that left this ambiguous? Why is the size of a dataframe so much larger? (see example below) I

Re: [R] array vs matrix vs dataframe?

2006-10-01 Thread Duncan Murdoch
On 10/1/2006 7:02 PM, r user wrote: What is the difference among an array, a dataframe and a matrix? Why is the size of a dataframe so much larger? (see example below) I forgot to mention: there will be very little difference in 2.4+; the row names were a problem in earlier releases, but

[R] Array

2006-06-15 Thread stat stat
Dear all R users, I am wondering if there is any way to define a 3 dimentional or 4 dimentional array in R. Sincerely yours, thanks in advance Send instant messages to your online friends http://in.messenger.yahoo.com Stay connected with your friends even when away from PC.

Re: [R] Array

2006-06-15 Thread Petr Pikal
@stat.math.ethz.ch Subject:[R] Array Dear all R users, I am wondering if there is any way to define a 3 dimentional or 4 dimentional array in R. Sincerely yours, thanks in advance Send instant messages to your online friends http://in.messenger.yahoo.com Stay

[R] what are the limits on R array sizes?

2006-02-08 Thread Mike Miller
I have some computers with a massive amount of memory, and I have some jobs that could use very large matrix sizes. Can R handle matrices of larger than 2GB? If I were to create a matrix of 1,000,000 x 1,000, it would use about 8GB. Can R work with an array of that size if I have compiled R

Re: [R] what are the limits on R array sizes?

2006-02-08 Thread Prof Brian Ripley
On Wed, 8 Feb 2006, Mike Miller wrote: I have some computers with a massive amount of memory, and I have some jobs that could use very large matrix sizes. Can R handle matrices of larger than 2GB? If I were to create a matrix of 1,000,000 x 1,000, it would use about 8GB. Can R work with an

[R] Converting a Perl Array of Arrayrefs to an R array or matrix using RS Perl

2006-01-18 Thread Aaron Day
Dear R/RS-Perl users, I have a perl script in which I parse a large number of files and construct an array of arrayrefs from the data in the files. I then pass that construct to R using the RS Perl interface. I want to be able to use the construct as an R array or matrix so that I can use

[R] array question

2006-01-17 Thread Chang Shen
Hi all, I want to create an array of datetime. If I have a datetime object dt dt - strptime(10Jan2006 00:00:15, %d%b%Y %H:%M:%S) dt [1]2006-01-10 00:00:15 I want to make an array of dt, say 100 size. I got those error. [1] 2006-01-10 00:00:15 dtarray-array(dt, dim=c(100)); Error in

Re: [R] array question

2006-01-17 Thread Prof Brian Ripley
Please use POSIXct and not POSIXlt objects, which are lists. On Tue, 17 Jan 2006, Chang Shen wrote: Hi all, I want to create an array of datetime. If I have a datetime object dt dt - strptime(10Jan2006 00:00:15, %d%b%Y %H:%M:%S) dt [1]2006-01-10 00:00:15 I want to make an array of dt,

[R] array of lists? is this the best way to do it?

2005-12-06 Thread John McHenry
[Q.] How to create an array of lists, or structures the most elegant way? There have been questions in the past but none too recently...I want to know if the following looks OK to you guys or if there is a better way to create an array of lists: # PREAMBLE ... JUST TO GET THINGS

Re: [R] array of lists? is this the best way to do it?

2005-12-06 Thread Gabor Grothendieck
On 12/6/05, John McHenry [EMAIL PROTECTED] wrote: [Q.] How to create an array of lists, or structures the most elegant way? There have been questions in the past but none too recently...I want to know if the following looks OK to you guys or if there is a better way to create an array of

[R] Array reversed

2005-12-01 Thread Julio Thomas
Dear R-helper, Is there a command to get an array indexed 1 to T from T to 1? For example: a - c(1, 2, 3) and by applying such a command I can get a[1] = 3 a[2] = 2 a[3] = 1 Thanks a lot and best regards Julio

Re: [R] Array reversed

2005-12-01 Thread Berton Gunter
] On Behalf Of Julio Thomas Sent: Thursday, December 01, 2005 8:44 PM To: r-help@stat.math.ethz.ch Subject: [R] Array reversed Dear R-helper, Is there a command to get an array indexed 1 to T from T to 1? For example: a - c(1, 2, 3) and by applying such a command I can get

[R] array indices in synced vectors

2005-09-08 Thread Erich Neuwirth
Let us start with the following definitions xxx-rep(c(1,2),times=5) yyy-rep(c(1,2),each=5) a-c(11,12) b-matrix(1:4,2,2) a[xxx] produces [1] 11 12 11 12 11 12 11 12 11 12 b[xxx,yyy] produces [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,]11111333

Re: [R] array indices in synced vectors

2005-09-08 Thread Thomas Lumley
On Thu, 8 Sep 2005, Erich Neuwirth wrote: sapply(1:length(xxx),function(x)b[xxx[x],yyy[x]]) does what I need and produces [1] 1 2 1 2 1 4 3 4 3 4 Is there a function taking xxx,yyy, and b as arguments producing the same result? b[cbind(xxx,yyy)] Essentially, I am asking for a version of

[R] array indexing and which

2005-04-17 Thread Werner Wernersen
Hi R friends! I am stuck with a stupid question: I can circumvent it but I would like to understand why it is wrong. It would be nice if you could give me a hint... I have an 2D array d and do the following: ids - which(d[,1]0) then I have a vector gk with same column size as d and do: ids2 -

Re: [R] array indexing and which

2005-04-17 Thread Marc Schwartz
On Sun, 2005-04-17 at 19:13 +0200, Werner Wernersen wrote: Hi R friends! I am stuck with a stupid question: I can circumvent it but I would like to understand why it is wrong. It would be nice if you could give me a hint... Having a reproducible example, as per the posting guide, would be

RE: [R] array indexing and which

2005-04-17 Thread Bill.Venables
:13 AM To: r-help@stat.math.ethz.ch Subject: [R] array indexing and which Hi R friends! I am stuck with a stupid question: I can circumvent it but I would like to understand why it is wrong. It would be nice if you could give me a hint... I have an 2D array d and do the following: ids - which(d

[R] Array Manipulation

2005-01-27 Thread cdsmith
I have a data set that looks like the following: ID Responce 1 57 1 63 1 49 2 31 2 45 2 67 2 91 3 56 3 43 4 23 4 51 4 61 4 76 4 68 5 34 5 35 5 45 I used sample(unique(ID)) to select a sample if ID's, say, (1,4,5). Now I want to pull out the rows with ID's 1, 4,

RE: [R] Array Manipulation

2005-01-27 Thread Liaw, Andy
Something like: dat[dat$ID %in% sample(unique(dat$ID), 3), ] Andy From: [EMAIL PROTECTED] I have a data set that looks like the following: ID Responce 1 57 1 63 1 49 2 31 2 45 2 67 2 91 3 56 3 43 4 23 4 51 4 61 4 76 4 68 5 34 5 35 5 45 I

Re: [R] Array Manipulation

2005-01-27 Thread Douglas Bates
Liaw, Andy wrote: Something like: dat[dat$ID %in% sample(unique(dat$ID), 3), ] or subset(dat, ID %in% sample(unique(ID), 3)) which I find to be more readable. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] Array Manipulation

2005-01-27 Thread Eric Rodriguez
and something like that: dat[dat$ID == sample(unique(dat$ID), 3), 2] ? I'm not sure about the ,2 maybe you need the full matrix ? ps: first time, i forgot the list __ R-help@stat.math.ethz.ch mailing list

Re: [R] array problem and for looping

2004-10-29 Thread Petr Pikal
Hi Beter not to give a same name your values (variables) as is function name. R is quite clever and sample - rnorm(10) sample - sample(sample,3) works as expected, but it is not a rule. Cheers Petr On 28 Oct 2004 at 17:54, Kunal Shetty wrote: Dear R- users and Helpers Is there some way

[R] array problem and for looping

2004-10-28 Thread Kunal Shetty
Dear R- users and Helpers Is there some way to re initialise or clear the array elements? Pardon me for being vague but the problem itself quite vague. I have attached the code along with email. When I run the saved r- code using source(random1.txt) , command. The program runs fine..but at

RE: [R] array problem and for looping

2004-10-28 Thread Huntsinger, Reid
, as you did to insert NAs randomly, or ifelse as you used to impute by means. Reid Huntsinger -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kunal Shetty Sent: Thursday, October 28, 2004 1:55 PM To: [EMAIL PROTECTED] Subject: [R] array problem

[R] array construction

2004-09-28 Thread Poizot Emmanuel
Hi all, I've got a file of the following format: X Y Z u v w 0 0 0 x x x 0 0 1 x x x 0 0 2 x x x .. .. .. .. .. .. 0 1 0 x x x 0 1 1 x x x 0 1 2 x x x .. .. .. .. .. .. 1 0 0 x x x 1 0 1 x x x 1 0 2 x x x etc x stand for

RE: [R] array addition doesn't recycle!

2004-04-01 Thread Robin Hankin
At 01:39 pm -0500 31/03/04, Raubertas, Richard wrote: Another alternative is to use the underappreciated function 'sweep()': sweep(A, 1:2, a, +) I find the following helpful (it's not due to me but I cannot find the original poster): %.+% - function(a,x){sweep(a , 2:1 , x ,+ )} %+.% -

[R] array addition doesn't recycle!

2004-03-31 Thread Tamas Papp
Hi, I have noticed the following: a - array(1:4, c(2, 2)) A - array(1:4, c(2,2,2)) A + a Error in A + a : non-conformable arrays It works with a matrix + a vector, why doesn't it work with arrays? Am I missing something? How would you do the above operation efficiently (ie I need to add a

RE: [R] array addition doesn't recycle!

2004-03-31 Thread Raubertas, Richard
:00 AM To: Tamas Papp Cc: R-help mailing list Subject: Re: [R] array addition doesn't recycle! The recycling rules are documented and this is not amongst them. Computer packages do have a tendency to follow their rules rather than read your mind. I suspect A + as.vector(a) is what

[R] array of variable length vectors

2004-02-02 Thread Giampiero Salvi
Hi, I'd like to store N vectors of different lengths, and to be able to access them with an index, and eventually free the memory for one of them without modifying the indexes to the others. In C this would be a vector of N pointers that point to memory cells independently allocated. For example

Re: [R] array of variable length vectors

2004-02-02 Thread Barry Rowlingson
Giampiero Salvi wrote: Hi, I'd like to store N vectors of different lengths, and to be able to access them with an index, and eventually free the memory for one of them without modifying the indexes to the others. int *pv[3]; pv[0] = (int *) malloc(13 * sizeof(int)); pv[1] = (int *) malloc(7 *

Re: [R] array of variable length vectors

2004-02-02 Thread Prof Brian Ripley
On Mon, 2 Feb 2004, Giampiero Salvi wrote: Hi, I'd like to store N vectors of different lengths, and to be able to access them with an index, and eventually free the memory for one of them without modifying the indexes to the others. In C this would be a vector of N pointers that point to

Re: [R] array of variable length vectors

2004-02-02 Thread Uwe Ligges
Giampiero Salvi wrote: Hi, I'd like to store N vectors of different lengths, and to be able to access them with an index, and eventually free the memory for one of them without modifying the indexes to the others. In C this would be a vector of N pointers that point to memory cells independently

[R] array(list(),c(2,5)) gives error in R 1.8.1

2004-01-14 Thread Christoph Lehmann
Hi In R 1.7 the following worked fine: array(list(),c(2,5)) [,1] [,2] [,3] [,4] [,5] [1,] NULL NULL NULL NULL NULL [2,] NULL NULL NULL NULL NULL now in R 1.8.1 I get the error: Error in rep.int(data, t1) : invalid number of copies in rep In addition: Warning message: NAs introduced by

Re: [R] array(list(),c(2,5)) gives error in R 1.8.1

2004-01-14 Thread Tony Plate
I confirmed this -- array(list(), c(2,2)) works in R 1.6.2 and R 1.7.1, but not in R 1.8.0. This appears to be due to a change in array(): rep(data, t1) was changed to rep.int(data, t1). When data=list(), t1==Inf, and rep(data, t1) returns list(), while rep.int(data, t1) gives an error.

[R] array problem

2004-01-04 Thread Z P
Dear all, I define , for n=5 or any integer greater than 0. A-array((1/2)^n , c(rep(2,n))) then for any i not equal to j, and 1=i,j=n, B-apply(a,c(i,j),sum) now B is a 2 by 2 matrix, I also define another costant 2 by 2 matrix G, How can I change the values of each elements of array A,

RE: [R] array problem

2004-01-04 Thread Gabor Grothendieck
[,1,,2,] - A3[,1,,2,] * G[1,2] A3[,2,,1,] - A3[,2,,1,] * G[2,1] A3[,2,,2,] - A3[,2,,2,] * G[2,2] identical(test(A,i,j),A3) [1] TRUE --- Date: Sun, 04 Jan 2004 21:42:55 +0800 From: Z P [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [R] array problem Dear all, I define , for n=5

[R] Array Dimension Names

2003-10-31 Thread Benjamin . STABLER
I would like to reference array dimensions by name in an apply and a summary function. For example: apply(x, workers, sum) Is there a better way to do this than creating a new attribute for the array and then creating new methods for apply and summary? I don't want to name the individual

Re: [R] Array Dimension Names

2003-10-31 Thread Ben Bolker
Not that I know of. BUT dimnames can themselves have names attributes, so a very small hack to apply() will do what you want. I did dump(apply,file=apply.R) and added the following lines after dn - dimnames(X) (line 14) [this is in R 1.7.1]. if (is.character(MARGIN)) { if

RE: [R] Array Dimension Names

2003-10-31 Thread Benjamin . STABLER
for the MARGIN argument to apply and sweep, and the perm argument to aperm. Thanks again, Ben Stabler -Original Message- From: Tony Plate [mailto:[EMAIL PROTECTED] Sent: Friday, October 31, 2003 1:07 PM To: STABLER Benjamin; [EMAIL PROTECTED] Subject: Re: [R] Array Dimension Names You can

RE: [R] Array Dimension Names

2003-10-31 Thread Gabor Grothendieck
,margins)$variables,sum) These are simple enough that you might not need to develop your own apply but you could pretty them up even more if you did: my.apply - function(x,dim,fn) apply(x,attr(x,dim),fn) my.apply(x,variables,sum) --- From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [R

[R] Array of 3D

2003-01-29 Thread Francisco do Nascimento Junior
Hi, Can be created an Array of 3 dimensions in R? How? Tks, Francisco. ^^ Francisco Júnior, Computer Science - UFPE-Brazil One life has more value that the world whole ^^ __

RE: [R] Array of 3D

2003-01-29 Thread Winfried Theis
Hi, try ?array. So long, Winfried On 29-Jan-03 Francisco do Nascimento Junior wrote: Hi, Can be created an Array of 3 dimensions in R? How? Tks, Francisco. ^^ Francisco Júnior, Computer Science - UFPE-Brazil One life has more value that the