[kepler-dev] Txt File with Kepler

ben leinfelder leinfelder at nceas.ucsb.edu
Mon Apr 20 08:16:07 PDT 2009


Subhav,
Take a look at the demos/R/ReadTable.xml example. Yes, it uses R to  
read the text file, but it's exactly what you need.
You'll end up with an R dataframe from the ReadTable actor. You'll  
want to connect that actor's "dataframe" output port to another  
generic R actor with an input port (myDf) and an output port (myList)  
to only select the the second column as a list.
The R expression for that actor will look like:
myList <- myDf[,2]
(you are selecting all the rows for column 2)

The myList output will be a list of file names.

-ben

On Apr 18, 2009, at 3:22 PM, subhav mital wrote:

> Thanks.
>
> I've tried ReadTable. It did not help or maybe I am not using it  
> correctly. Probably I'll have to go ahead and create a new actor to  
> extract values if nothing else comes up.
>
> Thank you for your help.
>
>
>
> On Sat, Apr 18, 2009 at 3:57 PM, Christopher Brooks <cxh at eecs.berkeley.edu 
> > wrote:
> Try using two StringReplace actors to replace the text before and  
> after
> the field in which you are interested.
> It would be nice to have an actor that would read tab separated file.
>
> Dan Higgens made a presentation about reading data, see
> http://seek.ecoinformatics.org/attach?page=SEEKPostdoctoralAndNewFacultyTrainingJanuary8122007%2FUsing_Desktop_Data_in_Kepler.ppt
> It looks like the Kepler ReadTable actor might be worth a look.
> ReadTable apparently uses R.  I've not used it, so I'm not sure
> if it would work.
>
> _Christopher
>
> subhav mital wrote:
> Thanks for that.
>
> I'll be more specific.
>
> The file.txt (An excel file saved as a text file and hence tab  
> delimited) contains the following:
>
> Number      Location                              Author
> 1                C:\Users\Desktop\.....            XYZ
> 2                C:\Folder\Kepler\.....              ABC
>
> Now the file reader reads the entire content of this file. However I  
> want to read only the Location column and extract the values within  
> that column.
>
> Hence, I would want to extract C:\Users\Desktop\..... and in another  
> run extract C:\Folder\Kepler\..... and then use this extracted  
> content (here to open another file specified in the location) ahead.
>
> So basically, it boils down to extracting information of a  
> particular cell within a particular column in a tab delimited text  
> file.
>
> Could you please suggest anything ?
>
> Thanks a lot!!
>
>
>
>
> On Sat, Apr 18, 2009 at 1:23 PM, Christopher Brooks <cxh at eecs.berkeley.edu 
>  <mailto:cxh at eecs.berkeley.edu>> wrote:
>
>    Hi Subhav,
>    See
>    http://ptolemy.eecs.berkeley.edu/ptolemyII/ptIIfaq.htm#reading%20data%20from%20files 
> ?
>
>    ptolemy.actor.lib.io.FileReader has a PortParameter that takes  
> file or
>    URL.  What you would need to do is read in the file names as per  
> the
>    above URL and then pass the individual file name to FileReader.
>
>    _Christopher
>
>    subhav mital wrote:
>
>        Hello,
>
>        Consider I have a text file of 1 column and n rows. Each of the
>        n rows have a location specified of a file. (Eg:
>        C:\...\..\file.txt) Can this file be given to kepler, so that  
> it
>        somehow reads the data (here location of the file name) in  
> those
>        rows and opens the file specified for each row?
>
>        Please give some suggestions for this.
>
>        Thank you!
>
>
>         
> ------------------------------------------------------------------------
>
>        _______________________________________________
>        Kepler-dev mailing list
>        Kepler-dev at kepler-project.org <mailto:Kepler-dev at kepler-project.org 
> >
>
>        http://mercury.nceas.ucsb.edu/kepler/mailman/listinfo/kepler- 
> dev
>
>
>    --    Christopher Brooks (cxh at eecs berkeley edu) University of  
> California
>    CHESS Executive Director                      US Mail: 337 Cory  
> Hall
>    Programmer/Analyst CHESS/Ptolemy/Trust        Berkeley, CA  
> 94720-1774
>    ph: 510.643.9841 fax:510.642.2718             (Office: 545Q Cory)
>    home: (F-Tu) 707.665.0131 (W-F) 510.655.5480
>
>
>
> -- 
> Christopher Brooks (cxh at eecs berkeley edu) University of California
> CHESS Executive Director                      US Mail: 337 Cory Hall
> Programmer/Analyst CHESS/Ptolemy/Trust        Berkeley, CA 94720-1774
> ph: 510.643.9841 fax:510.642.2718             (Office: 545Q Cory)
> home: (F-Tu) 707.665.0131 (W-F) 510.655.5480
>
> _______________________________________________
> Kepler-dev mailing list
> Kepler-dev at kepler-project.org
> http://mercury.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-dev



More information about the Kepler-dev mailing list