Its likely that in one of your sessions you do have a diff and in the
other you don't and this has nothing to do with XP vs. Windows 7.  In
the session with no diff, the only diff around is the function, diff,
and you can't subscript a function.

Try this to see what variables are in your workspace:
  ls()


On Sun, Jan 17, 2010 at 4:40 AM, Tse Ching Biu, Alan (MKT)
<a...@baf.msmail.cuhk.edu.hk> wrote:
> Hello,
>
> I am a newbie.
>
> I can run the following code stored in "test.txt" without error using my
> XP machine:
>
> x <- scan("C:\\Rwork\\A.txt")
> x10 = filter(x, rep(1/10,10), sides=1)
> x
> x10
> for(i in 10:length(x)){
> if (x[i] > x10[i]) diff[i]="b" else diff[i]="s"
> }
>
> However, if I run it in another PC that uses Windows 7, the following
> error occurs:
>
>> source("c:\\Rwork\\test.txt")
> Read 290 items
> Error in diff[i] = "b" : object of type 'closure' is not subsettable
>
> I am using R 2.9.2.
>
> Thank you for your help.
>
> Alan
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to