如果采用此数据框:
employee <- c('John Doe','Peter Gynn','Jolie Hope')
salary <- c(21000, 23400, 26800)
startdate <- as.Date(c('2010-11-1','2008-3-25','2007-3-14'))
employ.data <- data.frame(employee, salary, startdate)
然后通过以下方式删除基于特定字符串值的行:
newDf <- employ.data[employ.data$employee == "John Doe",]
并创建一个箱线图:
boxplot(newDf$salary ~ newDf$employee)
然后您的箱形图如下所示:
为什么它还为删除的数据提供了额外的空间,因此看起来很难看?如何解决这个问题?
答案 0 :(得分:1)
大的y轴空白空间只是一个功能,您应该具有更多的y值,然后绘图就可以了。至于删除的类别,请使用@Command(name = "git-star", header = {
"@|green _ _ _ |@",
"@|green __ _(_) |_ __| |_ __ _ _ _ |@",
"@|green / _` | | _(_-< _/ _` | '_| |@",
"@|green \\__, |_|\\__/__/\\__\\__,_|_| |@",
"@|green |___/ |@"},
description = "Shows GitHub stars for a project",
mixinStandardHelpOptions = true, version = "git-star 0.1")
class GitStar implements Runnable {
@Option(names = "-c")
int count;
@Spec CommandSpec spec;
// prints banner every time the command is invoked
public void run() {
String[] banner = new CommandLine(new GitStar())
.getCommandSpec().usageHelpMessage().header();
// or: String[] banner = this.spec.usageHelpMessage().header();
for (String line : banner) {
System.out.println(CommandLine.Help.Ansi.AUTO.string(line));
}
// business logic here...
}
public static void main(String[] args) {
CommandLine.run(new GitStar(), args);
}
}
。