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










0















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.










share|improve this question
























  • 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















0















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.










share|improve this question
























  • 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













0












0








0








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.










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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

















  • 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












1 Answer
1






active

oldest

votes


















1














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)
)





share|improve this answer























  • 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 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.. can u please suggest me which function works out to interpolate three columns in R?

    – Sara
    Mar 7 at 9:04










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
);



);













draft saved

draft discarded


















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









1














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)
)





share|improve this answer























  • 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 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.. can u please suggest me which function works out to interpolate three columns in R?

    – Sara
    Mar 7 at 9:04















1














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)
)





share|improve this answer























  • 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 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.. can u please suggest me which function works out to interpolate three columns in R?

    – Sara
    Mar 7 at 9:04













1












1








1







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)
)





share|improve this answer













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)
)






share|improve this answer












share|improve this answer



share|improve this answer










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 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.. 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







  • 1





    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.. 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



















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived

Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme