How to plot the data I read from a file in R?











up vote
0
down vote

favorite












Our instructor assigned us with typing a R script. We don't have any study paper or source for the codes that the instructor typed on class so I'm trying to get help from the articles on internet but I still couldn't find a guide for what I need. Please don't get me wrong, I don't request for someone to do my homework I'm just looking for some tips or any guide links that can help me. When I search on google, not all of the results are related to this and they are usually not helping me or too complicated. The assignment is:




  • Read data from a .txt file. (I researched and learned how to read data but my problem is I don't know which type of data should I type on the text file to make it plottable by average, standart deviation, histogram etc.)

  • On the first screen, plot the data, plot the average and plot the standart deviation as line

  • on the second screen, plot a line from corner to corner and sort the values on it

  • third screen, plot the data as histogram and plot the distribution function on it

  • 4th screen, plot the anomaly and anomaly line = 0, then make the values that are higher than the anomaly line with different pch than the ones that is lower

  • finally get the png of 4 screens (i found how to do this)
    Thanks.










share|improve this question
























  • There were no books assigned for the class? Given the scope of this assignment, it's difficult to believe that there hasn't been a lead up to this assignment.
    – hrbrmstr
    Nov 8 at 11:33










  • This is a very usefull guide: cran.r-project.org/doc/contrib/Paradis-rdebuts_en.pdf
    – Santiago I. Hurtado
    Nov 8 at 11:37










  • @SantiagoHurtado I disagree. For one thing it’s severely outdated. For another, it starts off with lots of irrelevant low-level details. That’s a bad way of teaching. I recommend a modern approach, e.g.*R for Data Science* by Grolemund and Wickham instead.
    – Konrad Rudolph
    Nov 8 at 11:48















up vote
0
down vote

favorite












Our instructor assigned us with typing a R script. We don't have any study paper or source for the codes that the instructor typed on class so I'm trying to get help from the articles on internet but I still couldn't find a guide for what I need. Please don't get me wrong, I don't request for someone to do my homework I'm just looking for some tips or any guide links that can help me. When I search on google, not all of the results are related to this and they are usually not helping me or too complicated. The assignment is:




  • Read data from a .txt file. (I researched and learned how to read data but my problem is I don't know which type of data should I type on the text file to make it plottable by average, standart deviation, histogram etc.)

  • On the first screen, plot the data, plot the average and plot the standart deviation as line

  • on the second screen, plot a line from corner to corner and sort the values on it

  • third screen, plot the data as histogram and plot the distribution function on it

  • 4th screen, plot the anomaly and anomaly line = 0, then make the values that are higher than the anomaly line with different pch than the ones that is lower

  • finally get the png of 4 screens (i found how to do this)
    Thanks.










share|improve this question
























  • There were no books assigned for the class? Given the scope of this assignment, it's difficult to believe that there hasn't been a lead up to this assignment.
    – hrbrmstr
    Nov 8 at 11:33










  • This is a very usefull guide: cran.r-project.org/doc/contrib/Paradis-rdebuts_en.pdf
    – Santiago I. Hurtado
    Nov 8 at 11:37










  • @SantiagoHurtado I disagree. For one thing it’s severely outdated. For another, it starts off with lots of irrelevant low-level details. That’s a bad way of teaching. I recommend a modern approach, e.g.*R for Data Science* by Grolemund and Wickham instead.
    – Konrad Rudolph
    Nov 8 at 11:48













up vote
0
down vote

favorite









up vote
0
down vote

favorite











Our instructor assigned us with typing a R script. We don't have any study paper or source for the codes that the instructor typed on class so I'm trying to get help from the articles on internet but I still couldn't find a guide for what I need. Please don't get me wrong, I don't request for someone to do my homework I'm just looking for some tips or any guide links that can help me. When I search on google, not all of the results are related to this and they are usually not helping me or too complicated. The assignment is:




  • Read data from a .txt file. (I researched and learned how to read data but my problem is I don't know which type of data should I type on the text file to make it plottable by average, standart deviation, histogram etc.)

  • On the first screen, plot the data, plot the average and plot the standart deviation as line

  • on the second screen, plot a line from corner to corner and sort the values on it

  • third screen, plot the data as histogram and plot the distribution function on it

  • 4th screen, plot the anomaly and anomaly line = 0, then make the values that are higher than the anomaly line with different pch than the ones that is lower

  • finally get the png of 4 screens (i found how to do this)
    Thanks.










share|improve this question















Our instructor assigned us with typing a R script. We don't have any study paper or source for the codes that the instructor typed on class so I'm trying to get help from the articles on internet but I still couldn't find a guide for what I need. Please don't get me wrong, I don't request for someone to do my homework I'm just looking for some tips or any guide links that can help me. When I search on google, not all of the results are related to this and they are usually not helping me or too complicated. The assignment is:




  • Read data from a .txt file. (I researched and learned how to read data but my problem is I don't know which type of data should I type on the text file to make it plottable by average, standart deviation, histogram etc.)

  • On the first screen, plot the data, plot the average and plot the standart deviation as line

  • on the second screen, plot a line from corner to corner and sort the values on it

  • third screen, plot the data as histogram and plot the distribution function on it

  • 4th screen, plot the anomaly and anomaly line = 0, then make the values that are higher than the anomaly line with different pch than the ones that is lower

  • finally get the png of 4 screens (i found how to do this)
    Thanks.







r plot






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 8 at 11:32









hrbrmstr

59.6k585146




59.6k585146










asked Nov 8 at 11:31







user10623131



















  • There were no books assigned for the class? Given the scope of this assignment, it's difficult to believe that there hasn't been a lead up to this assignment.
    – hrbrmstr
    Nov 8 at 11:33










  • This is a very usefull guide: cran.r-project.org/doc/contrib/Paradis-rdebuts_en.pdf
    – Santiago I. Hurtado
    Nov 8 at 11:37










  • @SantiagoHurtado I disagree. For one thing it’s severely outdated. For another, it starts off with lots of irrelevant low-level details. That’s a bad way of teaching. I recommend a modern approach, e.g.*R for Data Science* by Grolemund and Wickham instead.
    – Konrad Rudolph
    Nov 8 at 11:48


















  • There were no books assigned for the class? Given the scope of this assignment, it's difficult to believe that there hasn't been a lead up to this assignment.
    – hrbrmstr
    Nov 8 at 11:33










  • This is a very usefull guide: cran.r-project.org/doc/contrib/Paradis-rdebuts_en.pdf
    – Santiago I. Hurtado
    Nov 8 at 11:37










  • @SantiagoHurtado I disagree. For one thing it’s severely outdated. For another, it starts off with lots of irrelevant low-level details. That’s a bad way of teaching. I recommend a modern approach, e.g.*R for Data Science* by Grolemund and Wickham instead.
    – Konrad Rudolph
    Nov 8 at 11:48
















There were no books assigned for the class? Given the scope of this assignment, it's difficult to believe that there hasn't been a lead up to this assignment.
– hrbrmstr
Nov 8 at 11:33




There were no books assigned for the class? Given the scope of this assignment, it's difficult to believe that there hasn't been a lead up to this assignment.
– hrbrmstr
Nov 8 at 11:33












This is a very usefull guide: cran.r-project.org/doc/contrib/Paradis-rdebuts_en.pdf
– Santiago I. Hurtado
Nov 8 at 11:37




This is a very usefull guide: cran.r-project.org/doc/contrib/Paradis-rdebuts_en.pdf
– Santiago I. Hurtado
Nov 8 at 11:37












@SantiagoHurtado I disagree. For one thing it’s severely outdated. For another, it starts off with lots of irrelevant low-level details. That’s a bad way of teaching. I recommend a modern approach, e.g.*R for Data Science* by Grolemund and Wickham instead.
– Konrad Rudolph
Nov 8 at 11:48




@SantiagoHurtado I disagree. For one thing it’s severely outdated. For another, it starts off with lots of irrelevant low-level details. That’s a bad way of teaching. I recommend a modern approach, e.g.*R for Data Science* by Grolemund and Wickham instead.
– Konrad Rudolph
Nov 8 at 11:48












1 Answer
1






active

oldest

votes

















up vote
1
down vote













Which type of data?



You should use metric data. For example the height/age of pople.



For example let's assuhe you have a dataframe yourDataframe:



height
160
155
176
153
185


On the first screen, plot the data



You can use R's standard plot function there: lines(yourDataframe$height)



plot the average and plot the standart deviation



There are already function for those things (for example mean(yourDataframe$height)). Just ask Google.
You can add those values to your linechart using points(mean(yourDataframe$height)).



I think after you did this you will be able to solve the rest of your assignment by yourself. R has quite a big community and you will find everything you need by googling. I guess this is how most people learn R.






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',
    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%2f53206898%2fhow-to-plot-the-data-i-read-from-a-file-in-r%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








    up vote
    1
    down vote













    Which type of data?



    You should use metric data. For example the height/age of pople.



    For example let's assuhe you have a dataframe yourDataframe:



    height
    160
    155
    176
    153
    185


    On the first screen, plot the data



    You can use R's standard plot function there: lines(yourDataframe$height)



    plot the average and plot the standart deviation



    There are already function for those things (for example mean(yourDataframe$height)). Just ask Google.
    You can add those values to your linechart using points(mean(yourDataframe$height)).



    I think after you did this you will be able to solve the rest of your assignment by yourself. R has quite a big community and you will find everything you need by googling. I guess this is how most people learn R.






    share|improve this answer



























      up vote
      1
      down vote













      Which type of data?



      You should use metric data. For example the height/age of pople.



      For example let's assuhe you have a dataframe yourDataframe:



      height
      160
      155
      176
      153
      185


      On the first screen, plot the data



      You can use R's standard plot function there: lines(yourDataframe$height)



      plot the average and plot the standart deviation



      There are already function for those things (for example mean(yourDataframe$height)). Just ask Google.
      You can add those values to your linechart using points(mean(yourDataframe$height)).



      I think after you did this you will be able to solve the rest of your assignment by yourself. R has quite a big community and you will find everything you need by googling. I guess this is how most people learn R.






      share|improve this answer

























        up vote
        1
        down vote










        up vote
        1
        down vote









        Which type of data?



        You should use metric data. For example the height/age of pople.



        For example let's assuhe you have a dataframe yourDataframe:



        height
        160
        155
        176
        153
        185


        On the first screen, plot the data



        You can use R's standard plot function there: lines(yourDataframe$height)



        plot the average and plot the standart deviation



        There are already function for those things (for example mean(yourDataframe$height)). Just ask Google.
        You can add those values to your linechart using points(mean(yourDataframe$height)).



        I think after you did this you will be able to solve the rest of your assignment by yourself. R has quite a big community and you will find everything you need by googling. I guess this is how most people learn R.






        share|improve this answer














        Which type of data?



        You should use metric data. For example the height/age of pople.



        For example let's assuhe you have a dataframe yourDataframe:



        height
        160
        155
        176
        153
        185


        On the first screen, plot the data



        You can use R's standard plot function there: lines(yourDataframe$height)



        plot the average and plot the standart deviation



        There are already function for those things (for example mean(yourDataframe$height)). Just ask Google.
        You can add those values to your linechart using points(mean(yourDataframe$height)).



        I think after you did this you will be able to solve the rest of your assignment by yourself. R has quite a big community and you will find everything you need by googling. I guess this is how most people learn R.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 8 at 12:23

























        answered Nov 8 at 12:16









        Ramona

        689




        689






























            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.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • 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%2f53206898%2fhow-to-plot-the-data-i-read-from-a-file-in-r%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







            這個網誌中的熱門文章

            Academy of Television Arts & Sciences

            L'Équipe

            1995 France bombings