Passing a filepath to a R function?

Posted by Philipp on Stack Overflow See other posts from Stack Overflow or by Philipp
Published on 2010-06-02T10:11:34Z Indexed on 2010/06/02 10:13 UTC
Read the original article Hit count: 196

Filed under:
|
|

Hi everybody,

I tried to pass a filepath to a function in R, but I failed =/ I hope someone here can help me.

>heat <- function(filepath) 
{ chicks <- read.table(file=filepath, dec=",", header=TRUE, sep="\t")
...
}

When I call the function, nothing happens...

>heat("/home/.../file.txt")

... and "chicks" is not found

>chicks
Error: Object 'chicks' not found

What is the correct way to pass a path to a function?

Best wishes from Germany, Phil

© Stack Overflow or respective owner

Related posts about function

Related posts about r