overlap

How to make an overlapping barplot?

非 Y 不嫁゛ 提交于 2019-12-18 04:19:19
问题 Making a barplot the 'standard' way dat <- read.table(text = "A B + 1 1 4 + 2 2 3 + 3 3 2 + 4 4 1", header = TRUE) barplot(as.matrix(dat)) gives a barplot like this: Instead, I would like to have the different segnments to overlap, like so How can I make such a plot in R? 回答1: There are two ways I have used: (counts <- with(diamonds, table(cut, clarity))) # clarity # cut I1 SI2 SI1 VS2 VS1 VVS2 VVS1 IF # Fair 210 466 408 261 170 69 17 9 # Good 96 1081 1560 978 648 286 186 71 # Very Good 84

Find overlapping dates for each ID and create a new row for the overlap

百般思念 提交于 2019-12-18 02:57:25
问题 I would like to find the overlapping dates for each ID and create a new row with the overlapping dates and also combine the characters (char) for the lines. It is possible that my data will have >2 overlaps and need >2 combinations of characters. eg. ERM Data: ID date1 date2 char 15 2003-04-05 2003-05-06 E 15 2003-04-20 2003-06-20 R 16 2001-01-02 2002-03-04 M 17 2003-03-05 2007-02-22 I 17 2005-04-15 2014-05-19 C 17 2007-05-15 2008-02-05 I 17 2008-02-05 2012-02-14 M 17 2010-06-07 2011-02-14 V

Processing the input file based on range overlap

亡梦爱人 提交于 2019-12-17 20:16:18
问题 I have a huge input file (a representative sample of which is shown below as input ): > input CT1 CT2 CT3 1 chr1:200-400 chr1:250-450 chr1:400-800 2 chr1:800-970 chr2:200-500 chr1:700-870 3 chr2:300-700 chr2:600-1000 chr2:700-1400 I want to process it by following some rules (described below) so that I get an output like: > output CT1 CT2 CT3 chr1:200-400 1 1 0 chr1:800-970 1 0 0 chr2:300-700 1 1 0 chr1:250-450 1 1 0 chr2:200-500 1 1 0 chr2:600-1000 0 1 1 chr1:400-800 0 0 1 chr1:700-870 0 1 1

Merge overlapping ranges into unique groups, in dataframe

懵懂的女人 提交于 2019-12-17 12:02:31
问题 I have a dataframe of n rows and 3 df <- data.frame(start=c(178,400,983,1932,33653), end=c(5025,5025, 5535, 6918, 38197), group=c(1,1,2,2,3)) df start end group 1 178 5025 1 2 400 5025 1 3 983 5535 2 4 1932 6918 2 5 33653 38197 3 I would like to make a new column df$group2 that re-classifies groups that overlap to be the same. For example, df$group[df$group==1] starts at 178 and ends at 5025. This overlaps with df$group[df$group==2] , which starts at 983 and ends at 6918. I would like to make

CSS: DIV containing no height on float set

≯℡__Kan透↙ 提交于 2019-12-17 10:40:48
问题 assume we have this code: <div id='upperDiv' style='min-height:200px;border: 1px solid #000000;'> <div id='rightDiv' style='float:right;width:75%;'> content1 </div> <div id='leftDiv' style='float:left;width:25%;'> content2 </div> </div> <div id='lowerDiv' style='height:50px;border: 1px solid #000000;margin-top:5px;'> content3 </div> When content of rightDiv and leftDiv passes the 200px height (the min height) upperDiv doesn't grow, so its content overlaps the lower div. If I remove the float

Find overlapping date ranges in PostgreSQL

三世轮回 提交于 2019-12-17 03:40:58
问题 Is this correct? SELECT * FROM contract JOIN team USING (name_team) JOIN player USING(name_player) WHERE name_team = ? AND DATE_PART('YEAR',date_join)>= ? AND DATE_PART('YEAR',date_leave)<= ? My table contract has the player name, team name and the dates when he joined and left the club. I want to make a function listing all players that were on the team in specific years. The above query doesn't seem to be working ... 回答1: Why not use between without the date part thing: WHERE datefield

Overlapping matches in Regex

戏子无情 提交于 2019-12-16 22:23:09
问题 I can't seem to find an answer to this problem, and I'm wondering if one exists. Simplified example: Consider a string "nnnn", where I want to find all matches of "nn" - but also those that overlap with each other. So the regex would provide the following 3 matches: nn nn n nn n nn nn I realize this is not exactly what regexes are meant for, but walking the string and parsing this manually seems like an awful lot of code, considering that in reality the matches would have to be done using a

Algorithm required to determine if a rectangle is completely covered by another set of rectangles

£可爱£侵袭症+ 提交于 2019-12-14 03:39:34
问题 I am searching for an algorithm that will determine if a new rectangle is completely covered by a set of existing rectangles. Another way of putting the question, is does the new rectangle exist completely with the area covered by the existing rectangles? There seem to be lots of algorithms to determine rectangle overlap and so on, but I can't really find anything that solves this exact problem. The rectangles will be represented using x, y coordinates. This problem relates to geographical

responsive fixed-top navbar when expanded fills up screen, hides some of the nav-links, and does not scroll

╄→гoц情女王★ 提交于 2019-12-14 03:16:42
问题 I have created a fixed-top bootstrap 4 navbar that is expanded on large screens, and collapsed on the others. I have also added padding-top to the <body> to prevent the navbar from overlapping the main body content. However, on smaller screens when the collapsed navbar is expanded using the hamburger button, it expands and fills the screen. Some of the nav-links then become hidden (i.e. outside the display). Moreover,scrolling does not scroll the navbar, but only the main body content which

VBA - determine if two or more cells overlap in the same cell address

烈酒焚心 提交于 2019-12-14 02:27:28
问题 I have a worksheet with filled colored cells within certain borders, and I have to "move" the filled cells randomly by an offset provided by NewX and NewY parameters, select the new cell, delete the filling of the "old" cell and fill the new cell with a different color. The problems start after I perform a few runs - it seems that the cells "disappear" - less and less cells are seen with time, and I assume it's because some of them overlap each other and since my code is set to find filled