R with ggplot2: Keeping certain rows of a dataframe when making scatter plot The 2019 Stack Overflow Developer Survey Results Are InSide-by-side plots with ggplot2ggplot2 Scatter Plot LabelsHow to set limits for axes in ggplot2 R plots?Plotting two variables as lines using ggplot2 on the same graphggplot2 plot without axes, legends, etcLine plot using ggplot2 with manual line/fill color independent of group aestheticColor of regression line based on groups and points in the same groups don't match in ggplot2plot median values on top of a density distribution in ggplot2Putting two regressions together on a plot and it forms a kink in the lineCenter Plot title in ggplot2

Why is the maximum length of OpenWrt’s root password 8 characters?

Landlord wants to switch my lease to a "Land contract" to "get back at the city"

How was Skylab's orbit inclination chosen?

What tool would a Roman-age civilization have to grind silver and other metals into dust?

Is there a name of the flying bionic bird?

Output the Arecibo Message

How to change the limits of integration

Could JWST stay at L2 "forever"?

"To split hairs" vs "To be pedantic"

Access elements in std::string where positon of string is greater than its size

How come people say “Would of”?

aging parents with no investments

Is an up-to-date browser secure on an out-of-date OS?

Does a dangling wire really electrocute me if I'm standing in water?

If the Wish spell is used to duplicate the effect of Simulacrum, are existing duplicates destroyed?

What spell level should this homebrew After-Image spell be?

Why isn't airport relocation done gradually?

Deadlock Graph and Interpretation, solution to avoid

Inflated grade on resume at previous job, might former employer tell new employer?

What is the best strategy for white in this position?

Is three citations per paragraph excessive for undergraduate research paper?

Is bread bad for ducks?

Limit to 0 ambiguity

How are circuits which use complex ICs normally simulated?



R with ggplot2: Keeping certain rows of a dataframe when making scatter plot



The 2019 Stack Overflow Developer Survey Results Are InSide-by-side plots with ggplot2ggplot2 Scatter Plot LabelsHow to set limits for axes in ggplot2 R plots?Plotting two variables as lines using ggplot2 on the same graphggplot2 plot without axes, legends, etcLine plot using ggplot2 with manual line/fill color independent of group aestheticColor of regression line based on groups and points in the same groups don't match in ggplot2plot median values on top of a density distribution in ggplot2Putting two regressions together on a plot and it forms a kink in the lineCenter Plot title in ggplot2



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








2















A third week into my R class (please be patient with me even if it seems obvious where went wrong!), and I am struggling with a homework problem with using the R ggplot2 library. Using the built in diamonds data frame, the problem is to make a scatter plot regression line for log (carat) and log (price), but plotting only for the Fair and Ideal cut diamonds.



This is what the plot is supposed to look like



enter image description here



A quick background, the 3 variables in question here are carat (num), cut (Fair, Good, Very Good, Premium, Ideal), and price (int).



I start with the following code:



set.seed(123) 
d <- ggplot(diamonds[sample(nrow(diamonds),5000),] #this was provided to us in the homework

d + geom_point(aes(x = log(carat), y = log(price), colour = cut) +
labs(title = 'Regression line for Fair and Ideal Cut Diamonds') +
stat_smooth(aes(x = log(carat), y = log(price), colour = cut), method = "gam")


Here's what I got



enter image description here



Now, I know this is incorrect, because "colour = cut" shows ALL the cuts, but I only want "Fair" and "Ideal". The professor hinted that we should try diamonds$cut%in%c(...), and so I tried it in many different ways. One of the latest (wrong) code is:



d + geom_point(aes(x = log(carat), y = log(price), colour = diamonds[diamonds$cut%in%c("Fair","Ideal")]), alpha = 0.5) +
labs(title = 'Regression line for Fair and Ideal Cut Diamonds') +
stat_smooth(aes(x = log(carat), y = log(price), colour = diamonds[diamonds$cut%in%c("Fair","Ideal")]), method = "gam")


I continue to get error messages regardless of where I tried to subset the diamonds$cut (e.g., Length of logical index vector for '[' must equal number of columns, Aesthetics must be either length 1 or the same as the data (5000):colour).



How do I extract just the Fair and Ideal cut to make this graph?



Any help is appreciated!










share|improve this question



















  • 1





    You should filter your data first. See this tutorial suzan.rbind.io/2018/02/dplyr-tutorial-3

    – Tung
    Mar 22 at 2:47

















2















A third week into my R class (please be patient with me even if it seems obvious where went wrong!), and I am struggling with a homework problem with using the R ggplot2 library. Using the built in diamonds data frame, the problem is to make a scatter plot regression line for log (carat) and log (price), but plotting only for the Fair and Ideal cut diamonds.



This is what the plot is supposed to look like



enter image description here



A quick background, the 3 variables in question here are carat (num), cut (Fair, Good, Very Good, Premium, Ideal), and price (int).



I start with the following code:



set.seed(123) 
d <- ggplot(diamonds[sample(nrow(diamonds),5000),] #this was provided to us in the homework

d + geom_point(aes(x = log(carat), y = log(price), colour = cut) +
labs(title = 'Regression line for Fair and Ideal Cut Diamonds') +
stat_smooth(aes(x = log(carat), y = log(price), colour = cut), method = "gam")


Here's what I got



enter image description here



Now, I know this is incorrect, because "colour = cut" shows ALL the cuts, but I only want "Fair" and "Ideal". The professor hinted that we should try diamonds$cut%in%c(...), and so I tried it in many different ways. One of the latest (wrong) code is:



d + geom_point(aes(x = log(carat), y = log(price), colour = diamonds[diamonds$cut%in%c("Fair","Ideal")]), alpha = 0.5) +
labs(title = 'Regression line for Fair and Ideal Cut Diamonds') +
stat_smooth(aes(x = log(carat), y = log(price), colour = diamonds[diamonds$cut%in%c("Fair","Ideal")]), method = "gam")


I continue to get error messages regardless of where I tried to subset the diamonds$cut (e.g., Length of logical index vector for '[' must equal number of columns, Aesthetics must be either length 1 or the same as the data (5000):colour).



How do I extract just the Fair and Ideal cut to make this graph?



Any help is appreciated!










share|improve this question



















  • 1





    You should filter your data first. See this tutorial suzan.rbind.io/2018/02/dplyr-tutorial-3

    – Tung
    Mar 22 at 2:47













2












2








2








A third week into my R class (please be patient with me even if it seems obvious where went wrong!), and I am struggling with a homework problem with using the R ggplot2 library. Using the built in diamonds data frame, the problem is to make a scatter plot regression line for log (carat) and log (price), but plotting only for the Fair and Ideal cut diamonds.



This is what the plot is supposed to look like



enter image description here



A quick background, the 3 variables in question here are carat (num), cut (Fair, Good, Very Good, Premium, Ideal), and price (int).



I start with the following code:



set.seed(123) 
d <- ggplot(diamonds[sample(nrow(diamonds),5000),] #this was provided to us in the homework

d + geom_point(aes(x = log(carat), y = log(price), colour = cut) +
labs(title = 'Regression line for Fair and Ideal Cut Diamonds') +
stat_smooth(aes(x = log(carat), y = log(price), colour = cut), method = "gam")


Here's what I got



enter image description here



Now, I know this is incorrect, because "colour = cut" shows ALL the cuts, but I only want "Fair" and "Ideal". The professor hinted that we should try diamonds$cut%in%c(...), and so I tried it in many different ways. One of the latest (wrong) code is:



d + geom_point(aes(x = log(carat), y = log(price), colour = diamonds[diamonds$cut%in%c("Fair","Ideal")]), alpha = 0.5) +
labs(title = 'Regression line for Fair and Ideal Cut Diamonds') +
stat_smooth(aes(x = log(carat), y = log(price), colour = diamonds[diamonds$cut%in%c("Fair","Ideal")]), method = "gam")


I continue to get error messages regardless of where I tried to subset the diamonds$cut (e.g., Length of logical index vector for '[' must equal number of columns, Aesthetics must be either length 1 or the same as the data (5000):colour).



How do I extract just the Fair and Ideal cut to make this graph?



Any help is appreciated!










share|improve this question
















A third week into my R class (please be patient with me even if it seems obvious where went wrong!), and I am struggling with a homework problem with using the R ggplot2 library. Using the built in diamonds data frame, the problem is to make a scatter plot regression line for log (carat) and log (price), but plotting only for the Fair and Ideal cut diamonds.



This is what the plot is supposed to look like



enter image description here



A quick background, the 3 variables in question here are carat (num), cut (Fair, Good, Very Good, Premium, Ideal), and price (int).



I start with the following code:



set.seed(123) 
d <- ggplot(diamonds[sample(nrow(diamonds),5000),] #this was provided to us in the homework

d + geom_point(aes(x = log(carat), y = log(price), colour = cut) +
labs(title = 'Regression line for Fair and Ideal Cut Diamonds') +
stat_smooth(aes(x = log(carat), y = log(price), colour = cut), method = "gam")


Here's what I got



enter image description here



Now, I know this is incorrect, because "colour = cut" shows ALL the cuts, but I only want "Fair" and "Ideal". The professor hinted that we should try diamonds$cut%in%c(...), and so I tried it in many different ways. One of the latest (wrong) code is:



d + geom_point(aes(x = log(carat), y = log(price), colour = diamonds[diamonds$cut%in%c("Fair","Ideal")]), alpha = 0.5) +
labs(title = 'Regression line for Fair and Ideal Cut Diamonds') +
stat_smooth(aes(x = log(carat), y = log(price), colour = diamonds[diamonds$cut%in%c("Fair","Ideal")]), method = "gam")


I continue to get error messages regardless of where I tried to subset the diamonds$cut (e.g., Length of logical index vector for '[' must equal number of columns, Aesthetics must be either length 1 or the same as the data (5000):colour).



How do I extract just the Fair and Ideal cut to make this graph?



Any help is appreciated!







r ggplot2






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 22 at 3:55









Shahzaib Mazari

676




676










asked Mar 22 at 2:38









A.FarA.Far

114




114







  • 1





    You should filter your data first. See this tutorial suzan.rbind.io/2018/02/dplyr-tutorial-3

    – Tung
    Mar 22 at 2:47












  • 1





    You should filter your data first. See this tutorial suzan.rbind.io/2018/02/dplyr-tutorial-3

    – Tung
    Mar 22 at 2:47







1




1





You should filter your data first. See this tutorial suzan.rbind.io/2018/02/dplyr-tutorial-3

– Tung
Mar 22 at 2:47





You should filter your data first. See this tutorial suzan.rbind.io/2018/02/dplyr-tutorial-3

– Tung
Mar 22 at 2:47












2 Answers
2






active

oldest

votes


















1














This is the way to define the data argument to ggplot2 prior to declaring it within the ggplot argument, although I'm not sure how to filter the cut column when it is specified as a mapping variable in aes(colour = cut). Although the plot doesn't appear exactly as it should according to your post if that matters at this point. Hopefully this helps.



library(ggplot2)

set.seed(123)
z <- diamonds[sample(nrow(diamonds),5000),]
z <- z[z$cut %in% c("Fair", "Ideal"),]

d <- ggplot(data = z) +
geom_point(aes(x = log(carat), y = log(price), colour = cut), alpha = 0.5) +
labs(title = 'Regression line for Fair and Ideal Cut Diamonds') +
stat_smooth(aes(x = log(carat), y = log(price), colour = cut), method = "gam")
d




Created on 2019-03-21 by the reprex package (v0.2.1)






share|improve this answer


















  • 1





    Why not to stick with the tidyverse and use filter() instead of the archaic way of subsetting the data via [,]?;)

    – liborm
    Mar 22 at 7:28











  • Thank you, this is helpful!

    – A.Far
    Mar 22 at 11:01


















0














Use subset() to subset the data. One modification is to get exactly as your graph is changing the method to 'auto' in stat_smooth so the line will follow the data points.
The chart can't be same always as we are doing random sampling.



library(ggplot2)

df<-diamonds[sample(nrow(diamonds),50000),]

subset(df,cut%in%c("Fair","Ideal"))->df_fair_ideal

ggplot(df_fair_ideal,aes(x=log(carat),y=log(price),color=cut),alpha=0.5)+
labs(title = 'Regression line for Fair and Ideal Cut Diamonds') +
geom_point()+xlim(min(log(df_fair_ideal$carat)),max(log(df_fair_ideal$carat)))+
stat_smooth(method = "auto",se=T)


enter image description here






share|improve this answer























    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%2f55292108%2fr-with-ggplot2-keeping-certain-rows-of-a-dataframe-when-making-scatter-plot%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    This is the way to define the data argument to ggplot2 prior to declaring it within the ggplot argument, although I'm not sure how to filter the cut column when it is specified as a mapping variable in aes(colour = cut). Although the plot doesn't appear exactly as it should according to your post if that matters at this point. Hopefully this helps.



    library(ggplot2)

    set.seed(123)
    z <- diamonds[sample(nrow(diamonds),5000),]
    z <- z[z$cut %in% c("Fair", "Ideal"),]

    d <- ggplot(data = z) +
    geom_point(aes(x = log(carat), y = log(price), colour = cut), alpha = 0.5) +
    labs(title = 'Regression line for Fair and Ideal Cut Diamonds') +
    stat_smooth(aes(x = log(carat), y = log(price), colour = cut), method = "gam")
    d




    Created on 2019-03-21 by the reprex package (v0.2.1)






    share|improve this answer


















    • 1





      Why not to stick with the tidyverse and use filter() instead of the archaic way of subsetting the data via [,]?;)

      – liborm
      Mar 22 at 7:28











    • Thank you, this is helpful!

      – A.Far
      Mar 22 at 11:01















    1














    This is the way to define the data argument to ggplot2 prior to declaring it within the ggplot argument, although I'm not sure how to filter the cut column when it is specified as a mapping variable in aes(colour = cut). Although the plot doesn't appear exactly as it should according to your post if that matters at this point. Hopefully this helps.



    library(ggplot2)

    set.seed(123)
    z <- diamonds[sample(nrow(diamonds),5000),]
    z <- z[z$cut %in% c("Fair", "Ideal"),]

    d <- ggplot(data = z) +
    geom_point(aes(x = log(carat), y = log(price), colour = cut), alpha = 0.5) +
    labs(title = 'Regression line for Fair and Ideal Cut Diamonds') +
    stat_smooth(aes(x = log(carat), y = log(price), colour = cut), method = "gam")
    d




    Created on 2019-03-21 by the reprex package (v0.2.1)






    share|improve this answer


















    • 1





      Why not to stick with the tidyverse and use filter() instead of the archaic way of subsetting the data via [,]?;)

      – liborm
      Mar 22 at 7:28











    • Thank you, this is helpful!

      – A.Far
      Mar 22 at 11:01













    1












    1








    1







    This is the way to define the data argument to ggplot2 prior to declaring it within the ggplot argument, although I'm not sure how to filter the cut column when it is specified as a mapping variable in aes(colour = cut). Although the plot doesn't appear exactly as it should according to your post if that matters at this point. Hopefully this helps.



    library(ggplot2)

    set.seed(123)
    z <- diamonds[sample(nrow(diamonds),5000),]
    z <- z[z$cut %in% c("Fair", "Ideal"),]

    d <- ggplot(data = z) +
    geom_point(aes(x = log(carat), y = log(price), colour = cut), alpha = 0.5) +
    labs(title = 'Regression line for Fair and Ideal Cut Diamonds') +
    stat_smooth(aes(x = log(carat), y = log(price), colour = cut), method = "gam")
    d




    Created on 2019-03-21 by the reprex package (v0.2.1)






    share|improve this answer













    This is the way to define the data argument to ggplot2 prior to declaring it within the ggplot argument, although I'm not sure how to filter the cut column when it is specified as a mapping variable in aes(colour = cut). Although the plot doesn't appear exactly as it should according to your post if that matters at this point. Hopefully this helps.



    library(ggplot2)

    set.seed(123)
    z <- diamonds[sample(nrow(diamonds),5000),]
    z <- z[z$cut %in% c("Fair", "Ideal"),]

    d <- ggplot(data = z) +
    geom_point(aes(x = log(carat), y = log(price), colour = cut), alpha = 0.5) +
    labs(title = 'Regression line for Fair and Ideal Cut Diamonds') +
    stat_smooth(aes(x = log(carat), y = log(price), colour = cut), method = "gam")
    d




    Created on 2019-03-21 by the reprex package (v0.2.1)







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Mar 22 at 3:16









    PrevostPrevost

    346113




    346113







    • 1





      Why not to stick with the tidyverse and use filter() instead of the archaic way of subsetting the data via [,]?;)

      – liborm
      Mar 22 at 7:28











    • Thank you, this is helpful!

      – A.Far
      Mar 22 at 11:01












    • 1





      Why not to stick with the tidyverse and use filter() instead of the archaic way of subsetting the data via [,]?;)

      – liborm
      Mar 22 at 7:28











    • Thank you, this is helpful!

      – A.Far
      Mar 22 at 11:01







    1




    1





    Why not to stick with the tidyverse and use filter() instead of the archaic way of subsetting the data via [,]?;)

    – liborm
    Mar 22 at 7:28





    Why not to stick with the tidyverse and use filter() instead of the archaic way of subsetting the data via [,]?;)

    – liborm
    Mar 22 at 7:28













    Thank you, this is helpful!

    – A.Far
    Mar 22 at 11:01





    Thank you, this is helpful!

    – A.Far
    Mar 22 at 11:01













    0














    Use subset() to subset the data. One modification is to get exactly as your graph is changing the method to 'auto' in stat_smooth so the line will follow the data points.
    The chart can't be same always as we are doing random sampling.



    library(ggplot2)

    df<-diamonds[sample(nrow(diamonds),50000),]

    subset(df,cut%in%c("Fair","Ideal"))->df_fair_ideal

    ggplot(df_fair_ideal,aes(x=log(carat),y=log(price),color=cut),alpha=0.5)+
    labs(title = 'Regression line for Fair and Ideal Cut Diamonds') +
    geom_point()+xlim(min(log(df_fair_ideal$carat)),max(log(df_fair_ideal$carat)))+
    stat_smooth(method = "auto",se=T)


    enter image description here






    share|improve this answer



























      0














      Use subset() to subset the data. One modification is to get exactly as your graph is changing the method to 'auto' in stat_smooth so the line will follow the data points.
      The chart can't be same always as we are doing random sampling.



      library(ggplot2)

      df<-diamonds[sample(nrow(diamonds),50000),]

      subset(df,cut%in%c("Fair","Ideal"))->df_fair_ideal

      ggplot(df_fair_ideal,aes(x=log(carat),y=log(price),color=cut),alpha=0.5)+
      labs(title = 'Regression line for Fair and Ideal Cut Diamonds') +
      geom_point()+xlim(min(log(df_fair_ideal$carat)),max(log(df_fair_ideal$carat)))+
      stat_smooth(method = "auto",se=T)


      enter image description here






      share|improve this answer

























        0












        0








        0







        Use subset() to subset the data. One modification is to get exactly as your graph is changing the method to 'auto' in stat_smooth so the line will follow the data points.
        The chart can't be same always as we are doing random sampling.



        library(ggplot2)

        df<-diamonds[sample(nrow(diamonds),50000),]

        subset(df,cut%in%c("Fair","Ideal"))->df_fair_ideal

        ggplot(df_fair_ideal,aes(x=log(carat),y=log(price),color=cut),alpha=0.5)+
        labs(title = 'Regression line for Fair and Ideal Cut Diamonds') +
        geom_point()+xlim(min(log(df_fair_ideal$carat)),max(log(df_fair_ideal$carat)))+
        stat_smooth(method = "auto",se=T)


        enter image description here






        share|improve this answer













        Use subset() to subset the data. One modification is to get exactly as your graph is changing the method to 'auto' in stat_smooth so the line will follow the data points.
        The chart can't be same always as we are doing random sampling.



        library(ggplot2)

        df<-diamonds[sample(nrow(diamonds),50000),]

        subset(df,cut%in%c("Fair","Ideal"))->df_fair_ideal

        ggplot(df_fair_ideal,aes(x=log(carat),y=log(price),color=cut),alpha=0.5)+
        labs(title = 'Regression line for Fair and Ideal Cut Diamonds') +
        geom_point()+xlim(min(log(df_fair_ideal$carat)),max(log(df_fair_ideal$carat)))+
        stat_smooth(method = "auto",se=T)


        enter image description here







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 22 at 9:53









        Satish ChillojiSatish Chilloji

        362




        362



























            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%2f55292108%2fr-with-ggplot2-keeping-certain-rows-of-a-dataframe-when-making-scatter-plot%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

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript