[R] Vary an equation using values from a sequence

Jake William Andrae jake.andrae at adelaide.edu.au
Thu Mar 15 06:11:32 CET 2018

Thank you, I�ll give it a try.

Get Outlook for iOS<https://aka.ms/o0ukef>
From: Bert Gunter <bgunter.4567 at gmail.com>
Sent: Thursday, March 15, 2018 3:23:18 PM
To: Jake William Andrae
Cc: R-help
Subject: Re: [R] Vary an equation using values from a sequence

I thnk what you want is ?outer. e.g.:

outer(Data -min(Data),value,FUN = "+")

Whether this works for your real task, however, may depend on details and complexities that you have omitted.


Bert Gunter

"The trouble with having an open mind is that people keep coming along and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Wed, Mar 14, 2018 at 9:14 PM, Jake William Andrae <jake.andrae at adelaide.edu.au<mailto:jake.andrae at adelaide.edu.au>> wrote:
Hi All,

I have a vector of data on which I am operating. The equation with which I want to operate on the vector has a value k. I want to run the equation and output a new vector, each time replacing k with each value from the sequence I defined. I have thought about using for loops and such, but this seems like overkill. I am wondering if there is a simple solution that would allow me to accomplish this.

The code I am using is outlined below.

Data <- c(1:10) #Data
value <- seq(from = 0, to = 100 , by = 0.01) #Sequence
Data - min(Data) + k # Equation


Jake Andrae
PhD Candidate
Geology & Geophysics � Sprigg Geobiology Centre
Department of Earth Science
School of Physical Sciences
The University of Adelaide, AUSTRALIA 5005
Phone: 0407701565
Email: jake.andrae at adelaide.edu.au<mailto:jake.andrae at adelaide.edu.au>

        [[alternative HTML version deleted]]

R-help at r-project.org<mailto:R-help at r-project.org> mailing list -- To UNSUBSCRIBE and more, see
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

	[[alternative HTML version deleted]]

More information about the R-help mailing list