我似乎真的找到一个能帮我解决我遇到的实际问题的人 .
这是我的代码:
library(RNeo4j)
library(tidyverse)
library(stringr)
library(MASS)
### uncomment the next 2 lines to reconnect to server & re-query the database
# setwd("~/Desktop/Dashrock/Neo4j")
# source("N4j_connect_query.R")
df %
group_by(m.mkt,c1.name) %>%
summarize(n1_4_pct =sum(n.n1_4)/sum(n.est),
n5_9_pct =sum(n.n5_9)/sum(n.est),
n10_19_pct =sum(n.n10_19)/sum(n.est),
n20_49_pct =sum(n.n20_49)/sum(n.est),
n50_99_pct =sum(n.n50_99)/sum(n.est),
n100_249_pct =sum(n.n100_249)/sum(n.est),
n250_499_pct =sum(n.n250_499)/sum(n.est),
n500_999_pct =sum(n.n500_999)/sum(n.est),
n1000_pct =sum(n.n1000)/sum(n.est),
n1000_1_pct =sum(n.n1000_1)/sum(n.est),
n1000_2_pct =sum(n.n1000_2)/sum(n.est),
n1000_3_pct =sum(n.n1000_3)/sum(n.est),
n1000_4_pct =sum(n.n1000_4)/sum(n.est),
ap = sum(n.ap),
emp = sum(n.emp),
num_firms = sum(n.est))
g
g +
geom_point(aes(x=c1.name, y=n100_249_pct, color = factor(m.mkt)), na.rm = TRUE) +
facet_grid(. ~ m.mkt) +
labs(x = "Industry Code (NAICS)", y = "Btwn 100-249 Employees (as % of All Companies)", title = "Company Profiles") +
theme(axis.text.x = element_text(angle=90, hjust = .5, vjust=.5, size=5))
这很好用 . 这是输出:
问题是,当我从 geom_point 更改为 geom_bar (这是我真正想要的)时,我得到了此错误的不同版本:
因子(n100_249_pct)出错:找不到对象'n100_249_pct'
怎么了?