Column header in XTS and Data frame in R The 2019 Stack Overflow Developer Survey Results Are Insubsetting R data frameSort a data frame when column name is assigned in a variableData frame mutation in RK-means clustering on the data frame having only one columnBuilding a data frame and matrix for citation networkHow can I sort a data frame by groups?Feature Scaling both training and test dataPandas, R, and interoperable data frame formatsSparse matrix in R based on the data frameHow to split data frame into groups, combine rows

If I score a critical hit on an 18 or higher, what are my chances of getting a critical hit if I roll 3d20?

Why couldn't they take pictures of a closer black hole?

When should I buy a clipper card after flying to Oakland?

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

I am eight letters word. Find me who Am I?

Worn-tile Scrabble

Is it okay to consider publishing in my first year of PhD?

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

Did any laptop computers have a built-in 5 1/4 inch floppy drive?

What is the meaning of Triage in Cybersec world?

Command for nulifying spaces

Output the Arecibo Message

Why doesn't shell automatically fix "useless use of cat"?

Table Fragmentation

Can we generate random numbers using irrational numbers like π and e?

Pokemon Turn Based battle (Python)

How do I free up internal storage if I don't have any apps downloaded?

What is the most efficient way to store a numeric range?

Deal with toxic manager when you can't quit

What is the accessibility of a package's `Private` context variables?

Why isn't the circumferential light around the M87 black hole's event horizon symmetric?

Are spiders unable to hurt humans, especially very small spiders?

Merge two greps into single one

Using xargs with pdftk



Column header in XTS and Data frame in R



The 2019 Stack Overflow Developer Survey Results Are Insubsetting R data frameSort a data frame when column name is assigned in a variableData frame mutation in RK-means clustering on the data frame having only one columnBuilding a data frame and matrix for citation networkHow can I sort a data frame by groups?Feature Scaling both training and test dataPandas, R, and interoperable data frame formatsSparse matrix in R based on the data frameHow to split data frame into groups, combine rows










1












$begingroup$


I used quandl function extract stock data with object type as xts.



a <- Quandl("NSE/ICICIBANK", start_date = "2011-01-01", end_date = "2019-02-21", collapse = "daily", type = "xts",order = "asc") 


then I printed the output a with head(a),
the output is



 Open High Low Last Close Total Trade Quantity Turnover (Lacs)
2011-01-03 1154.00 1158.40 1138.95 1140.35 1144.85 1379646 15845.58
2011-01-04 1145.70 1149.20 1098.10 1107.25 1104.05 4175490 46519.73
2011-01-05 1097.20 1099.00 1065.00 1068.80 1069.35 5307600 57075.28
2011-01-06 1074.25 1078.45 1047.25 1050.00 1053.45 4769781 50447.94
2011-01-07 1045.00 1077.90 1041.00 1042.00 1049.20 6178882 65700.46
2011-01-10 1044.25 1058.85 1005.10 1012.05 1014.00 6510410 67029.00


then I did the same without the object type as xts,
the output of head(a):



 Date Open High Low Last Close Total Trade Quantity Turnover (Lacs)
1 2011-01-03 1154.00 1158.40 1138.95 1140.35 1144.85 1379646 15845.58
2 2011-01-04 1145.70 1149.20 1098.10 1107.25 1104.05 4175490 46519.73
3 2011-01-05 1097.20 1099.00 1065.00 1068.80 1069.35 5307600 57075.28
4 2011-01-06 1074.25 1078.45 1047.25 1050.00 1053.45 4769781 50447.94
5 2011-01-07 1045.00 1077.90 1041.00 1042.00 1049.20 6178882 65700.46
6 2011-01-10 1044.25 1058.85 1005.10 1012.05 1014.00 6510410 67029.00


Why the date column field heading is missed out in xts object type but in data frame date field column heading is appearing?
How to handle the same in xts object type?










share|improve this question











$endgroup$
















    1












    $begingroup$


    I used quandl function extract stock data with object type as xts.



    a <- Quandl("NSE/ICICIBANK", start_date = "2011-01-01", end_date = "2019-02-21", collapse = "daily", type = "xts",order = "asc") 


    then I printed the output a with head(a),
    the output is



     Open High Low Last Close Total Trade Quantity Turnover (Lacs)
    2011-01-03 1154.00 1158.40 1138.95 1140.35 1144.85 1379646 15845.58
    2011-01-04 1145.70 1149.20 1098.10 1107.25 1104.05 4175490 46519.73
    2011-01-05 1097.20 1099.00 1065.00 1068.80 1069.35 5307600 57075.28
    2011-01-06 1074.25 1078.45 1047.25 1050.00 1053.45 4769781 50447.94
    2011-01-07 1045.00 1077.90 1041.00 1042.00 1049.20 6178882 65700.46
    2011-01-10 1044.25 1058.85 1005.10 1012.05 1014.00 6510410 67029.00


    then I did the same without the object type as xts,
    the output of head(a):



     Date Open High Low Last Close Total Trade Quantity Turnover (Lacs)
    1 2011-01-03 1154.00 1158.40 1138.95 1140.35 1144.85 1379646 15845.58
    2 2011-01-04 1145.70 1149.20 1098.10 1107.25 1104.05 4175490 46519.73
    3 2011-01-05 1097.20 1099.00 1065.00 1068.80 1069.35 5307600 57075.28
    4 2011-01-06 1074.25 1078.45 1047.25 1050.00 1053.45 4769781 50447.94
    5 2011-01-07 1045.00 1077.90 1041.00 1042.00 1049.20 6178882 65700.46
    6 2011-01-10 1044.25 1058.85 1005.10 1012.05 1014.00 6510410 67029.00


    Why the date column field heading is missed out in xts object type but in data frame date field column heading is appearing?
    How to handle the same in xts object type?










    share|improve this question











    $endgroup$














      1












      1








      1





      $begingroup$


      I used quandl function extract stock data with object type as xts.



      a <- Quandl("NSE/ICICIBANK", start_date = "2011-01-01", end_date = "2019-02-21", collapse = "daily", type = "xts",order = "asc") 


      then I printed the output a with head(a),
      the output is



       Open High Low Last Close Total Trade Quantity Turnover (Lacs)
      2011-01-03 1154.00 1158.40 1138.95 1140.35 1144.85 1379646 15845.58
      2011-01-04 1145.70 1149.20 1098.10 1107.25 1104.05 4175490 46519.73
      2011-01-05 1097.20 1099.00 1065.00 1068.80 1069.35 5307600 57075.28
      2011-01-06 1074.25 1078.45 1047.25 1050.00 1053.45 4769781 50447.94
      2011-01-07 1045.00 1077.90 1041.00 1042.00 1049.20 6178882 65700.46
      2011-01-10 1044.25 1058.85 1005.10 1012.05 1014.00 6510410 67029.00


      then I did the same without the object type as xts,
      the output of head(a):



       Date Open High Low Last Close Total Trade Quantity Turnover (Lacs)
      1 2011-01-03 1154.00 1158.40 1138.95 1140.35 1144.85 1379646 15845.58
      2 2011-01-04 1145.70 1149.20 1098.10 1107.25 1104.05 4175490 46519.73
      3 2011-01-05 1097.20 1099.00 1065.00 1068.80 1069.35 5307600 57075.28
      4 2011-01-06 1074.25 1078.45 1047.25 1050.00 1053.45 4769781 50447.94
      5 2011-01-07 1045.00 1077.90 1041.00 1042.00 1049.20 6178882 65700.46
      6 2011-01-10 1044.25 1058.85 1005.10 1012.05 1014.00 6510410 67029.00


      Why the date column field heading is missed out in xts object type but in data frame date field column heading is appearing?
      How to handle the same in xts object type?










      share|improve this question











      $endgroup$




      I used quandl function extract stock data with object type as xts.



      a <- Quandl("NSE/ICICIBANK", start_date = "2011-01-01", end_date = "2019-02-21", collapse = "daily", type = "xts",order = "asc") 


      then I printed the output a with head(a),
      the output is



       Open High Low Last Close Total Trade Quantity Turnover (Lacs)
      2011-01-03 1154.00 1158.40 1138.95 1140.35 1144.85 1379646 15845.58
      2011-01-04 1145.70 1149.20 1098.10 1107.25 1104.05 4175490 46519.73
      2011-01-05 1097.20 1099.00 1065.00 1068.80 1069.35 5307600 57075.28
      2011-01-06 1074.25 1078.45 1047.25 1050.00 1053.45 4769781 50447.94
      2011-01-07 1045.00 1077.90 1041.00 1042.00 1049.20 6178882 65700.46
      2011-01-10 1044.25 1058.85 1005.10 1012.05 1014.00 6510410 67029.00


      then I did the same without the object type as xts,
      the output of head(a):



       Date Open High Low Last Close Total Trade Quantity Turnover (Lacs)
      1 2011-01-03 1154.00 1158.40 1138.95 1140.35 1144.85 1379646 15845.58
      2 2011-01-04 1145.70 1149.20 1098.10 1107.25 1104.05 4175490 46519.73
      3 2011-01-05 1097.20 1099.00 1065.00 1068.80 1069.35 5307600 57075.28
      4 2011-01-06 1074.25 1078.45 1047.25 1050.00 1053.45 4769781 50447.94
      5 2011-01-07 1045.00 1077.90 1041.00 1042.00 1049.20 6178882 65700.46
      6 2011-01-10 1044.25 1058.85 1005.10 1012.05 1014.00 6510410 67029.00


      Why the date column field heading is missed out in xts object type but in data frame date field column heading is appearing?
      How to handle the same in xts object type?







      machine-learning r data-science-model






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 22 at 16:18









      rcs

      6011614




      6011614










      asked Feb 22 at 8:12









      Balasubrahmanyam IraBalasubrahmanyam Ira

      162




      162




















          1 Answer
          1






          active

          oldest

          votes


















          0












          $begingroup$

          Because an R xts object stores the date-column in a special column called index, and the programmers who implemented the xts package have decided to not print a label such as "Date" in the table header of an xts output.



          When the print() method is called with an xts object as argument, the first column of the output is actually printed without any label, like a rowname "column" of a data frame.



          Why? I don't know. Perhaps "Date" is not always right. It could just be a different label that your time series needs (e.g. "Microseconds" for some timeseries object of Sensor measurements)



          # returned as data frame by Quandl
          R> str(a)

          'data.frame': 1985 obs. of 8 variables:
          $ Date : Date, format: "2011-01-03" "2011-01-04" "2011-01-05" "2011-01-06" ...
          $
          Open : num 1154 1146 1097 1074 1045 ...
          $ High : num 1158 1149 1099 1078 1078 ...
          $
          Low : num 1139 1098 1065 1047 1041 ...
          $ Last : num 1140 1107 1069 1050 1042 ...
          $
          Close : num 1145 1104 1069 1053 1049 ...
          $ Total Trade Quantity: num 1379646 4175490 5307600 4769781 6178882 ...
          $
          Turnover (Lacs) : num 15846 46520 57075 50448 65700 ...
          - attr(*, "freq")= chr "daily"

          # returned as xts timeseries object

          R> str(ax)
          An ‘xts’ object on 2011-01-03/2019-01-04 containing:
          Data: num [1:1985, 1:7] 1154 1146 1097 1074 1045 ...
          - attr(*, "dimnames")=List of 2
          ..$ : NULL
          ..$
          : chr [1:7] "Open" "High" "Low" "Last" ...
          Indexed by objects of class: [Date] TZ: UTC
          xts Attributes:
          NULL





          share|improve this answer









          $endgroup$













            Your Answer





            StackExchange.ifUsing("editor", function ()
            return StackExchange.using("mathjaxEditing", function ()
            StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
            StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
            );
            );
            , "mathjax-editing");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "557"
            ;
            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: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            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%2fdatascience.stackexchange.com%2fquestions%2f46003%2fcolumn-header-in-xts-and-data-frame-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









            0












            $begingroup$

            Because an R xts object stores the date-column in a special column called index, and the programmers who implemented the xts package have decided to not print a label such as "Date" in the table header of an xts output.



            When the print() method is called with an xts object as argument, the first column of the output is actually printed without any label, like a rowname "column" of a data frame.



            Why? I don't know. Perhaps "Date" is not always right. It could just be a different label that your time series needs (e.g. "Microseconds" for some timeseries object of Sensor measurements)



            # returned as data frame by Quandl
            R> str(a)

            'data.frame': 1985 obs. of 8 variables:
            $ Date : Date, format: "2011-01-03" "2011-01-04" "2011-01-05" "2011-01-06" ...
            $
            Open : num 1154 1146 1097 1074 1045 ...
            $ High : num 1158 1149 1099 1078 1078 ...
            $
            Low : num 1139 1098 1065 1047 1041 ...
            $ Last : num 1140 1107 1069 1050 1042 ...
            $
            Close : num 1145 1104 1069 1053 1049 ...
            $ Total Trade Quantity: num 1379646 4175490 5307600 4769781 6178882 ...
            $
            Turnover (Lacs) : num 15846 46520 57075 50448 65700 ...
            - attr(*, "freq")= chr "daily"

            # returned as xts timeseries object

            R> str(ax)
            An ‘xts’ object on 2011-01-03/2019-01-04 containing:
            Data: num [1:1985, 1:7] 1154 1146 1097 1074 1045 ...
            - attr(*, "dimnames")=List of 2
            ..$ : NULL
            ..$
            : chr [1:7] "Open" "High" "Low" "Last" ...
            Indexed by objects of class: [Date] TZ: UTC
            xts Attributes:
            NULL





            share|improve this answer









            $endgroup$

















              0












              $begingroup$

              Because an R xts object stores the date-column in a special column called index, and the programmers who implemented the xts package have decided to not print a label such as "Date" in the table header of an xts output.



              When the print() method is called with an xts object as argument, the first column of the output is actually printed without any label, like a rowname "column" of a data frame.



              Why? I don't know. Perhaps "Date" is not always right. It could just be a different label that your time series needs (e.g. "Microseconds" for some timeseries object of Sensor measurements)



              # returned as data frame by Quandl
              R> str(a)

              'data.frame': 1985 obs. of 8 variables:
              $ Date : Date, format: "2011-01-03" "2011-01-04" "2011-01-05" "2011-01-06" ...
              $
              Open : num 1154 1146 1097 1074 1045 ...
              $ High : num 1158 1149 1099 1078 1078 ...
              $
              Low : num 1139 1098 1065 1047 1041 ...
              $ Last : num 1140 1107 1069 1050 1042 ...
              $
              Close : num 1145 1104 1069 1053 1049 ...
              $ Total Trade Quantity: num 1379646 4175490 5307600 4769781 6178882 ...
              $
              Turnover (Lacs) : num 15846 46520 57075 50448 65700 ...
              - attr(*, "freq")= chr "daily"

              # returned as xts timeseries object

              R> str(ax)
              An ‘xts’ object on 2011-01-03/2019-01-04 containing:
              Data: num [1:1985, 1:7] 1154 1146 1097 1074 1045 ...
              - attr(*, "dimnames")=List of 2
              ..$ : NULL
              ..$
              : chr [1:7] "Open" "High" "Low" "Last" ...
              Indexed by objects of class: [Date] TZ: UTC
              xts Attributes:
              NULL





              share|improve this answer









              $endgroup$















                0












                0








                0





                $begingroup$

                Because an R xts object stores the date-column in a special column called index, and the programmers who implemented the xts package have decided to not print a label such as "Date" in the table header of an xts output.



                When the print() method is called with an xts object as argument, the first column of the output is actually printed without any label, like a rowname "column" of a data frame.



                Why? I don't know. Perhaps "Date" is not always right. It could just be a different label that your time series needs (e.g. "Microseconds" for some timeseries object of Sensor measurements)



                # returned as data frame by Quandl
                R> str(a)

                'data.frame': 1985 obs. of 8 variables:
                $ Date : Date, format: "2011-01-03" "2011-01-04" "2011-01-05" "2011-01-06" ...
                $
                Open : num 1154 1146 1097 1074 1045 ...
                $ High : num 1158 1149 1099 1078 1078 ...
                $
                Low : num 1139 1098 1065 1047 1041 ...
                $ Last : num 1140 1107 1069 1050 1042 ...
                $
                Close : num 1145 1104 1069 1053 1049 ...
                $ Total Trade Quantity: num 1379646 4175490 5307600 4769781 6178882 ...
                $
                Turnover (Lacs) : num 15846 46520 57075 50448 65700 ...
                - attr(*, "freq")= chr "daily"

                # returned as xts timeseries object

                R> str(ax)
                An ‘xts’ object on 2011-01-03/2019-01-04 containing:
                Data: num [1:1985, 1:7] 1154 1146 1097 1074 1045 ...
                - attr(*, "dimnames")=List of 2
                ..$ : NULL
                ..$
                : chr [1:7] "Open" "High" "Low" "Last" ...
                Indexed by objects of class: [Date] TZ: UTC
                xts Attributes:
                NULL





                share|improve this answer









                $endgroup$



                Because an R xts object stores the date-column in a special column called index, and the programmers who implemented the xts package have decided to not print a label such as "Date" in the table header of an xts output.



                When the print() method is called with an xts object as argument, the first column of the output is actually printed without any label, like a rowname "column" of a data frame.



                Why? I don't know. Perhaps "Date" is not always right. It could just be a different label that your time series needs (e.g. "Microseconds" for some timeseries object of Sensor measurements)



                # returned as data frame by Quandl
                R> str(a)

                'data.frame': 1985 obs. of 8 variables:
                $ Date : Date, format: "2011-01-03" "2011-01-04" "2011-01-05" "2011-01-06" ...
                $
                Open : num 1154 1146 1097 1074 1045 ...
                $ High : num 1158 1149 1099 1078 1078 ...
                $
                Low : num 1139 1098 1065 1047 1041 ...
                $ Last : num 1140 1107 1069 1050 1042 ...
                $
                Close : num 1145 1104 1069 1053 1049 ...
                $ Total Trade Quantity: num 1379646 4175490 5307600 4769781 6178882 ...
                $
                Turnover (Lacs) : num 15846 46520 57075 50448 65700 ...
                - attr(*, "freq")= chr "daily"

                # returned as xts timeseries object

                R> str(ax)
                An ‘xts’ object on 2011-01-03/2019-01-04 containing:
                Data: num [1:1985, 1:7] 1154 1146 1097 1074 1045 ...
                - attr(*, "dimnames")=List of 2
                ..$ : NULL
                ..$
                : chr [1:7] "Open" "High" "Low" "Last" ...
                Indexed by objects of class: [Date] TZ: UTC
                xts Attributes:
                NULL






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 28 at 9:41









                knbknb

                430413




                430413



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Data Science Stack Exchange!


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

                    Use MathJax to format equations. MathJax reference.


                    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%2fdatascience.stackexchange.com%2fquestions%2f46003%2fcolumn-header-in-xts-and-data-frame-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







                    Popular posts from this blog

                    Adding axes to figuresAdding axes labels to LaTeX figuresLaTeX equivalent of ConTeXt buffersRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?TikZ scaling graphic and adjust node position and keep font sizeNumerical conditional within tikz keys?adding axes to shapesAlign axes across subfiguresAdding figures with a certain orderLine up nested tikz enviroments or how to get rid of themAdding axes labels to LaTeX figures

                    Tähtien Talli Jäsenet | Lähteet | NavigointivalikkoSuomen Hippos – Tähtien Talli

                    Do these cracks on my tires look bad? The Next CEO of Stack OverflowDry rot tire should I replace?Having to replace tiresFishtailed so easily? Bad tires? ABS?Filling the tires with something other than air, to avoid puncture hassles?Used Michelin tires safe to install?Do these tyre cracks necessitate replacement?Rumbling noise: tires or mechanicalIs it possible to fix noisy feathered tires?Are bad winter tires still better than summer tires in winter?Torque converter failure - Related to replacing only 2 tires?Why use snow tires on all 4 wheels on 2-wheel-drive cars?