swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Robustness Check


From: Marcus G. Daniels
Subject: Re: Robustness Check
Date: 09 Jul 1999 18:04:54 -0700
User-agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.3.11

>>>>> "PJ" == Paul Johnson <address@hidden> writes:

PJ> I might ask in there if they have constructed a "data
PJ> retrieval" module that can grab a certain line or column from a
PJ> data file. 

Suppose you have the files:

address@hidden $ cat 1.txt
A0 A1 A2 A3
B0 B1 B2 B3
C0 C1 C2 C3

address@hidden $ cat 2.txt
W0 W1 W2
X0 X1 X2
Y0 Y1 Y2
Z0 Z1 Z2

And you want a list that has the first row of 1.txt
and the last column of 2.txt.  This how to do it:

$ R -q
> t1 <- read.table("1.txt") # read in 1.txt into a R dataframe
> t2 <- read.table("2.txt") # read in 2.txt into a R dataframe
> l <- list(as.matrix(t1)[1,],as.matrix(t2)[,3]) # make matrices and extract
> l # look at the result
[[1]]
  V1   V2   V3   V4 
"A0" "A1" "A2" "A3" 

[[2]]
   1    2    3    4 
"W2" "X2" "Y2" "Z2" 

> hdf5save("l.hdf", l)  # save it for use by HDF5 consumers, e.g. Swarm

Note the online help:

> help.start() # opens the HTML version of the manual
> help(read.table) # function-by-function descriptions
> help("[") # as well as operators
> help(list)
> help(as.matrix) # above, this just strips the factor analysis levels
> help(hdf5save)
> help(hdf5load)

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]