Interpolating three columns2019 Community Moderator ElectionHow to sort a dataframe by multiple column(s)?How to drop columns by name in a data frameInterpolate product attributesInterpolate data using plyr in RCreate an empty data.frameStandardize data columns in Rdata.table vs dplyr: can one do something well the other can't or does poorly?Using mutate to interpolate based on subset of columns in dataframeR Linear interpolation between two data setsFilling NA in timeseries data with different interpolation techniques
Are small insurances worth it?
Is a piano played in the same way as a harmonium?
Is it possible to avoid unpacking when merging Association?
Haman going to the second feast dirty
I reported the illegal activity of my boss to his boss. My boss found out. Now I am being punished. What should I do?
Power Strip for Europe
What will happen if my luggage gets delayed?
Specifying a starting column with colortbl package and xcolor
Does a difference of tense count as a difference of meaning in a minimal pair?
What is better: yes / no radio, or simple checkbox?
Does "Until when" sound natural for native speakers?
Why does liquid water form when we exhale on a mirror?
Why restrict private health insurance?
What do *foreign films* mean for an American?
Plausibility of Mushroom Buildings
Why aren't there more Gauls like Obelix?
Has a sovereign Communist government ever run, and conceded loss, on a fair election?
What do you call someone who likes to pick fights?
Can I negotiate a patent idea for a raise, under French law?
What ability score modifier does a javelin's damage use?
Virginia employer terminated employee and wants signing bonus returned
Does an unused member variable take up memory?
Called into a meeting and told we are being made redundant (laid off) and "not to share outside". Can I tell my partner?
How to write a chaotic neutral protagonist and prevent my readers from thinking they are evil?
Interpolating three columns
2019 Community Moderator ElectionHow to sort a dataframe by multiple column(s)?How to drop columns by name in a data frameInterpolate product attributesInterpolate data using plyr in RCreate an empty data.frameStandardize data columns in Rdata.table vs dplyr: can one do something well the other can't or does poorly?Using mutate to interpolate based on subset of columns in dataframeR Linear interpolation between two data setsFilling NA in timeseries data with different interpolation techniques
I have a set of data in ranges like:
x|y|z
-4|1|45
-4|2|68
-4|3|96
-2|1|56
-2|2|65
-2|3|89
0|1|45
0|2|56
0|3|75
2|1|23
2|2|56
2|3|75
4|1|42
4|2|65
4|3|78
Here I need to interpolate between x and y using the z value.
I tried interpolating separately for x and y using z value by using the below code:
interpol<-approx(x,z,method="linear")
interpol_1<-approx(y,z,method="linear")
Now I'm trying to use all the three columns but values are coming wrong.
r
add a comment |
I have a set of data in ranges like:
x|y|z
-4|1|45
-4|2|68
-4|3|96
-2|1|56
-2|2|65
-2|3|89
0|1|45
0|2|56
0|3|75
2|1|23
2|2|56
2|3|75
4|1|42
4|2|65
4|3|78
Here I need to interpolate between x and y using the z value.
I tried interpolating separately for x and y using z value by using the below code:
interpol<-approx(x,z,method="linear")
interpol_1<-approx(y,z,method="linear")
Now I'm trying to use all the three columns but values are coming wrong.
r
What error are you getting and what are you expecting?
– Stedy
Mar 7 at 5:30
I need to interpolate x,y and z. say there is a missing value for x,y,z for 1st and 2nd row. We need to find this intermediate missing value for x,y,z column.
– Sara
Mar 7 at 7:07
add a comment |
I have a set of data in ranges like:
x|y|z
-4|1|45
-4|2|68
-4|3|96
-2|1|56
-2|2|65
-2|3|89
0|1|45
0|2|56
0|3|75
2|1|23
2|2|56
2|3|75
4|1|42
4|2|65
4|3|78
Here I need to interpolate between x and y using the z value.
I tried interpolating separately for x and y using z value by using the below code:
interpol<-approx(x,z,method="linear")
interpol_1<-approx(y,z,method="linear")
Now I'm trying to use all the three columns but values are coming wrong.
r
I have a set of data in ranges like:
x|y|z
-4|1|45
-4|2|68
-4|3|96
-2|1|56
-2|2|65
-2|3|89
0|1|45
0|2|56
0|3|75
2|1|23
2|2|56
2|3|75
4|1|42
4|2|65
4|3|78
Here I need to interpolate between x and y using the z value.
I tried interpolating separately for x and y using z value by using the below code:
interpol<-approx(x,z,method="linear")
interpol_1<-approx(y,z,method="linear")
Now I'm trying to use all the three columns but values are coming wrong.
r
r
edited Mar 7 at 5:27
d.b
19.3k41848
19.3k41848
asked Mar 7 at 5:19
SaraSara
4818
4818
What error are you getting and what are you expecting?
– Stedy
Mar 7 at 5:30
I need to interpolate x,y and z. say there is a missing value for x,y,z for 1st and 2nd row. We need to find this intermediate missing value for x,y,z column.
– Sara
Mar 7 at 7:07
add a comment |
What error are you getting and what are you expecting?
– Stedy
Mar 7 at 5:30
I need to interpolate x,y and z. say there is a missing value for x,y,z for 1st and 2nd row. We need to find this intermediate missing value for x,y,z column.
– Sara
Mar 7 at 7:07
What error are you getting and what are you expecting?
– Stedy
Mar 7 at 5:30
What error are you getting and what are you expecting?
– Stedy
Mar 7 at 5:30
I need to interpolate x,y and z. say there is a missing value for x,y,z for 1st and 2nd row. We need to find this intermediate missing value for x,y,z column.
– Sara
Mar 7 at 7:07
I need to interpolate x,y and z. say there is a missing value for x,y,z for 1st and 2nd row. We need to find this intermediate missing value for x,y,z column.
– Sara
Mar 7 at 7:07
add a comment |
1 Answer
1
active
oldest
votes
In your script you forgot to direct to your data.frame
. Note the use of $
in the approx
function.
interpol <- approx(df$x,df$z,method="linear")
interpol_1 <- approx(df$y,df$z,method="linear")
Data:
df <- data.frame(
x = c(-4, -4, -4, -2, -2, -2, 0, 0, 0, 2, 2, 2, 4, 4, 4),
y = c(1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3),
z = c(45, 68, 96, 56, 65, 89, 45, 56, 75, 23, 56, 75, 42, 65, 78)
)
Thanks for you suggestion. I tried using dataframe. I looking for code like: interpol <- approx(df$x,df$y,df$z,method="linear") Is there any possiblity to include three columns?
– Sara
Mar 7 at 7:17
1
Are you looking to interpolate from 3 columns? I don't thinkapprox
supports that.
– DJV
Mar 7 at 8:49
yes exactly... then can u suggest me which function supports to interpolate three columns?? @DJV
– Sara
Mar 7 at 9:00
yes exactly.. can u please suggest me which function works out to interpolate three columns in R?
– Sara
Mar 7 at 9:04
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55036567%2finterpolating-three-columns%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
In your script you forgot to direct to your data.frame
. Note the use of $
in the approx
function.
interpol <- approx(df$x,df$z,method="linear")
interpol_1 <- approx(df$y,df$z,method="linear")
Data:
df <- data.frame(
x = c(-4, -4, -4, -2, -2, -2, 0, 0, 0, 2, 2, 2, 4, 4, 4),
y = c(1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3),
z = c(45, 68, 96, 56, 65, 89, 45, 56, 75, 23, 56, 75, 42, 65, 78)
)
Thanks for you suggestion. I tried using dataframe. I looking for code like: interpol <- approx(df$x,df$y,df$z,method="linear") Is there any possiblity to include three columns?
– Sara
Mar 7 at 7:17
1
Are you looking to interpolate from 3 columns? I don't thinkapprox
supports that.
– DJV
Mar 7 at 8:49
yes exactly... then can u suggest me which function supports to interpolate three columns?? @DJV
– Sara
Mar 7 at 9:00
yes exactly.. can u please suggest me which function works out to interpolate three columns in R?
– Sara
Mar 7 at 9:04
add a comment |
In your script you forgot to direct to your data.frame
. Note the use of $
in the approx
function.
interpol <- approx(df$x,df$z,method="linear")
interpol_1 <- approx(df$y,df$z,method="linear")
Data:
df <- data.frame(
x = c(-4, -4, -4, -2, -2, -2, 0, 0, 0, 2, 2, 2, 4, 4, 4),
y = c(1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3),
z = c(45, 68, 96, 56, 65, 89, 45, 56, 75, 23, 56, 75, 42, 65, 78)
)
Thanks for you suggestion. I tried using dataframe. I looking for code like: interpol <- approx(df$x,df$y,df$z,method="linear") Is there any possiblity to include three columns?
– Sara
Mar 7 at 7:17
1
Are you looking to interpolate from 3 columns? I don't thinkapprox
supports that.
– DJV
Mar 7 at 8:49
yes exactly... then can u suggest me which function supports to interpolate three columns?? @DJV
– Sara
Mar 7 at 9:00
yes exactly.. can u please suggest me which function works out to interpolate three columns in R?
– Sara
Mar 7 at 9:04
add a comment |
In your script you forgot to direct to your data.frame
. Note the use of $
in the approx
function.
interpol <- approx(df$x,df$z,method="linear")
interpol_1 <- approx(df$y,df$z,method="linear")
Data:
df <- data.frame(
x = c(-4, -4, -4, -2, -2, -2, 0, 0, 0, 2, 2, 2, 4, 4, 4),
y = c(1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3),
z = c(45, 68, 96, 56, 65, 89, 45, 56, 75, 23, 56, 75, 42, 65, 78)
)
In your script you forgot to direct to your data.frame
. Note the use of $
in the approx
function.
interpol <- approx(df$x,df$z,method="linear")
interpol_1 <- approx(df$y,df$z,method="linear")
Data:
df <- data.frame(
x = c(-4, -4, -4, -2, -2, -2, 0, 0, 0, 2, 2, 2, 4, 4, 4),
y = c(1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3),
z = c(45, 68, 96, 56, 65, 89, 45, 56, 75, 23, 56, 75, 42, 65, 78)
)
answered Mar 7 at 7:10
DJVDJV
1,6131417
1,6131417
Thanks for you suggestion. I tried using dataframe. I looking for code like: interpol <- approx(df$x,df$y,df$z,method="linear") Is there any possiblity to include three columns?
– Sara
Mar 7 at 7:17
1
Are you looking to interpolate from 3 columns? I don't thinkapprox
supports that.
– DJV
Mar 7 at 8:49
yes exactly... then can u suggest me which function supports to interpolate three columns?? @DJV
– Sara
Mar 7 at 9:00
yes exactly.. can u please suggest me which function works out to interpolate three columns in R?
– Sara
Mar 7 at 9:04
add a comment |
Thanks for you suggestion. I tried using dataframe. I looking for code like: interpol <- approx(df$x,df$y,df$z,method="linear") Is there any possiblity to include three columns?
– Sara
Mar 7 at 7:17
1
Are you looking to interpolate from 3 columns? I don't thinkapprox
supports that.
– DJV
Mar 7 at 8:49
yes exactly... then can u suggest me which function supports to interpolate three columns?? @DJV
– Sara
Mar 7 at 9:00
yes exactly.. can u please suggest me which function works out to interpolate three columns in R?
– Sara
Mar 7 at 9:04
Thanks for you suggestion. I tried using dataframe. I looking for code like: interpol <- approx(df$x,df$y,df$z,method="linear") Is there any possiblity to include three columns?
– Sara
Mar 7 at 7:17
Thanks for you suggestion. I tried using dataframe. I looking for code like: interpol <- approx(df$x,df$y,df$z,method="linear") Is there any possiblity to include three columns?
– Sara
Mar 7 at 7:17
1
1
Are you looking to interpolate from 3 columns? I don't think
approx
supports that.– DJV
Mar 7 at 8:49
Are you looking to interpolate from 3 columns? I don't think
approx
supports that.– DJV
Mar 7 at 8:49
yes exactly... then can u suggest me which function supports to interpolate three columns?? @DJV
– Sara
Mar 7 at 9:00
yes exactly... then can u suggest me which function supports to interpolate three columns?? @DJV
– Sara
Mar 7 at 9:00
yes exactly.. can u please suggest me which function works out to interpolate three columns in R?
– Sara
Mar 7 at 9:04
yes exactly.. can u please suggest me which function works out to interpolate three columns in R?
– Sara
Mar 7 at 9:04
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55036567%2finterpolating-three-columns%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What error are you getting and what are you expecting?
– Stedy
Mar 7 at 5:30
I need to interpolate x,y and z. say there is a missing value for x,y,z for 1st and 2nd row. We need to find this intermediate missing value for x,y,z column.
– Sara
Mar 7 at 7:07