我似乎在使用ggplot2时遇到了问题.
尝试使用aes_string绘制框图时,我收到以下错误:
错误:stat_boxplot需要以下缺失的美学:x,y
这是一个例子:
x='group'
y='value'
df=data.frame(group=c('A','A','B','B','C','C'),value=c(1,2,3,4,5,6))
ggplot(data=df,aes_string(x,y)) + geom_boxplot() #returns the error
ggplot(data=df,aes(x,y)) + geom_boxplot() #plots nonsense (naturally)
ggplot(data=df,aes(group,value)) + geom_boxplot() #works, but not strings
Run Code Online (Sandbox Code Playgroud)
关于如何使用字符串进行此操作的任何建议?
从http://brew.sh/运行以下命令:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Run Code Online (Sandbox Code Playgroud)
...导致:
-e:192: 语法错误,意外的“.”,期待 $end .map { |d| File.join(HOMEBREW_PREFIX, d) } ^
我在 Mac OS 10.6 上使用 zsh。
我创建了一个名为test2.txt的文件,其中包含以下信息:
col1 col2 col3 col4
1 A B
2 A B
3 A B
4 A B
5 A B
6 A B
7 A C
8 A C
Run Code Online (Sandbox Code Playgroud)
使用以下命令读取时:
test.ws=read.table(paste(inputDir,'test2.txt',sep=''),fill=T,header=T)
Run Code Online (Sandbox Code Playgroud)
我得到以下内容:
col1 col2 col3 col4
1 1 A B NA
2 2 A B NA
3 3 A B NA
4 4 A B NA
5 5 A B NA
6 6 A B NA
7 7 A C NA
8 8 A C NA
Run Code Online (Sandbox Code Playgroud)
列向左移动.是什么赋予了?!
我尝试了以下方法:
> count.fields(paste(inputDir,'test.txt',sep='')) …Run Code Online (Sandbox Code Playgroud)