[R] How to Import Data

Ben Bolker bolker at ufl.edu
Tue Feb 21 15:08:58 CET 2006


Carl Klarner <cklarner <at> isugw.indstate.edu> writes:

> 
> I would imagine I'm not putting my csv file in the right location for R
> to be able to read it.  If that's the case, where should I put it?  Or
> is there something else I need to do to it first?
> Thanks for your help,
> Carl

  You're probably right.  R opens by default in its installation
directory (usually somewhere in Program Files\R\... on Windows)
The easiest thing is to change the working directory to wherever
you have the files using setwd() or (in a GUI) some menu option
("Change dir" in the File menu under Windows).

   Useful functions for working directory, file selection etc.:
list.files() [list files in current directory], file.choose() [interactive
file chooser], file.exists() [whether or not a file exists], getwd() [print
current working directory], setwd() [set current working directory].

  The other common problem, which you probably *aren't* having, is
hidden file extensions under Windows.

   good luck
     Ben Bolker




More information about the R-help mailing list