小编Seb*_*eki的帖子

如何用长标签维护ggplot的大小

我有一个情节,它是每种事件类型的简单条形图.我需要情节的标签在情节之下,因为一些事件有很长的名字并且横向压扁了情节.我试图在标题下面移动标签,但是当有很多事件类型时,它现在会被压扁.有没有办法有一个静态的地块大小(即条形图),以便长传说不会压缩情节?

我的代码:

ggplot(counts_df, aes(x = Var2, y = value, fill - Var1)+
    geom_bar(stat = "identity") +
    theme(legend.position = "bottom") +
    theme(legen.direction = "vertical") +
    theme(axis.text.x = element_text(angle = -90)
Run Code Online (Sandbox Code Playgroud)

结果:

在此输入图像描述

我认为这是因为图像尺寸必须是静态的,因此曲线会因轴而牺牲.当我在情节下面放置一个传奇时,同样的事情发生了.

r ggplot2

16
推荐指数
3
解决办法
9378
查看次数

如何使用Python为WordNet中的形容词生成反义词列表

我想在Python中执行以下操作(我有NLTK库,但我对Python不太好,所以我在一个奇怪的伪代码中写了以下内容):

from nltk.corpus import wordnet as wn  #Import the WordNet library
for each adjective as adj in wn        #Get all adjectives from the wordnet dictionary
    print adj & antonym                #List all antonyms for each adjective 
once list is complete then export to txt file
Run Code Online (Sandbox Code Playgroud)

这样我就可以为形容词生成一个完整的反义词词典.我认为它应该是可行的,但我不知道如何创建Python脚本.我想用Python做这个,因为那是NLTK的母语.

python nlp nltk wordnet

8
推荐指数
1
解决办法
5803
查看次数

如何滑动日期输入

这让我很痛苦。

我想 simlpy 有一个带有日期的滑块输入(最好按月步进)并因此更改一个简单的 ggplot_bar 。尽管我可以显示所有内容,但似乎对滑块的更改没有响应:

这是我的代码:

用户界面

library(shiny)

# Define UI for application that draws a histogram
shinyUI(fluidPage(

  # Application title
  titlePanel("St Thomas' Physiology Data Console"),

  # Sidebar with a slider input for the number of bins
  sidebarLayout(
    sidebarPanel(
      sliderInput("DatesMerge",
                  "Dates:",
                  min = as.Date("2006-01-01","%Y-%m-%d"),
                  max = as.Date("2016-12-01","%Y-%m-%d"),
                  value=as.Date("2016-12-01"),timeFormat="%Y-%m-%d")
    ),

    # Show a plot of the generated distribution

      mainPanel(
        tabsetPanel(
          tabPanel("Breath Tests",plotOutput("distPlotLactul")),
    )
  )
))
Run Code Online (Sandbox Code Playgroud)

服务器文件

library(shiny)

source("S:\\Usage.R")

# Define server logic required to draw a histogram
shinyServer(function(input, output) { …
Run Code Online (Sandbox Code Playgroud)

r shiny

8
推荐指数
1
解决办法
2万
查看次数

rails控制台是否限制查询输出?

我在cloud9 IDE中运行rails.我在rails控制台中运行一个查询,它应该只给我创建的用户表中的所有用户.这有100条记录但是当我跑:

User.all
Run Code Online (Sandbox Code Playgroud)

我明白了

 => #<ActiveRecord::Relation [#<User id: 1, name: "Expedita Eaque", group: 1>, #<User id: 2, name: "Omnis Vel Tempora", group: 3>, #<User id: 3, name: "Incidunt", group: 1>, #<User id: 4, name: "Aliquam", group: 3>, #<User id: 5, name: "Dolorum", group: 1>, #<User id: 6, name: "At", group: 2>, #<User id: 7, name: "Dignissimos", group: 1>, #<User id: 8, name: "Eligendi Amet Ut", group: 1>, #<User id: 9, name: "Corporis Sint", group: 5>, #<User id: 10, name: "Quis …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails

7
推荐指数
1
解决办法
2009
查看次数

如何使用lookbehind交替

目标:

我想将句子与'no'一词匹配,但只有在'没有'之前没有'带'或'有'或'有'在r之前.

输入:

The ground was rocky with no cracks in it
No diggedy, no doubt
Understandably, there is no way an elephant can be green
Run Code Online (Sandbox Code Playgroud)

预期产量:

The ground was rocky with no cracks in it
Understandably, there is no way an elephant can be green
Run Code Online (Sandbox Code Playgroud)

尝试:

gsub(".*(?:((?<!with )|(?<!there is )|(?<!there are ))\\bno\\b(?![?:A-Za-z])|([?:]\\s*N?![A-Za-z])).*\\R*", "", input_string, perl=TRUE, ignore.case=TRUE)
Run Code Online (Sandbox Code Playgroud)

问题:

负面的后视似乎被忽略,所以所有的句子都被替换了.问题是在lookbehind声明中使用交替吗?

regex r

7
推荐指数
1
解决办法
171
查看次数

如何在R中对类似的行进行分组

我有一张表如下:

   Rptname     Score

    Bebo23        8
    Bebo22        9
    Bebo19        10
    Alt88         12
    Alt67         11
    Jimm          5
    Jimm2         7
Run Code Online (Sandbox Code Playgroud)

我想将那些相似的行汇总到一组.即

     Bebo         27
     Alt          22
     Jimm         12
Run Code Online (Sandbox Code Playgroud)

行名称的开头始终是与组相似的部分,但相似的字符数可能会有所不同.我很欣赏我必须定义组并可能使用某种正则表达式,但我不确定如何在此基础上进行分组和求和.感谢您的帮助

grouping r

6
推荐指数
1
解决办法
9619
查看次数

如何从列中获得第一个四分位数

我有一个名为Means的列的数据框.我想从本专栏中获得第一个四分位数.我知道我可以使用四分位数(df)或摘要(df),但这给了我所有的四分位数.我如何才能获得第一个?

statistics r

6
推荐指数
1
解决办法
2万
查看次数

更改节点大小gephi 0.9.1

我到处都看,但我似乎无法得到最新版本的Gephi(0.9.1)的答案.我想要做的就是根据图中所有节点的in-degree更改节点大小.这曾经是我可以用排名工具做的事情,但由于这已经合并到'外观'选项卡,我无法弄清楚如何做到这一点.

gephi

6
推荐指数
1
解决办法
8939
查看次数

如何在nltk中创建句子的否定

我是NLTK的新手.我想创造一个句子的否定(通常是现在时).例如,是否有一个允许我转换的功能:'我跑'到'我不跑'

要么

'她跑'到'她不跑'.

我想我可以使用POS来检测动词及其前面的代词但我只是想知道是否有更简单的内置函数

python nlp nltk

5
推荐指数
2
解决办法
1287
查看次数

如何找到具有相同值的三个连续行

我有一个数据帧如下:

chr     leftPos    Sample1  X.DD   3_samples    MyStuff
1        324         -1        1        1           1
1        4565        -1        0        0           0 
1        6887        -1        1        0           0
1        12098        1       -1        1           1
2        12          -1        1        0           1
2        43          -1        1        1           1
5        1           -1        1        1           0
5        43           0        1       -1           0
5        6554         1        1        1           1
5        7654        -1        0        0           0
5        8765         1        1        1           0
5        9833         1        1        1          -1
6 …
Run Code Online (Sandbox Code Playgroud)

r

5
推荐指数
1
解决办法
617
查看次数

标签 统计

r ×6

nlp ×2

nltk ×2

python ×2

gephi ×1

ggplot2 ×1

grouping ×1

regex ×1

ruby-on-rails ×1

shiny ×1

statistics ×1

wordnet ×1