Different results for same dataset in Cluster Analyses with R Studio?












-1














I just start using R and I have a question regarding cluster analysis in R.
I apply agnes function to apply cluster analysis for my dataset. But I realized that cluster results and the pltrees are different when I used the .txt file and .csv file.



Maybe it would be better to explain my problem with the images:



My dataset in .txt format;
enter image description here



I used the following code to see the data in R;



data01 <- read.table("D:/CLUSTER_ANALYSIS/NumericData3_IN.txt", header = T)


and everything is fine, it seems like;
enter image description here



I apply the cluster anaylsis,



complete1 <- agnes(data01, stand = FALSE, method = 'complete')
plot(complete1, which.plots=2, main='Complete-Linkage')


And here is the pltree:
enter image description here



I made the same steps with .csv file, which includes exactly the same dataset. Here is the dataset in .csv format:
enter image description here



Again the cluster analysis for .csv file:



data02 <- read.csv("D:/CLUSTER_ANALYSIS/NumericData3.csv", header = T)

complete2 <- agnes(data02, stand = FALSE, method = 'complete')

plot(complete2, which.plots=2, main='Complete-Linkage')


And the pltree is completely different,
enter image description here



So, DECIMAL SEPARATOR for the txt is COMMA and for csv file it is DOT. Which of these results are correct? Is the decimal separator for numeric dataset comma or dot in R?










share|improve this question





























    -1














    I just start using R and I have a question regarding cluster analysis in R.
    I apply agnes function to apply cluster analysis for my dataset. But I realized that cluster results and the pltrees are different when I used the .txt file and .csv file.



    Maybe it would be better to explain my problem with the images:



    My dataset in .txt format;
    enter image description here



    I used the following code to see the data in R;



    data01 <- read.table("D:/CLUSTER_ANALYSIS/NumericData3_IN.txt", header = T)


    and everything is fine, it seems like;
    enter image description here



    I apply the cluster anaylsis,



    complete1 <- agnes(data01, stand = FALSE, method = 'complete')
    plot(complete1, which.plots=2, main='Complete-Linkage')


    And here is the pltree:
    enter image description here



    I made the same steps with .csv file, which includes exactly the same dataset. Here is the dataset in .csv format:
    enter image description here



    Again the cluster analysis for .csv file:



    data02 <- read.csv("D:/CLUSTER_ANALYSIS/NumericData3.csv", header = T)

    complete2 <- agnes(data02, stand = FALSE, method = 'complete')

    plot(complete2, which.plots=2, main='Complete-Linkage')


    And the pltree is completely different,
    enter image description here



    So, DECIMAL SEPARATOR for the txt is COMMA and for csv file it is DOT. Which of these results are correct? Is the decimal separator for numeric dataset comma or dot in R?










    share|improve this question



























      -1












      -1








      -1







      I just start using R and I have a question regarding cluster analysis in R.
      I apply agnes function to apply cluster analysis for my dataset. But I realized that cluster results and the pltrees are different when I used the .txt file and .csv file.



      Maybe it would be better to explain my problem with the images:



      My dataset in .txt format;
      enter image description here



      I used the following code to see the data in R;



      data01 <- read.table("D:/CLUSTER_ANALYSIS/NumericData3_IN.txt", header = T)


      and everything is fine, it seems like;
      enter image description here



      I apply the cluster anaylsis,



      complete1 <- agnes(data01, stand = FALSE, method = 'complete')
      plot(complete1, which.plots=2, main='Complete-Linkage')


      And here is the pltree:
      enter image description here



      I made the same steps with .csv file, which includes exactly the same dataset. Here is the dataset in .csv format:
      enter image description here



      Again the cluster analysis for .csv file:



      data02 <- read.csv("D:/CLUSTER_ANALYSIS/NumericData3.csv", header = T)

      complete2 <- agnes(data02, stand = FALSE, method = 'complete')

      plot(complete2, which.plots=2, main='Complete-Linkage')


      And the pltree is completely different,
      enter image description here



      So, DECIMAL SEPARATOR for the txt is COMMA and for csv file it is DOT. Which of these results are correct? Is the decimal separator for numeric dataset comma or dot in R?










      share|improve this question















      I just start using R and I have a question regarding cluster analysis in R.
      I apply agnes function to apply cluster analysis for my dataset. But I realized that cluster results and the pltrees are different when I used the .txt file and .csv file.



      Maybe it would be better to explain my problem with the images:



      My dataset in .txt format;
      enter image description here



      I used the following code to see the data in R;



      data01 <- read.table("D:/CLUSTER_ANALYSIS/NumericData3_IN.txt", header = T)


      and everything is fine, it seems like;
      enter image description here



      I apply the cluster anaylsis,



      complete1 <- agnes(data01, stand = FALSE, method = 'complete')
      plot(complete1, which.plots=2, main='Complete-Linkage')


      And here is the pltree:
      enter image description here



      I made the same steps with .csv file, which includes exactly the same dataset. Here is the dataset in .csv format:
      enter image description here



      Again the cluster analysis for .csv file:



      data02 <- read.csv("D:/CLUSTER_ANALYSIS/NumericData3.csv", header = T)

      complete2 <- agnes(data02, stand = FALSE, method = 'complete')

      plot(complete2, which.plots=2, main='Complete-Linkage')


      And the pltree is completely different,
      enter image description here



      So, DECIMAL SEPARATOR for the txt is COMMA and for csv file it is DOT. Which of these results are correct? Is the decimal separator for numeric dataset comma or dot in R?







      r csv decimal rstudio cluster-analysis






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 '18 at 22:00









      Anony-Mousse

      57.3k796159




      57.3k796159










      asked Nov 23 '18 at 14:35









      Gamze Koç

      31




      31
























          1 Answer
          1






          active

          oldest

          votes


















          1














          From the R manual on read.table (and read.csv) you can see the default separators. They are dot for each of your used functions. You can also set them to whatever you like with the "dec" parameter. Eg:



          data01 <- read.table("D:/CLUSTER_ANALYSIS/NumericData3_IN.txt", header = T, dec=",")





          share|improve this answer





















          • Thank you very much for your help :)
            – Gamze Koç
            Nov 23 '18 at 14:55






          • 1




            Please mark the answer as accepted if your problem is solved.
            – Aaro Viertiö
            Nov 23 '18 at 15:10











          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%2f53448622%2fdifferent-results-for-same-dataset-in-cluster-analyses-with-r-studio%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














          From the R manual on read.table (and read.csv) you can see the default separators. They are dot for each of your used functions. You can also set them to whatever you like with the "dec" parameter. Eg:



          data01 <- read.table("D:/CLUSTER_ANALYSIS/NumericData3_IN.txt", header = T, dec=",")





          share|improve this answer





















          • Thank you very much for your help :)
            – Gamze Koç
            Nov 23 '18 at 14:55






          • 1




            Please mark the answer as accepted if your problem is solved.
            – Aaro Viertiö
            Nov 23 '18 at 15:10
















          1














          From the R manual on read.table (and read.csv) you can see the default separators. They are dot for each of your used functions. You can also set them to whatever you like with the "dec" parameter. Eg:



          data01 <- read.table("D:/CLUSTER_ANALYSIS/NumericData3_IN.txt", header = T, dec=",")





          share|improve this answer





















          • Thank you very much for your help :)
            – Gamze Koç
            Nov 23 '18 at 14:55






          • 1




            Please mark the answer as accepted if your problem is solved.
            – Aaro Viertiö
            Nov 23 '18 at 15:10














          1












          1








          1






          From the R manual on read.table (and read.csv) you can see the default separators. They are dot for each of your used functions. You can also set them to whatever you like with the "dec" parameter. Eg:



          data01 <- read.table("D:/CLUSTER_ANALYSIS/NumericData3_IN.txt", header = T, dec=",")





          share|improve this answer












          From the R manual on read.table (and read.csv) you can see the default separators. They are dot for each of your used functions. You can also set them to whatever you like with the "dec" parameter. Eg:



          data01 <- read.table("D:/CLUSTER_ANALYSIS/NumericData3_IN.txt", header = T, dec=",")






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 23 '18 at 14:53









          Aaro Viertiö

          1295




          1295












          • Thank you very much for your help :)
            – Gamze Koç
            Nov 23 '18 at 14:55






          • 1




            Please mark the answer as accepted if your problem is solved.
            – Aaro Viertiö
            Nov 23 '18 at 15:10


















          • Thank you very much for your help :)
            – Gamze Koç
            Nov 23 '18 at 14:55






          • 1




            Please mark the answer as accepted if your problem is solved.
            – Aaro Viertiö
            Nov 23 '18 at 15:10
















          Thank you very much for your help :)
          – Gamze Koç
          Nov 23 '18 at 14:55




          Thank you very much for your help :)
          – Gamze Koç
          Nov 23 '18 at 14:55




          1




          1




          Please mark the answer as accepted if your problem is solved.
          – Aaro Viertiö
          Nov 23 '18 at 15:10




          Please mark the answer as accepted if your problem is solved.
          – Aaro Viertiö
          Nov 23 '18 at 15:10


















          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%2f53448622%2fdifferent-results-for-same-dataset-in-cluster-analyses-with-r-studio%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

          Lallio

          Futebolista

          Jornalista