2 series barplot ggplot2 or Openair











up vote
0
down vote

favorite












I am trying to create a bar plot of air quality data. I want Monitoring Site on the X-axis, and the concentration of 2 pollutants measured at each site against the y-axis, e.g. at the London site I measured 5 ng/m3 of antimony (series 1) and 10 ng/m3 barium (series 2). So the y-axis will just be Concentration (ng/m3).



I have searched already and the only examples of getting a 2nd series seem to work if the second series is a qualitative property that can be defined by colour, so you still only have one bar not two.



Also the examples seem to involve entering the data frame in the code manually, but I have a lot of data and want to import the file. I have successfully imported from a csv, but can't see how to refer to it in the code.



Openair only seems to plot stacked bar charts that have to relate to dates on the X-axis with timeProp.



Sorry I am very inexperienced with programming like this, I hope my question makes sense. Any help appreciated!










share|improve this question







New contributor




Sg1 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Welcome to SO! Can you please provide some sample data or your data using dput() and get more specific about how your desired plot looks like?
    – alex_555
    Nov 8 at 10:20










  • u r asking to plot time series data?
    – sai saran
    Nov 8 at 10:21










  • Thank you for responding!
    – Sg1
    Nov 8 at 10:23










  • I am not trying to plot time series data. Sorry, can I attach files to show you data and the plot in Excel?
    – Sg1
    Nov 8 at 10:23










  • > glimpse(Sb_Ba) Observations: 24 Variables: 4 $ Site <chr> "London Marylebone Road ", "Swansea Morriston", "Belfast Centre",... $ Designation <chr> "Urban Traffic", "Urban Traffic ", "Urban Background", "Urban Bac... $ Sb <dbl> 5.250, 2.990, 1.060, 2.400, 0.999, 1.650, 1.700, 0.947, 0.955, 1.... $ Ba <dbl> 35.700, 13.000, 3.630, 6.530, 4.500, 7.700, 9.390, 1.580, 3.030, ...
    – Sg1
    Nov 8 at 10:26















up vote
0
down vote

favorite












I am trying to create a bar plot of air quality data. I want Monitoring Site on the X-axis, and the concentration of 2 pollutants measured at each site against the y-axis, e.g. at the London site I measured 5 ng/m3 of antimony (series 1) and 10 ng/m3 barium (series 2). So the y-axis will just be Concentration (ng/m3).



I have searched already and the only examples of getting a 2nd series seem to work if the second series is a qualitative property that can be defined by colour, so you still only have one bar not two.



Also the examples seem to involve entering the data frame in the code manually, but I have a lot of data and want to import the file. I have successfully imported from a csv, but can't see how to refer to it in the code.



Openair only seems to plot stacked bar charts that have to relate to dates on the X-axis with timeProp.



Sorry I am very inexperienced with programming like this, I hope my question makes sense. Any help appreciated!










share|improve this question







New contributor




Sg1 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Welcome to SO! Can you please provide some sample data or your data using dput() and get more specific about how your desired plot looks like?
    – alex_555
    Nov 8 at 10:20










  • u r asking to plot time series data?
    – sai saran
    Nov 8 at 10:21










  • Thank you for responding!
    – Sg1
    Nov 8 at 10:23










  • I am not trying to plot time series data. Sorry, can I attach files to show you data and the plot in Excel?
    – Sg1
    Nov 8 at 10:23










  • > glimpse(Sb_Ba) Observations: 24 Variables: 4 $ Site <chr> "London Marylebone Road ", "Swansea Morriston", "Belfast Centre",... $ Designation <chr> "Urban Traffic", "Urban Traffic ", "Urban Background", "Urban Bac... $ Sb <dbl> 5.250, 2.990, 1.060, 2.400, 0.999, 1.650, 1.700, 0.947, 0.955, 1.... $ Ba <dbl> 35.700, 13.000, 3.630, 6.530, 4.500, 7.700, 9.390, 1.580, 3.030, ...
    – Sg1
    Nov 8 at 10:26













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am trying to create a bar plot of air quality data. I want Monitoring Site on the X-axis, and the concentration of 2 pollutants measured at each site against the y-axis, e.g. at the London site I measured 5 ng/m3 of antimony (series 1) and 10 ng/m3 barium (series 2). So the y-axis will just be Concentration (ng/m3).



I have searched already and the only examples of getting a 2nd series seem to work if the second series is a qualitative property that can be defined by colour, so you still only have one bar not two.



Also the examples seem to involve entering the data frame in the code manually, but I have a lot of data and want to import the file. I have successfully imported from a csv, but can't see how to refer to it in the code.



Openair only seems to plot stacked bar charts that have to relate to dates on the X-axis with timeProp.



Sorry I am very inexperienced with programming like this, I hope my question makes sense. Any help appreciated!










share|improve this question







New contributor




Sg1 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I am trying to create a bar plot of air quality data. I want Monitoring Site on the X-axis, and the concentration of 2 pollutants measured at each site against the y-axis, e.g. at the London site I measured 5 ng/m3 of antimony (series 1) and 10 ng/m3 barium (series 2). So the y-axis will just be Concentration (ng/m3).



I have searched already and the only examples of getting a 2nd series seem to work if the second series is a qualitative property that can be defined by colour, so you still only have one bar not two.



Also the examples seem to involve entering the data frame in the code manually, but I have a lot of data and want to import the file. I have successfully imported from a csv, but can't see how to refer to it in the code.



Openair only seems to plot stacked bar charts that have to relate to dates on the X-axis with timeProp.



Sorry I am very inexperienced with programming like this, I hope my question makes sense. Any help appreciated!







r ggplot2 openair






share|improve this question







New contributor




Sg1 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Sg1 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Sg1 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 8 at 10:03









Sg1

12




12




New contributor




Sg1 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Sg1 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Sg1 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Welcome to SO! Can you please provide some sample data or your data using dput() and get more specific about how your desired plot looks like?
    – alex_555
    Nov 8 at 10:20










  • u r asking to plot time series data?
    – sai saran
    Nov 8 at 10:21










  • Thank you for responding!
    – Sg1
    Nov 8 at 10:23










  • I am not trying to plot time series data. Sorry, can I attach files to show you data and the plot in Excel?
    – Sg1
    Nov 8 at 10:23










  • > glimpse(Sb_Ba) Observations: 24 Variables: 4 $ Site <chr> "London Marylebone Road ", "Swansea Morriston", "Belfast Centre",... $ Designation <chr> "Urban Traffic", "Urban Traffic ", "Urban Background", "Urban Bac... $ Sb <dbl> 5.250, 2.990, 1.060, 2.400, 0.999, 1.650, 1.700, 0.947, 0.955, 1.... $ Ba <dbl> 35.700, 13.000, 3.630, 6.530, 4.500, 7.700, 9.390, 1.580, 3.030, ...
    – Sg1
    Nov 8 at 10:26


















  • Welcome to SO! Can you please provide some sample data or your data using dput() and get more specific about how your desired plot looks like?
    – alex_555
    Nov 8 at 10:20










  • u r asking to plot time series data?
    – sai saran
    Nov 8 at 10:21










  • Thank you for responding!
    – Sg1
    Nov 8 at 10:23










  • I am not trying to plot time series data. Sorry, can I attach files to show you data and the plot in Excel?
    – Sg1
    Nov 8 at 10:23










  • > glimpse(Sb_Ba) Observations: 24 Variables: 4 $ Site <chr> "London Marylebone Road ", "Swansea Morriston", "Belfast Centre",... $ Designation <chr> "Urban Traffic", "Urban Traffic ", "Urban Background", "Urban Bac... $ Sb <dbl> 5.250, 2.990, 1.060, 2.400, 0.999, 1.650, 1.700, 0.947, 0.955, 1.... $ Ba <dbl> 35.700, 13.000, 3.630, 6.530, 4.500, 7.700, 9.390, 1.580, 3.030, ...
    – Sg1
    Nov 8 at 10:26
















Welcome to SO! Can you please provide some sample data or your data using dput() and get more specific about how your desired plot looks like?
– alex_555
Nov 8 at 10:20




Welcome to SO! Can you please provide some sample data or your data using dput() and get more specific about how your desired plot looks like?
– alex_555
Nov 8 at 10:20












u r asking to plot time series data?
– sai saran
Nov 8 at 10:21




u r asking to plot time series data?
– sai saran
Nov 8 at 10:21












Thank you for responding!
– Sg1
Nov 8 at 10:23




Thank you for responding!
– Sg1
Nov 8 at 10:23












I am not trying to plot time series data. Sorry, can I attach files to show you data and the plot in Excel?
– Sg1
Nov 8 at 10:23




I am not trying to plot time series data. Sorry, can I attach files to show you data and the plot in Excel?
– Sg1
Nov 8 at 10:23












> glimpse(Sb_Ba) Observations: 24 Variables: 4 $ Site <chr> "London Marylebone Road ", "Swansea Morriston", "Belfast Centre",... $ Designation <chr> "Urban Traffic", "Urban Traffic ", "Urban Background", "Urban Bac... $ Sb <dbl> 5.250, 2.990, 1.060, 2.400, 0.999, 1.650, 1.700, 0.947, 0.955, 1.... $ Ba <dbl> 35.700, 13.000, 3.630, 6.530, 4.500, 7.700, 9.390, 1.580, 3.030, ...
– Sg1
Nov 8 at 10:26




> glimpse(Sb_Ba) Observations: 24 Variables: 4 $ Site <chr> "London Marylebone Road ", "Swansea Morriston", "Belfast Centre",... $ Designation <chr> "Urban Traffic", "Urban Traffic ", "Urban Background", "Urban Bac... $ Sb <dbl> 5.250, 2.990, 1.060, 2.400, 0.999, 1.650, 1.700, 0.947, 0.955, 1.... $ Ba <dbl> 35.700, 13.000, 3.630, 6.530, 4.500, 7.700, 9.390, 1.580, 3.030, ...
– Sg1
Nov 8 at 10:26












1 Answer
1






active

oldest

votes

















up vote
0
down vote













I think you need something like this:



library(ggplot2)

data <- data.frame(cite= c('london','madrid','barcelona','london','madrid','barcelona'),
contaminent = c('Argon','Argon','Argon','Barium','Barium','Barium'),
Concentration= runif(6)*5)

ggplot() + geom_col(data = data,aes(x = cite,y=Concentration,fill=contaminent))


Edit:



Now suppose your data is name my_data and organize as follows: first column name cites with the cites names, then each column's name is a pollution with the values of the pollution concentration for each cite. Then your code for manage your data and used in ggplot could be:



library(ggplot2)
new_data <- data.frame(cites = rep(my_data$cites,ncol(my_data)-1),
contaminent_type= rep(colnames(my_data)[2:ncol(my_data)],each=nrow(my_data)),
Concentration= as.vector(my_data[,2:ncol(my_data)]))

ggplot() + geom_col(data = new_data,aes(x = cites,y=Concentration,fill=contaminent_type))





share|improve this answer























  • Thanks Santiago. So I have to list each site twice, once for each pollutant? I have 25 sites! This really illustrates my point: I've imported my data as a csv, but it still seems to take a lot of code to use it for a simple bar plot.
    – Sg1
    Nov 8 at 12:13










  • GGPLOT does make really enhance plots but in my experience required more code and lot of experience to do it fast and easy. I will edit the post to make and easier way to reorganize your data.
    – Santiago Hurtado
    Nov 8 at 14:51










  • Hi Santiago, I have tried your updated code and it has returned this error: "Error in as.vector(as.numeric(Sb_Ba[, 2:ncol(Sb_Ba)])) : (list) object cannot be coerced to type 'double' " (Sb_Ba is my data frame). I have tried googling this error - is it because my site names are not numeric?
    – Sg1
    Nov 9 at 9:42










  • Just to clarify, my data frame is 3 columns, 'Site' (a list of names), 'Sb' and 'Ba' (both are lists of measured concentrations - numeric values)
    – Sg1
    Nov 9 at 9:45










  • data.frame( c("c("London Marylebone Road ", "Swansea Morriston", "Belfast Centre")", "c(5.25, 2.99, 1.06)", "c(35.7, 13, 3.63)")
    – Sg1
    Nov 9 at 10:23











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
});


}
});






Sg1 is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53205409%2f2-series-barplot-ggplot2-or-openair%23new-answer', 'question_page');
}
);

Post as a guest
































1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













I think you need something like this:



library(ggplot2)

data <- data.frame(cite= c('london','madrid','barcelona','london','madrid','barcelona'),
contaminent = c('Argon','Argon','Argon','Barium','Barium','Barium'),
Concentration= runif(6)*5)

ggplot() + geom_col(data = data,aes(x = cite,y=Concentration,fill=contaminent))


Edit:



Now suppose your data is name my_data and organize as follows: first column name cites with the cites names, then each column's name is a pollution with the values of the pollution concentration for each cite. Then your code for manage your data and used in ggplot could be:



library(ggplot2)
new_data <- data.frame(cites = rep(my_data$cites,ncol(my_data)-1),
contaminent_type= rep(colnames(my_data)[2:ncol(my_data)],each=nrow(my_data)),
Concentration= as.vector(my_data[,2:ncol(my_data)]))

ggplot() + geom_col(data = new_data,aes(x = cites,y=Concentration,fill=contaminent_type))





share|improve this answer























  • Thanks Santiago. So I have to list each site twice, once for each pollutant? I have 25 sites! This really illustrates my point: I've imported my data as a csv, but it still seems to take a lot of code to use it for a simple bar plot.
    – Sg1
    Nov 8 at 12:13










  • GGPLOT does make really enhance plots but in my experience required more code and lot of experience to do it fast and easy. I will edit the post to make and easier way to reorganize your data.
    – Santiago Hurtado
    Nov 8 at 14:51










  • Hi Santiago, I have tried your updated code and it has returned this error: "Error in as.vector(as.numeric(Sb_Ba[, 2:ncol(Sb_Ba)])) : (list) object cannot be coerced to type 'double' " (Sb_Ba is my data frame). I have tried googling this error - is it because my site names are not numeric?
    – Sg1
    Nov 9 at 9:42










  • Just to clarify, my data frame is 3 columns, 'Site' (a list of names), 'Sb' and 'Ba' (both are lists of measured concentrations - numeric values)
    – Sg1
    Nov 9 at 9:45










  • data.frame( c("c("London Marylebone Road ", "Swansea Morriston", "Belfast Centre")", "c(5.25, 2.99, 1.06)", "c(35.7, 13, 3.63)")
    – Sg1
    Nov 9 at 10:23















up vote
0
down vote













I think you need something like this:



library(ggplot2)

data <- data.frame(cite= c('london','madrid','barcelona','london','madrid','barcelona'),
contaminent = c('Argon','Argon','Argon','Barium','Barium','Barium'),
Concentration= runif(6)*5)

ggplot() + geom_col(data = data,aes(x = cite,y=Concentration,fill=contaminent))


Edit:



Now suppose your data is name my_data and organize as follows: first column name cites with the cites names, then each column's name is a pollution with the values of the pollution concentration for each cite. Then your code for manage your data and used in ggplot could be:



library(ggplot2)
new_data <- data.frame(cites = rep(my_data$cites,ncol(my_data)-1),
contaminent_type= rep(colnames(my_data)[2:ncol(my_data)],each=nrow(my_data)),
Concentration= as.vector(my_data[,2:ncol(my_data)]))

ggplot() + geom_col(data = new_data,aes(x = cites,y=Concentration,fill=contaminent_type))





share|improve this answer























  • Thanks Santiago. So I have to list each site twice, once for each pollutant? I have 25 sites! This really illustrates my point: I've imported my data as a csv, but it still seems to take a lot of code to use it for a simple bar plot.
    – Sg1
    Nov 8 at 12:13










  • GGPLOT does make really enhance plots but in my experience required more code and lot of experience to do it fast and easy. I will edit the post to make and easier way to reorganize your data.
    – Santiago Hurtado
    Nov 8 at 14:51










  • Hi Santiago, I have tried your updated code and it has returned this error: "Error in as.vector(as.numeric(Sb_Ba[, 2:ncol(Sb_Ba)])) : (list) object cannot be coerced to type 'double' " (Sb_Ba is my data frame). I have tried googling this error - is it because my site names are not numeric?
    – Sg1
    Nov 9 at 9:42










  • Just to clarify, my data frame is 3 columns, 'Site' (a list of names), 'Sb' and 'Ba' (both are lists of measured concentrations - numeric values)
    – Sg1
    Nov 9 at 9:45










  • data.frame( c("c("London Marylebone Road ", "Swansea Morriston", "Belfast Centre")", "c(5.25, 2.99, 1.06)", "c(35.7, 13, 3.63)")
    – Sg1
    Nov 9 at 10:23













up vote
0
down vote










up vote
0
down vote









I think you need something like this:



library(ggplot2)

data <- data.frame(cite= c('london','madrid','barcelona','london','madrid','barcelona'),
contaminent = c('Argon','Argon','Argon','Barium','Barium','Barium'),
Concentration= runif(6)*5)

ggplot() + geom_col(data = data,aes(x = cite,y=Concentration,fill=contaminent))


Edit:



Now suppose your data is name my_data and organize as follows: first column name cites with the cites names, then each column's name is a pollution with the values of the pollution concentration for each cite. Then your code for manage your data and used in ggplot could be:



library(ggplot2)
new_data <- data.frame(cites = rep(my_data$cites,ncol(my_data)-1),
contaminent_type= rep(colnames(my_data)[2:ncol(my_data)],each=nrow(my_data)),
Concentration= as.vector(my_data[,2:ncol(my_data)]))

ggplot() + geom_col(data = new_data,aes(x = cites,y=Concentration,fill=contaminent_type))





share|improve this answer














I think you need something like this:



library(ggplot2)

data <- data.frame(cite= c('london','madrid','barcelona','london','madrid','barcelona'),
contaminent = c('Argon','Argon','Argon','Barium','Barium','Barium'),
Concentration= runif(6)*5)

ggplot() + geom_col(data = data,aes(x = cite,y=Concentration,fill=contaminent))


Edit:



Now suppose your data is name my_data and organize as follows: first column name cites with the cites names, then each column's name is a pollution with the values of the pollution concentration for each cite. Then your code for manage your data and used in ggplot could be:



library(ggplot2)
new_data <- data.frame(cites = rep(my_data$cites,ncol(my_data)-1),
contaminent_type= rep(colnames(my_data)[2:ncol(my_data)],each=nrow(my_data)),
Concentration= as.vector(my_data[,2:ncol(my_data)]))

ggplot() + geom_col(data = new_data,aes(x = cites,y=Concentration,fill=contaminent_type))






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 9 at 17:39

























answered Nov 8 at 11:46









Santiago Hurtado

8818




8818












  • Thanks Santiago. So I have to list each site twice, once for each pollutant? I have 25 sites! This really illustrates my point: I've imported my data as a csv, but it still seems to take a lot of code to use it for a simple bar plot.
    – Sg1
    Nov 8 at 12:13










  • GGPLOT does make really enhance plots but in my experience required more code and lot of experience to do it fast and easy. I will edit the post to make and easier way to reorganize your data.
    – Santiago Hurtado
    Nov 8 at 14:51










  • Hi Santiago, I have tried your updated code and it has returned this error: "Error in as.vector(as.numeric(Sb_Ba[, 2:ncol(Sb_Ba)])) : (list) object cannot be coerced to type 'double' " (Sb_Ba is my data frame). I have tried googling this error - is it because my site names are not numeric?
    – Sg1
    Nov 9 at 9:42










  • Just to clarify, my data frame is 3 columns, 'Site' (a list of names), 'Sb' and 'Ba' (both are lists of measured concentrations - numeric values)
    – Sg1
    Nov 9 at 9:45










  • data.frame( c("c("London Marylebone Road ", "Swansea Morriston", "Belfast Centre")", "c(5.25, 2.99, 1.06)", "c(35.7, 13, 3.63)")
    – Sg1
    Nov 9 at 10:23


















  • Thanks Santiago. So I have to list each site twice, once for each pollutant? I have 25 sites! This really illustrates my point: I've imported my data as a csv, but it still seems to take a lot of code to use it for a simple bar plot.
    – Sg1
    Nov 8 at 12:13










  • GGPLOT does make really enhance plots but in my experience required more code and lot of experience to do it fast and easy. I will edit the post to make and easier way to reorganize your data.
    – Santiago Hurtado
    Nov 8 at 14:51










  • Hi Santiago, I have tried your updated code and it has returned this error: "Error in as.vector(as.numeric(Sb_Ba[, 2:ncol(Sb_Ba)])) : (list) object cannot be coerced to type 'double' " (Sb_Ba is my data frame). I have tried googling this error - is it because my site names are not numeric?
    – Sg1
    Nov 9 at 9:42










  • Just to clarify, my data frame is 3 columns, 'Site' (a list of names), 'Sb' and 'Ba' (both are lists of measured concentrations - numeric values)
    – Sg1
    Nov 9 at 9:45










  • data.frame( c("c("London Marylebone Road ", "Swansea Morriston", "Belfast Centre")", "c(5.25, 2.99, 1.06)", "c(35.7, 13, 3.63)")
    – Sg1
    Nov 9 at 10:23
















Thanks Santiago. So I have to list each site twice, once for each pollutant? I have 25 sites! This really illustrates my point: I've imported my data as a csv, but it still seems to take a lot of code to use it for a simple bar plot.
– Sg1
Nov 8 at 12:13




Thanks Santiago. So I have to list each site twice, once for each pollutant? I have 25 sites! This really illustrates my point: I've imported my data as a csv, but it still seems to take a lot of code to use it for a simple bar plot.
– Sg1
Nov 8 at 12:13












GGPLOT does make really enhance plots but in my experience required more code and lot of experience to do it fast and easy. I will edit the post to make and easier way to reorganize your data.
– Santiago Hurtado
Nov 8 at 14:51




GGPLOT does make really enhance plots but in my experience required more code and lot of experience to do it fast and easy. I will edit the post to make and easier way to reorganize your data.
– Santiago Hurtado
Nov 8 at 14:51












Hi Santiago, I have tried your updated code and it has returned this error: "Error in as.vector(as.numeric(Sb_Ba[, 2:ncol(Sb_Ba)])) : (list) object cannot be coerced to type 'double' " (Sb_Ba is my data frame). I have tried googling this error - is it because my site names are not numeric?
– Sg1
Nov 9 at 9:42




Hi Santiago, I have tried your updated code and it has returned this error: "Error in as.vector(as.numeric(Sb_Ba[, 2:ncol(Sb_Ba)])) : (list) object cannot be coerced to type 'double' " (Sb_Ba is my data frame). I have tried googling this error - is it because my site names are not numeric?
– Sg1
Nov 9 at 9:42












Just to clarify, my data frame is 3 columns, 'Site' (a list of names), 'Sb' and 'Ba' (both are lists of measured concentrations - numeric values)
– Sg1
Nov 9 at 9:45




Just to clarify, my data frame is 3 columns, 'Site' (a list of names), 'Sb' and 'Ba' (both are lists of measured concentrations - numeric values)
– Sg1
Nov 9 at 9:45












data.frame( c("c("London Marylebone Road ", "Swansea Morriston", "Belfast Centre")", "c(5.25, 2.99, 1.06)", "c(35.7, 13, 3.63)")
– Sg1
Nov 9 at 10:23




data.frame( c("c("London Marylebone Road ", "Swansea Morriston", "Belfast Centre")", "c(5.25, 2.99, 1.06)", "c(35.7, 13, 3.63)")
– Sg1
Nov 9 at 10:23










Sg1 is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















Sg1 is a new contributor. Be nice, and check out our Code of Conduct.













Sg1 is a new contributor. Be nice, and check out our Code of Conduct.












Sg1 is a new contributor. Be nice, and check out our Code of Conduct.















 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53205409%2f2-series-barplot-ggplot2-or-openair%23new-answer', 'question_page');
}
);

Post as a guest




















































































Popular posts from this blog

Schultheiß

Liste der Kulturdenkmale in Wilsdruff

Android Play Services Check