no side by side bars are shown using ggplot











up vote
1
down vote

favorite












My question is related with this one:
Side-by-side bars in bar plot
I am trying to do the same kind of thing, but I just don't get any data, the axis are filled in. But no visualised graph. I tried to remoddel the data in small steps, but it still did not worked out. I have no clue, why the data is not shown.



n<-15
data <- data.frame("number" = c(1:n),
"Nasal" = c(15.4, 13.5, 13.3, 12.4, 12.8,
13.5, 14.5, 13.9, 11.0, 15.0,
17.0, 13.8, 17.4, 16.5, 14.4),
"Endob" = c(16.5, 13.2, 13.6, 13.6, 14.0,
14.0, 16.0, 14.1, 11.5, 14.4,
16.0, 13.2, 16.6, 18.5, 14.5))

library(ggplot2)

method<-rep(c("Nasal","Endob"),each=n)
values<-c(data$Nasal, data$Endob)
patient<-factor(c(1:15))
data2<- data.frame(patient,method,values)
data2

ggplot(data2, aes(x=factor(patient), fill=method, y=values))
geom_bar(position ="dodge",stat="identity")









share|improve this question






















  • You are mising a plus sign at the end of the ggplot instruction. You need to add the geom_bar to the plot.
    – Rui Barradas
    Nov 11 at 19:56















up vote
1
down vote

favorite












My question is related with this one:
Side-by-side bars in bar plot
I am trying to do the same kind of thing, but I just don't get any data, the axis are filled in. But no visualised graph. I tried to remoddel the data in small steps, but it still did not worked out. I have no clue, why the data is not shown.



n<-15
data <- data.frame("number" = c(1:n),
"Nasal" = c(15.4, 13.5, 13.3, 12.4, 12.8,
13.5, 14.5, 13.9, 11.0, 15.0,
17.0, 13.8, 17.4, 16.5, 14.4),
"Endob" = c(16.5, 13.2, 13.6, 13.6, 14.0,
14.0, 16.0, 14.1, 11.5, 14.4,
16.0, 13.2, 16.6, 18.5, 14.5))

library(ggplot2)

method<-rep(c("Nasal","Endob"),each=n)
values<-c(data$Nasal, data$Endob)
patient<-factor(c(1:15))
data2<- data.frame(patient,method,values)
data2

ggplot(data2, aes(x=factor(patient), fill=method, y=values))
geom_bar(position ="dodge",stat="identity")









share|improve this question






















  • You are mising a plus sign at the end of the ggplot instruction. You need to add the geom_bar to the plot.
    – Rui Barradas
    Nov 11 at 19:56













up vote
1
down vote

favorite









up vote
1
down vote

favorite











My question is related with this one:
Side-by-side bars in bar plot
I am trying to do the same kind of thing, but I just don't get any data, the axis are filled in. But no visualised graph. I tried to remoddel the data in small steps, but it still did not worked out. I have no clue, why the data is not shown.



n<-15
data <- data.frame("number" = c(1:n),
"Nasal" = c(15.4, 13.5, 13.3, 12.4, 12.8,
13.5, 14.5, 13.9, 11.0, 15.0,
17.0, 13.8, 17.4, 16.5, 14.4),
"Endob" = c(16.5, 13.2, 13.6, 13.6, 14.0,
14.0, 16.0, 14.1, 11.5, 14.4,
16.0, 13.2, 16.6, 18.5, 14.5))

library(ggplot2)

method<-rep(c("Nasal","Endob"),each=n)
values<-c(data$Nasal, data$Endob)
patient<-factor(c(1:15))
data2<- data.frame(patient,method,values)
data2

ggplot(data2, aes(x=factor(patient), fill=method, y=values))
geom_bar(position ="dodge",stat="identity")









share|improve this question













My question is related with this one:
Side-by-side bars in bar plot
I am trying to do the same kind of thing, but I just don't get any data, the axis are filled in. But no visualised graph. I tried to remoddel the data in small steps, but it still did not worked out. I have no clue, why the data is not shown.



n<-15
data <- data.frame("number" = c(1:n),
"Nasal" = c(15.4, 13.5, 13.3, 12.4, 12.8,
13.5, 14.5, 13.9, 11.0, 15.0,
17.0, 13.8, 17.4, 16.5, 14.4),
"Endob" = c(16.5, 13.2, 13.6, 13.6, 14.0,
14.0, 16.0, 14.1, 11.5, 14.4,
16.0, 13.2, 16.6, 18.5, 14.5))

library(ggplot2)

method<-rep(c("Nasal","Endob"),each=n)
values<-c(data$Nasal, data$Endob)
patient<-factor(c(1:15))
data2<- data.frame(patient,method,values)
data2

ggplot(data2, aes(x=factor(patient), fill=method, y=values))
geom_bar(position ="dodge",stat="identity")






r ggplot2 geom-bar






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 10 at 23:03









Hautekiet

83




83












  • You are mising a plus sign at the end of the ggplot instruction. You need to add the geom_bar to the plot.
    – Rui Barradas
    Nov 11 at 19:56


















  • You are mising a plus sign at the end of the ggplot instruction. You need to add the geom_bar to the plot.
    – Rui Barradas
    Nov 11 at 19:56
















You are mising a plus sign at the end of the ggplot instruction. You need to add the geom_bar to the plot.
– Rui Barradas
Nov 11 at 19:56




You are mising a plus sign at the end of the ggplot instruction. You need to add the geom_bar to the plot.
– Rui Barradas
Nov 11 at 19:56












1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










I think it runs fine, you just forgot the + between ggplot and geom_bar.





ggplot(data2, aes(x=factor(patient), fill=method, y=values)) +
geom_bar(position ="dodge",stat="identity")







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%2f53244279%2fno-side-by-side-bars-are-shown-using-ggplot%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
    0
    down vote



    accepted










    I think it runs fine, you just forgot the + between ggplot and geom_bar.





    ggplot(data2, aes(x=factor(patient), fill=method, y=values)) +
    geom_bar(position ="dodge",stat="identity")







    share|improve this answer

























      up vote
      0
      down vote



      accepted










      I think it runs fine, you just forgot the + between ggplot and geom_bar.





      ggplot(data2, aes(x=factor(patient), fill=method, y=values)) +
      geom_bar(position ="dodge",stat="identity")







      share|improve this answer























        up vote
        0
        down vote



        accepted







        up vote
        0
        down vote



        accepted






        I think it runs fine, you just forgot the + between ggplot and geom_bar.





        ggplot(data2, aes(x=factor(patient), fill=method, y=values)) +
        geom_bar(position ="dodge",stat="identity")







        share|improve this answer












        I think it runs fine, you just forgot the + between ggplot and geom_bar.





        ggplot(data2, aes(x=factor(patient), fill=method, y=values)) +
        geom_bar(position ="dodge",stat="identity")








        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 10 at 23:09









        seisdrum

        1765




        1765






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53244279%2fno-side-by-side-bars-are-shown-using-ggplot%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

            Bressuire

            Vorschmack

            Quarantine