Re: [R] Problem in executing R-script

2012-05-07 Thread Suhaila Haji Mohd Hussin
Thank Sarah! > Date: Mon, 7 May 2012 14:06:31 -0400 > Subject: Re: [R] Problem in executing R-script > From: sarah.gos...@gmail.com > To: bell_beaut...@hotmail.com > CC: r-help@r-project.org > > Hi Suhaila, > > You don't need to make a function: your s

Re: [R] Problem in executing R-script

2012-05-07 Thread Berend Hasselman
On 07-05-2012, at 19:41, Suhaila Haji Mohd Hussin wrote: > > Hello. I'm a newbie here. > In my script (I name it readData.R), I wrote the followings: > readData <-function(){med = read.csv("medicalData.csv");} > Then I tested the script by 'Source R Code' then on the command I typed > '

Re: [R] Problem in executing R-script

2012-05-07 Thread Sarah Goslee
Hi Suhaila, You don't need to make a function: your script should just contain: med <- read.csv("medicalData.csv") If you do want to make a function, then you need to assign the resulting value to something, eg: med <- readData() but there's no reason to do that. Values that are assigned within

Re: [R] Problem in executing R-script

2012-05-07 Thread R. Michael Weylandt
R is a functional language so, by default, assignments (and other things) within function scope doesn't have global effects. This is generally considered a _very good thing_ in language design. You'd perhaps prefer something like: readData <- function() { read.csv("medialData.csv") } med <- r

[R] Problem in executing R-script

2012-05-07 Thread Suhaila Haji Mohd Hussin
Hello. I'm a newbie here. In my script (I name it readData.R), I wrote the followings: readData <-function(){ med = read.csv("medicalData.csv");} Then I tested the script by 'Source R Code' then on the command I typed 'readData()' then I typed 'med' to check if the variable contains the medical