Using R "statistical tool"?????

Discussion in 'Mac Apps and Mac App Store' started by diegozuniga, Mar 23, 2006.

  1. diegozuniga macrumors newbie

    Joined:
    Oct 11, 2005
    #1
    Hi,

    I am using R 2.1.1 for my quality class. I need for it to read a table that i created in Text Editor. I don't know how to input the path name correctly for it to read it right. My profesor in class used Windows Notepad to put the tables and saved them as a .txt file. What should i save it as? A RFT file???

    the code that he used is:
    dat<-read.table("e:/sample5_4.txt")

    If I go to Spotlight it gives me, that the location is as follows: /Users/diegozuniga/documents. And the name of my file is sample5_4

    Can anybody possible help me. And just as a word of caution, i am probably going to have more questions like this later on. Thank you very much in advance.
     
  2. MisterMe macrumors G4

    MisterMe

    Joined:
    Jul 17, 2002
    Location:
    USA
    #2
    Why don't you just use the Cocoa (MacOS X-native) version of R? FWIW, .rtf is for word-processing, not data storage. You should save your file as .txt. TextEdit and a myriad of other text editors can do this. Most spreadsheets, including Excel, and graphing/charting applications can also save or export data as tab-delimited, space-delimited, or comma-delimited (aka CSV) text files. Database apps can also do it. The point is that you have a lot of options.
     
  3. swiftaw macrumors 603

    swiftaw

    Joined:
    Jan 31, 2005
    Location:
    Omaha, NE, USA
    #3
    The best strategy is to change the Working Directory in R to match the folder that contains your file and then you can just do read.table(filename.txt)

    Let me know if you have any further questions, I use R is OS X all the time
     
  4. diegozuniga thread starter macrumors newbie

    Joined:
    Oct 11, 2005
    #4
    Thanks

    So basically, it doesn't matter if the file is in my documents folder i would just put the file name.

    Example. The file is Under User/myname/Documents/filename

    all i would have to put would be

    dat<-read.table(filename.txt) ????

    I would not have to put the pathname?

    Sorry about this mess, i am really new to R.
     
  5. swiftaw macrumors 603

    swiftaw

    Joined:
    Jan 31, 2005
    Location:
    Omaha, NE, USA
    #5
    In R, select Misc->Change Working Directory. (shortcut key cmnd+D)

    Then change the working directory to the folder that contains your files.

    Now you can use dat<-read.table(filename.txt) without needing a pathname.

    Hope this helps
     
  6. hhlee macrumors 6502

    Joined:
    May 19, 2005
    #6
    you can past the entire path as well

    i.e. /Users/blah/blah/yikes.txt

    if you use bbedit (or maybe textwrangler can do this?) you can copy the entire path to the clipboard.

    you can also use OnMyCommand to add these kinds of options to the right click finder options

    http://free.abracode.com/cmworkshop/

    technically you can name the file whatever you want - read.table will open your file as a flat file.

    i often have crazy names like
    proteins.sortd.uniq.data
     

Share This Page