rows

geom_raster faceted plot with ggplot2: control row height

こ雲淡風輕ζ 提交于 2019-12-06 11:16:09
In the example below I have a dataset containing two experiments F1 and F2. A classification is performed based on F1 signal, and both F1 and F2 values are ordered accordingly. In this diagram, each facet has the same dimension although the number of rows is not the same ( e.g class #7 contains only few elements compare to the other classes). I would like to modify the code to force row height to be the same across facets (facets would thus have various blank space below). Any hints would be greatly appreciated. Thank you library(ggplot2) library(reshape2) set.seed(123) # let's create a fake

I have a big table in R, now I want to select the odd rows and paste a label before the first element of this row

好久不见. 提交于 2019-12-06 10:03:17
问题 A=matrix(0,4,2) A[1,1]=2 A[1,2]=3 A[2,1]=2 A[2,2]=3 A[3,1]=2 A[3,2]=3 A[4,1]=2 A[4,2]=3 Now I want to pick up row 2,4 and return this is odd before the first element of the row. But I don't know how to make a loop to pick up row 2,4 回答1: If I understand your question correctly, you want to display some text and the first element of all odd rows. You can try this: cat(paste("This is odd", A[c(2,4),1], "\n")) No need for a loop there. Should you want to work with a larger matrix, and take all

jQuery $.live() doesn't work with table rows on the iPhone

非 Y 不嫁゛ 提交于 2019-12-06 08:41:43
问题 I'm making table rows click-able with jQuery's $.live() function. Works perfectly on Chrome, Firefox and even desktop Windows Safari -- but not on the iPhone. $.bind() works everywhere, but for obvious reasons I'd like to use the other function. Does anyone have any idea why it doesn't work and how can I fix it? Example code below. <!DOCTYPE html> <html lang="en"> <head> <title>test</title> <meta charset="utf-8" /> <meta name="viewport" content="user-scalable=no,width=device-width" /> <meta

Drag and drop rows in a jqgrid

余生颓废 提交于 2019-12-06 07:40:56
问题 I am trying a drag & drop option for rows in a jqgrid. I have tried with this fiddle. Thanks a lot for any valuable suggestions. I have tried with jQuery("#mytable").gridDnD(); and also with jQuery("#mytable").jqGrid('gridDnD'); 回答1: I was having the same problem so I looked into your example. Made a few changes and now it seems to work. Include: jQuery UI.js as this is where the base jquery drag and drop code is. Include: jquery.tablednd.js Move the Dnd call and sortable rows calls to after

MySQL return all rows where a column contains any but only keywords from a set

自闭症网瘾萝莉.ら 提交于 2019-12-06 07:38:11
问题 Is there a way to select rows where one of the column contains only , but any number of, predefined values? I've been using this, but it returns any rows where my column contains at least one of the values (which is exactly what it's suppose to do, I know). But I'm looking for a way to only select rows that have ONLY my keywords in the keyword column. SELECT * FROM `products`.`product` WHERE keywords LIKE '%chocolate%' AND keyword LIKE '%vanilla%'; Example Keywords: chocolate, sugar, milk,

How to maintain selected rows in DataGridView when mouse is held down on a cell?

若如初见. 提交于 2019-12-06 07:05:40
问题 I am trying to implement row moving in a DataGridView. I want to be able to select multiple rows and click on any of the selected row's cells to begin the drag operation. The problem is that the rows become deselected when I hold the mouse down on a cell. How can I prevent this from happening? 回答1: From a quick Google search, this seems to a solution for custom drag-dropping of rows. Note I just ripped the following code from the linked page, I can't vouch for its effectiveness. private

Select top N rows out of M groups

浪子不回头ぞ 提交于 2019-12-06 06:48:59
问题 I have this table: CREATE TABLE IF NOT EXISTS `catalog_sites` ( `id` int(10) unsigned NOT NULL auto_increment, `cat_id` int(10) unsigned NOT NULL, `date` datetime NOT NULL, `url` varchar(255) NOT NULL, `title` varchar(255) NOT NULL, `description` varchar(255) NOT NULL, `keywords` varchar(255) NOT NULL, `visited` int(10) unsigned NOT NULL, `shown` int(10) unsigned NOT NULL, `meta_try` int(1) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `url` (`url`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO

Deleting non-unique rows from an array

◇◆丶佛笑我妖孽 提交于 2019-12-06 03:26:34
I have an array a as follows: a = [ 1 2; 3 4; 1 2 ]; I want to delete all rows appearing more than once in a and get c : c = [ 3 4 ]; Please note that this is not the same operation as keeping unique rows, since I don't want rows that had duplicates to appear at all. How can I accomplish this? The third output of unique gives you the index of the unique row in the original array. You can use this with accumarray to count the number of occurrences, which can be used to select rows that occur only once. For example: A = [1 2; 3 4; 1 2]; [uniquerow, ~, rowidx] = unique(A, 'rows'); noccurrences =

R: populating and/or duplicating rows based upon other columns

99封情书 提交于 2019-12-06 03:04:37
问题 My question is based upon this question. I have a data as below. I want to fill cells by first looking down and then by looking up as long as the bom is same. In case of bom=A, I want to fill up rows as shown. But in case of bom=B, as the type_p column is different, I want to duplicate rows and feel the blanks bom=c(rep("A",4),rep("B",3)) Part=c("","lambda","beta","","tim","tom","") type_p=c("","sub","sub","","sub","pan","") ww=c(1,2,3,4,1,2,3) df=data.frame(bom,Part,type_p,ww) > df bom Part

Row-wise cor() on subset of columns using dplyr::mutate()

孤人 提交于 2019-12-06 01:21:43
set.seed(8) df <- data.frame( A=sample(c(1:3), 10, replace=T), B=sample(c(1:3), 10, replace=T), C=sample(c(1:3), 10, replace=T), D=sample(c(1:3), 10, replace=T), E=sample(c(1:3), 10, replace=T), F=sample(c(1:3), 10, replace=T)) Would like to pass a subset of columns into a dplyr mutate() and make a row-wise calculation, for instance cor() to get correlation between column A-C and D-F, but cannot figure out how. Found SO inspiration here , here and here , but nevertheless failed to produce an acceptable code. For instance, I tried this: require(plyr) require(dplyr) df %>% rowwise() %>% mutate(c