简体   繁体   中英

R, suppress plot from curve function

when using the "curve" function in R, how do you suppress/stop the plot from showing up? For example, this code always plots the curve

my_curve = curve(x)

Is there a parameter to do this or should I being using a different function? I just want the xy points as a dataframe from the curve.

curve() is from the graphics library and is unhandy for generating lists.

Just try using:

x = seq(from, to, length.out = n)
y = function(x)

If you stick to the curve function, the closest to a solution I know is adding dev.off() after the curve() statement!

Here's a way to take advantage of the part of curve that you want without generating a plot.

I made a copy of the curve function (just type curve in the console); called it by a new name ( curve2 ); and commented out the four lines at the end starting with if (isTRUE(add)) . When it's called and assigned, I had a list with two vectors— x and y . No plot.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM