Please consider the following R statements:
> x = seq(1:1632)
> length( MyData$NWorth )
[1] 1632
> length( MyData$NWorthSm )
[1] 1632
> plot( x, MyData$NWorth, type="l" )
> plot( x, MyData$NWorthSm, type="l" )
> plot( x, MyData$NWorth, MyData$NWorthSm, type="l" )
All of the above statements work except for the last one. The last one
produces the following message:
Error in plot.window(...) : invalid 'xlim' value
So I then tired this:
> xlim1 = c(0, 5000)
>plot( x, MyData$NWorth, MyData$NWorthSm, type="l", xlim =
xlim1 )
Which produced the following error message:
Error in plot.window(...) : invalid 'ylim' value
So, I tired this:
> ylim1 = c(0,9000)
> plot( x, MyData$NWorth, MyData$NWorthSm, type="l", xlim =
xlim1,
ylim = ylim1 )
Which produced the following error message:
Error in strsplit(log, NULL) : non-character argument
I would like to know what I am doing wrong.
Thank you,
Bob
Dear Bob We do not have your data so it is hard to be sure but plot() takes two parameters for the data x and y so when you give it three you are confusing it into thinking one of them is something else. What exactly were you trying to do with the failed command? On 18/12/2018 14:17, rsherry8 wrote:> > Please consider the following R statements: > > ??? > x = seq(1:1632) > ??? > length( MyData$NWorth ) > ??? [1] 1632 > ??? > length( MyData$NWorthSm ) > ??? [1] 1632 > ??? > plot( x, MyData$NWorth, type="l" ) > ??? > plot( x, MyData$NWorthSm, type="l" ) > ??? > plot( x, MyData$NWorth, MyData$NWorthSm, type="l" ) > > All of the above statements work except for the last one. The last one > produces the following message: > > ??? Error in plot.window(...) : invalid 'xlim' value > > So I then tired this: > > ??? > xlim1 = c(0, 5000) > ??? >plot( x, MyData$NWorth, MyData$NWorthSm, type="l", xlim = xlim1 ) > > Which produced the following error message: > ??? Error in plot.window(...) : invalid 'ylim' value > > So, I tired this: > ??? > ylim1 = c(0,9000) > ??? > plot( x, MyData$NWorth, MyData$NWorthSm, type="l", xlim = xlim1, > ylim = ylim1 ) > > Which produced the following error message: > ??? Error in strsplit(log, NULL) : non-character argument > > I would like to know what I am doing wrong. > > Thank you, > Bob > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. >-- Michael http://www.dewey.myzen.co.uk/home.html
Hello,
You are calling plot.default with 4 arguments.
The first 2 are x and y.
The 3rd is type.
So MyData$NWorthSm becomes the 4th, xlim.
When you pass xlim a value, MyData$NWorthSm becomes the next one, ylim.
Etc, etc, etc.
It will throw the errors in the order of the arguments you can see in
?plot.default:
## Default S3 method:
plot(x, y = NULL, type = "p", xlim = NULL, ylim = NULL,
log = "", main = NULL, etc, etc, etc)
So now if you pass a log = <something>, it's the time for argument
main.
Revise the reason why you are passing MyData$NWorthSm.
Hope this helps,
Rui Barradas
?s 14:17 de 18/12/2018, rsherry8 escreveu:>
> Please consider the following R statements:
>
> ??? > x = seq(1:1632)
> ??? > length( MyData$NWorth )
> ??? [1] 1632
> ??? > length( MyData$NWorthSm )
> ??? [1] 1632
> ??? > plot( x, MyData$NWorth, type="l" )
> ??? > plot( x, MyData$NWorthSm, type="l" )
> ??? > plot( x, MyData$NWorth, MyData$NWorthSm, type="l" )
>
> All of the above statements work except for the last one. The last one
> produces the following message:
>
> ??? Error in plot.window(...) : invalid 'xlim' value
>
> So I then tired this:
>
> ??? > xlim1 = c(0, 5000)
> ??? >plot( x, MyData$NWorth, MyData$NWorthSm, type="l", xlim
= xlim1 )
>
> Which produced the following error message:
> ??? Error in plot.window(...) : invalid 'ylim' value
>
> So, I tired this:
> ??? > ylim1 = c(0,9000)
> ??? > plot( x, MyData$NWorth, MyData$NWorthSm, type="l", xlim
= xlim1,
> ylim = ylim1 )
>
> Which produced the following error message:
> ??? Error in strsplit(log, NULL) : non-character argument
>
> I would like to know what I am doing wrong.
>
> Thank you,
> Bob
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
You haven't described what you are trying to get with the command that
doesn't work. My guess is that this might be what you want:
plot( x, MyData$NWorth, type="l" )
lines( x, MyData$NWorthSm)
However, you might also have to calculate and supply a for the ylim argument to
plot().
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
Lab cell 925-724-7509
?On 12/18/18, 6:17 AM, "R-help on behalf of rsherry8"
<r-help-bounces at r-project.org on behalf of rsherry8 at comcast.net>
wrote:
Please consider the following R statements:
> x = seq(1:1632)
> length( MyData$NWorth )
[1] 1632
> length( MyData$NWorthSm )
[1] 1632
> plot( x, MyData$NWorth, type="l" )
> plot( x, MyData$NWorthSm, type="l" )
> plot( x, MyData$NWorth, MyData$NWorthSm, type="l" )
All of the above statements work except for the last one. The last one
produces the following message:
Error in plot.window(...) : invalid 'xlim' value
So I then tired this:
> xlim1 = c(0, 5000)
>plot( x, MyData$NWorth, MyData$NWorthSm, type="l", xlim =
xlim1 )
Which produced the following error message:
Error in plot.window(...) : invalid 'ylim' value
So, I tired this:
> ylim1 = c(0,9000)
> plot( x, MyData$NWorth, MyData$NWorthSm, type="l", xlim
= xlim1,
ylim = ylim1 )
Which produced the following error message:
Error in strsplit(log, NULL) : non-character argument
I would like to know what I am doing wrong.
Thank you,
Bob
______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.