How to remove additional screens and monitors from X configuration file ( /etc/X11/xorg.conf ) - xserver

I have one monitor but X -configure makes a configuration file for 16 screens and monitors.
Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
Screen 1 "Screen1" RightOf "Screen0"
Screen 2 "Screen2" RightOf "Screen1"
Screen 3 "Screen3" RightOf "Screen2"
Screen 4 "Screen4" RightOf "Screen3"
Screen 5 "Screen5" RightOf "Screen4"
Screen 6 "Screen6" RightOf "Screen5"
Screen 7 "Screen7" RightOf "Screen6"
Screen 8 "Screen8" RightOf "Screen7"
Screen 9 "Screen9" RightOf "Screen8"
Screen 10 "Screen10" RightOf "Screen9"
Screen 11 "Screen11" RightOf "Screen10"
Screen 12 "Screen12" RightOf "Screen11"
Screen 13 "Screen13" RightOf "Screen12"
Screen 14 "Screen14" RightOf "Screen13"
Screen 15 "Screen15" RightOf "Screen14"
Screen 16 "Screen16" RightOf "Screen15"
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection
...
When I remove additional screens I face with X server errors on loading GUI.

Related

Read PDF table into R where rows have varying numbers of lines

I'm hoping to read the following PDF into a tidy data frame within R:
PDF Table. The table even stretches across 70+ pages.
I am adept at reading in tables where each cell has one line, but I'm not sure how to extend that knowledge to cases where rows have a varying number of lines
Any help would be much appreciated!
I would suggest you to use tabulizer. It is better to extract tables from pdf files. Here the code for the file you shared:
library(tabulizer)
lst <- extract_tables(file = '8-31-2020 Paragraph IV Update_0.pdf')
#Format
renames <- function(x)
{
colnames(x) <- x[1,]
x <- x[2:dim(x)[1],,drop=F]
return(as.data.frame(x))
}
#Apply
lst21 <- lapply(lst,renames)
#Bind all
df <- do.call(rbind,lst21)
Output (some rows):
head(df)
DRUG NAME DOSAGE FORM STRENGTH
1 Abacavir Sulfate Tablets 300 mg
2 Abacavir Oral Solution 20 mg/mL
3 Abacavir Sulfate, Dolutegravir\rand Lamivudine Tablets 600 mg/50 mg/300\rmg
4 Abacavir Sulfate and\rLamivudine Tablets 600 mg/300 mg
5 Abacavir Sulfate, Lamivudine\rand Zidovudine Tablets 300 mg/150 mg/300\rmg
6 Abiraterone Acetate Tablets 125 mg
RLD/NDA DATE OF\rSUBMISSION NUMBER OF\rANDAs\rSUBMITTED 180-DAY\rSTATUS
1 Ziagen\r20977 1/28/2009 1 Eligible
2 Ziagen\r20978 12/27/2012 1 Eligible
3 Triumeq\r205551 8/14/2017 5
4 Epzicom\r21652 9/27/2007 1 Eligible
5 Trizivir\r21205 3/22/2011 1 Eligible
6 Yonsa\r210308 7/23/2018 1
180-DAY\rDECISION\rPOSTING\rDATE DATE OF\rFIRST\rAPPLICANT\rAPPROVAL
1 2/11/2020 6/18/2012
2 2/11/2020 9/26/2016
3
4 2/11/2020 9/29/2016
5 2/11/2020 12/5/2013
6
DATE OF FIRST\rCOMMERCIAL\rMARKETING BY\rFTF EXPIRATION\rDATE OF LAST\rQUALIFYING\rPATENT
1 6/19/2012 5/14/2018
2 9/15/2017 5/14/2018
3 12/8/2029
4 9/29/2016 5/14/2018
5 12/17/2013 5/14/2018
6 3/17/2034

Dataframe Aggregation By Group - Separating a Column's Values by Ranges

I have a dataframe as follows:
parent<- c('a', 'b', 'c', 'd',
'e', 'f', 'g', 'h',
'i', 'j', 'k', 'l',
'm', 'n', 'o', 'p',
'q', 'r', 's', 't',
'u', 'v', 'w', 'x',
'y', 'z')
child<- c('A', 'B', 'C', 'D',
'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L',
'M', 'N', 'O', 'P',
'Q', 'R', 'S', 'T',
'U', 'V', 'W', 'X',
'Y', 'Z')
Type<- c('desktop', 'desktop', 'desktop', 'desktop',
'desktop', 'desktop', 'desktop', 'desktop',
'desktop', 'desktop', 'desktop', 'desktop',
'desktop', 'desktop', 'desktop', 'desktop',
'desktop', 'desktop', 'desktop', 'desktop',
'desktop', 'desktop', 'desktop', 'desktop',
'desktop', 'desktop')
Size<- c('MEDIUM', 'MEDIUM', 'LARGE', 'LARGE',
'SMALL', 'MEDIUM', 'LARGE', 'SMALL',
'MEDIUM', 'SMALL', 'LARGE', 'LARGE',
'SMALL', 'SMALL', 'LARGE', 'LARGE',
'MEDIUM', 'SMALL', 'SMALL', 'MEDIUM',
'LARGE', 'MEDIUM', 'SMALL', 'MEDIUM',
'LARGE', 'MEDIUM')
Revenue<- c(22138.16, 18617.94, 12394.36, 10535.76,
8901.41, 7320.17, 3821.40, 2811.50,
2483.10, 2145.76, 2138.41, 2037.67,
1950.52, 1837.93, 1737.68, 1554.61,
1374.40, 1334.02, 1214.60, 1191.41,
1189.56, 1174.55, 1162.80, 1131.29,
1127.05, 1108.53)
NumberofSales<- c(1954720, 5129937, 1086104, 970326,
1608012, 746613, 333424, 236643,
352294, 587541, 209218, 342455,
192670, 340580, 275260, 248049,
251790, 128845, 303515, 112218,
149878, 226633, 194973, 103425,
101819, 114570)
Price<- c(11.325489, 3.629273, 11.411762, 10.857959,
5.535661, 9.804504, 11.461083, 11.880766,
7.048374, 3.652103, 10.220966, 5.950183,
10.123631, 5.396471, 6.312868, 6.267350,
5.458517, 10.353681, 4.001779, 10.616924,
7.936855, 5.182608, 5.963908, 10.938264,
11.069152, 9.675570)
Opps<- c(5144351, 6038044, 2354341, 4578272,
7197544, 474510, 1045528, 181471,
1071631, 801038, 928563, 477870,
590497, 849537, 410179, 432703,
1983993, 330478, 939806, 191824,
283107, 575004, 256846, 249530,
142318, 2036363)
df<-data.frame(parent, child, Type, Size,
Revenue, NumberofSales, Price, Opps)
This is what it looks like:
df
parent child Type Size Revenue NumberofSales Price Opps
1 a A desktop MEDIUM 22138.16 1954720 11.325489 5144351
2 b B desktop MEDIUM 18617.94 5129937 3.629273 6038044
3 c C desktop LARGE 12394.36 1086104 11.411762 2354341
4 d D desktop LARGE 10535.76 970326 10.857959 4578272
5 e E desktop SMALL 8901.41 1608012 5.535661 7197544
6 f F desktop MEDIUM 7320.17 746613 9.804504 474510
7 g G desktop LARGE 3821.40 333424 11.461083 1045528
8 h H desktop SMALL 2811.50 236643 11.880766 181471
9 i I desktop MEDIUM 2483.10 352294 7.048374 1071631
10 j J desktop SMALL 2145.76 587541 3.652103 801038
11 k K desktop LARGE 2138.41 209218 10.220966 928563
12 l L desktop LARGE 2037.67 342455 5.950183 477870
13 m M desktop SMALL 1950.52 192670 10.123631 590497
14 n N desktop SMALL 1837.93 340580 5.396471 849537
15 o O desktop LARGE 1737.68 275260 6.312868 410179
16 p P desktop LARGE 1554.61 248049 6.267350 432703
17 q Q desktop MEDIUM 1374.40 251790 5.458517 1983993
18 r R desktop SMALL 1334.02 128845 10.353681 330478
19 s S desktop SMALL 1214.60 303515 4.001779 939806
20 t T desktop MEDIUM 1191.41 112218 10.616924 191824
21 u U desktop LARGE 1189.56 149878 7.936855 283107
22 v V desktop MEDIUM 1174.55 226633 5.182608 575004
23 w W desktop SMALL 1162.80 194973 5.963908 256846
24 x X desktop MEDIUM 1131.29 103425 10.938264 249530
25 y Y desktop LARGE 1127.05 101819 11.069152 142318
26 z Z desktop MEDIUM 1108.53 114570 9.675570 2036363
I want to create a dataframe that shows the distribution of Price BY Size and Type with all of the appropriate metrics for these Price ranges. I want the final dataframe to look like this. ( I didn't do the aggregation for the metric values because it takes way too long the way I am currently doing it, that's why they are all the same right now but the final answer should have all different values)
Type Size Price Range SUM_Opps SUM_NumberofSales SUM_Revenue
1 desktop LARGE $3-$3.99 9,143,587 2,531,983 $8,453.93
1 desktop LARGE $4-$4.99 9,143,587 2,531,983 $8,453.93
1 desktop LARGE $5-$5.99 9,143,587 2,531,983 $8,453.93
1 desktop LARGE $6-$6.99 9,143,587 2,531,983 $8,453.93
1 desktop LARGE $7-$7.99 9,143,587 2,531,983 $8,453.93
1 desktop LARGE $8-$8.99 9,143,587 2,531,983 $8,453.93
1 desktop LARGE $9-$9.99 9,143,587 2,531,983 $8,453.93
1 desktop LARGE $10-$10.99 9,143,587 2,531,983 $8,453.93
1 desktop LARGE $11-$11.99 9,143,587 2,531,983 $8,453.93
1 desktop LARGE $12-$12.99 9,143,587 2,531,983 $8,453.93
1 desktop LARGE $13-Greater 9,143,587 2,531,983 $8,453.93
1 desktop MEDIUM $3-$3.99 9,143,587 2,531,983 $8,453.93
1 desktop MEDIUM $4-$4.99 9,143,587 2,531,983 $8,453.93
1 desktop MEDIUM $5-$5.99 9,143,587 2,531,983 $8,453.93
1 desktop MEDIUM $6-$6.99 9,143,587 2,531,983 $8,453.93
1 desktop MEDIUM $7-$7.99 9,143,587 2,531,983 $8,453.93
1 desktop MEDIUM $8-$8.99 9,143,587 2,531,983 $8,453.93
1 desktop MEDIUM $9-$9.99 9,143,587 2,531,983 $8,453.93
1 desktop MEDIUM $10-$10.99 9,143,587 2,531,983 $8,453.93
1 desktop MEDIUM $11-$11.99 9,143,587 2,531,983 $8,453.93
1 desktop MEDIUM $12-$12.99 9,143,587 2,531,983 $8,453.93
1 desktop MEDIUM $13-Greater 9,143,587 2,531,983 $8,453.93
1 desktop SMALL $3-$3.99 9,143,587 2,531,983 $8,453.93
1 desktop SMALL $4-$4.99 9,143,587 2,531,983 $8,453.93
1 desktop SMALL $5-$5.99 9,143,587 2,531,983 $8,453.93
1 desktop SMALL $6-$6.99 9,143,587 2,531,983 $8,453.93
1 desktop SMALL $7-$7.99 9,143,587 2,531,983 $8,453.93
1 desktop SMALL $8-$8.99 9,143,587 2,531,983 $8,453.93
1 desktop SMALL $9-$9.99 9,143,587 2,531,983 $8,453.93
1 desktop SMALL $10-$10.99 9,143,587 2,531,983 $8,453.93
1 desktop SMALL $11-$11.99 9,143,587 2,531,983 $8,453.93
1 desktop SMALL $12-$12.99 9,143,587 2,531,983 $8,453.93
1 desktop SMALL $13-Greater 9,143,587 2,531,983 $8,453.93
How do I create the table above? The table above is showing the sum of OPPS, Number of Sales, and Revenue BY Type, Size, and Price Range.
I understand how to use dplyr to do the simple aggregation but the tough part is doing the distribution of prices.
Any help would be great, thanks!
you could use Hmisc::cut2() to generate you price bins as levels of a factor:
library(Hmisc)
library(dplyr)
df$cut_Price <- cut2(df$Price, cuts = 4:13)
df %>% group_by(cut_Price, Size, Type) %>%
summarise_at(c("Opps", "NumberofSales", "Revenue"),"sum") %>%
arrange(Size, cut_Price) %>% ungroup() %>%
mutate(cut_Price = gsub("(.*, \\d\\.)00", "\\199", cut_Price))
# A tibble: 16 × 6
cut_Price Size Type Opps NumberofSales Revenue
<chr> <fctr> <fctr> <dbl> <dbl> <dbl>
1 [ 5.00, 6.99) LARGE desktop 477870 342455 2037.67
2 [ 6.00, 7.99) LARGE desktop 842882 523309 3292.29
3 [ 7.00, 8.99) LARGE desktop 283107 149878 1189.56
4 [10.00,11.00) LARGE desktop 5506835 1179544 12674.17
5 [11.00,12.00) LARGE desktop 3542187 1521347 17342.81
6 [ 3.63, 4.99) MEDIUM desktop 6038044 5129937 18617.94
7 [ 5.00, 6.99) MEDIUM desktop 2558997 478423 2548.95
8 [ 7.00, 8.99) MEDIUM desktop 1071631 352294 2483.10
9 [ 9.00,10.00) MEDIUM desktop 2510873 861183 8428.70
10 [10.00,11.00) MEDIUM desktop 441354 215643 2322.70
11 [11.00,12.00) MEDIUM desktop 5144351 1954720 22138.16
12 [ 3.63, 4.99) SMALL desktop 801038 587541 2145.76
13 [ 4.00, 5.99) SMALL desktop 939806 303515 1214.60
14 [ 5.00, 6.99) SMALL desktop 8303927 2143565 11902.14
15 [10.00,11.00) SMALL desktop 920975 321515 3284.54
16 [11.00,12.00) SMALL desktop 181471 236643 2811.50
if you want to adjust the cuts to every 0.5 instead of 1, you could do this since its the vector passed to cut = ... is defining the "cut points":
df$cut_Price <- cut2(df$Price, cuts = seq(4,13,.5))
this will add the price bins
library(dplyr)
df %>%
mutate(price_bin=ifelse(Price>13, 13, floor(Price))) %>%
group_by(Type, Size, price_bin) %>%
summarise(sum_opps=sum(Opps), sum_sales=sum(NumberofSales), sum_revenue=sum(Revenue))
update
not sure why there are down votes when this returns the same results as the accepted answer without requiring an additional library
Type Size price_bin sum_opps sum_sales sum_revenue
<fctr> <fctr> <dbl> <dbl> <dbl> <dbl>
1 desktop LARGE 5 477870 342455 2037.67
2 desktop LARGE 6 842882 523309 3292.29
3 desktop LARGE 7 283107 149878 1189.56
4 desktop LARGE 10 5506835 1179544 12674.17
5 desktop LARGE 11 3542187 1521347 17342.81
6 desktop MEDIUM 3 6038044 5129937 18617.94
7 desktop MEDIUM 5 2558997 478423 2548.95
8 desktop MEDIUM 7 1071631 352294 2483.10
9 desktop MEDIUM 9 2510873 861183 8428.70
10 desktop MEDIUM 10 441354 215643 2322.70
11 desktop MEDIUM 11 5144351 1954720 22138.16
12 desktop SMALL 3 801038 587541 2145.76
13 desktop SMALL 4 939806 303515 1214.60
14 desktop SMALL 5 8303927 2143565 11902.14
15 desktop SMALL 10 920975 321515 3284.54
16 desktop SMALL 11 181471 236643 2811.50

Plotting forceNetwork diagram in R

I'm working on a project to plot mobile OS update times, using forceNetwork from D3 in R. I've successfully plotted a few basic iterations using simpleNetwork, but cannot get the more complicated network to correctly plot.
Have read up on a few posts on this subject, including this one (forceNetwork not displaying any edges), but haven't been able to deduce the answer.
Like the guy in the post above, I'm able to plot the graph with lots of nodes, but cannot get them to connect. Here is what I'm looking to achieve with the nodes:
At center, the mobile operating system (Android and iOS)
First outer edge, the OEMs (Motorola, Samsung, Apple, etc.)
Second outer edge, the mobile devices, connected to the appropriate OEMs
For links, I'd like to model accordingly:
first link between mobile OS and OEM, is just connecting them since there is a known connection (i.e. Motorola makes Android devices, Apple makes iOS devices). For this, I'm using the numerical variable "promised", which should have a "1" for each record to establish the connection.
Second link, between OEM and device, should be "how.long" (i.e. how long it took them to deliver on the actual upgrade)...ideally, I want the length of the link between the nodes to be derived from the length of time it took to deliver on the actual upgrade.
I've created "misNodes" and "misLinks" with the following data:
misNodes <- data.frame(operating.system, OEM, Device)
misLinks <- data.frame(promised, updated, how.long)
I've made a bit of progress plotting with legend and key, but haven't been able to structure in the desired way, nor have I had much success drawing the desired linkages. Here are my best attempts, so far:
#Try plotting
forceNetwork(Links=misLinks, Nodes=misNodes, Source="promised", Target="updated", Value="how.long", NodeID="Device", Group="OEM", width=1000, height=1000, opacity=1, zoom=TRUE, legend=TRUE, bounded=TRUE) #doesn't work, but making progress
forceNetwork(Links=misLinks, Nodes=misNodes, Source="promised", Target="how.long", NodeID="Device", Group="OEM", width=800, height=800, opacity=1, zoom=TRUE, legend=TRUE, bounded=TRUE)
forceNetwork(Links=misLinks, Nodes=misNodes, Source="promised", Target="how.long", Value="promised", NodeID="Device", Group="OEM", width=800, height=800, opacity=1, zoom=TRUE, legend=TRUE, bounded=TRUE)
str(misLinks)
'data.frame': 74 obs. of 3 variables:
$ promised: num 1 1 1 1 1 1 1 1 1 1 ...
$ updated : num 1 1 1 1 1 1 1 1 1 0 ...
$ how.long: num 6 3 1 4 1 6 6 6 6 0 ...
str(misNodes)
'data.frame': 74 obs. of 3 variables:
$ operating.system: Factor w/ 2 levels "Android","iOS": 1 1 1 1 1 1 1 1 1 1 ...
$ OEM : Factor w/ 7 levels "Apple","HTC",..: 2 2 2 2 2 2 2 3 3 3 ...
$ Device : Factor w/ 74 levels "Atrix HD","Atrix HD (developer edition)",..: 7 54 55 56 57 58 59 22 20 21 ...
Any tips would be appreciated...
EDIT: added some data:
head(misLinks)
promised updated how.long
1 1 1 6
2 1 1 3
3 1 1 1
4 1 1 4
5 1 1 1
6 1 1 6
head(misNodes)
operating.system OEM Device
1 Android HTC Droid DNA
2 Android HTC One
3 Android HTC One (developer edition)
4 Android HTC One (dual sim)
5 Android HTC One (Google Play Edition)
6 Android HTC One Max
Here is what the third plot above shows when you run it (please note, I'm holding cursor over the "one" node in image to illustrate...for some reason, those ones connect):

Avoid first column of data frame

I have following data frame and I want to assign each value to a bin,
title
1 MotorolaROID RAZR MAXX 4G Android Phone Black 32GBVerizon Wireless.jpg^HTC EVO 4G 1GB White Sprint Smartphone.jpg
2 MotorolaROID RAZR MAXX 4G Android Phone Black 32GBVerizon Wireless.jpg^NEW 4 0 Android 2 3 Unlocked Quad Bands GPS Bluetooth Wifi Smart Cell phone G10.jpg
3 MotorolaROID RAZR MAXX 4G Android Phone Black 32GBVerizon Wireless.jpg^Motorola Droid X2 Verizon BAD ESN GOOD Condition 100 Functional.jpg
4 MotorolaROID RAZR MAXX 4G Android Phone Black 32GBVerizon Wireless.jpg^UNLOCKED Huawei Ideos S7 Tablet Smartphone.jpg
5 MotorolaROID RAZR MAXX 4G Android Phone Black 32GBVerizon Wireless.jpg^Apple iPhone 4 16GB Black AT&T Smartphone MC318LLA .jpg
6 MotorolaROID RAZR MAXX 4G Android Phone Black 32GBVerizon Wireless.jpg^Apple iPhone 4 16GB Black Factory Unlocked Smartphone.jpg
column1 column2 column3 column4 column5 column6 column7
1 0.978 0.635 0.973 0.7619048 0.6383881 0.8339921 0.06666667
2 0.343 0.702 0.990 0.2623762 0.6150583 0.9285714 0.04166667
3 0.984 0.675 0.712 0.7056277 0.6770944 0.5612648 0.00000000
4 0.798 0.648 0.931 0.4090909 0.5864263 0.8571429 0.00000000
5 0.898 0.709 0.993 0.5000000 0.6951220 0.9328063 0.05882353
6 0.898 0.709 0.993 0.5000000 0.6951220 0.9328063 0.06250000
When I tried to run the following line I get an error Error in cut.default(newX[, i], ...) : 'x' must be numeric I know this is because my first column is the title column. How can I execute this by ignoring the first column.
df_bin <- apply(df, 2, cut, c(-Inf, seq(0.5, 1, 0.1), Inf), labels=0:7)
Apply over 'all but the first column' by excluding it via a -1 count:
df_bin <- apply(df[,-1], 2, cut, c(-Inf, seq(0.5, 1, 0.1), Inf), labels=0:7)
The key here is df[,-1] versus your df.

Can someone please explain the Golden Grid System grid to me?

I'm trying to do a responsive two column layout (content and sidebar) with the Golden Grid System grid and am having trouble understanding it. I really like the idea behind this system (no fixed-width, zoomable baseline, etc...) but don't know how to do the columns. I would like to have a sidebar and a content columns that are side-by-side on the desktop and then sidebar on top, content below on tablet/mobile. Any help is appreciated.
Creating the columns can be a little tricky when you first look at the GGS, as the example provided on the website gives a poor illustration of how to use the grid to create the columns.
The most important thing to understand about the GGS is that it's not a grid framework, it only makes suggestions of column width and such. If you've downloaded the CSS, you'll see that these suggestions are outlined in the comments.
Four-column grid active
----------------------------------------
Margin | # 1 2 3 4 | Margin
5.55555% | % 25 50 75 100 | 5.55555%
Eight-column grid active
----------------------------------------------------------------------
Margin | # 1 2 3 4 5 6 7 8 | Margin
5.55555% | % 12.5 25.0 37.5 50.0 62.5 75.0 87.5 100 | 5.55555%
Sixteen-column grid active
----------------------------------------------------------------------------------------------------------------------
Margin | # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | Margin
5.55555% | % 6.25 12.5 18.75 25.0 31.25 37.5 43.75 50.0 56.25 62.5 68.75 75.0 81.25 87.5 93.75 100 | 5.55555%
To create the grid, you need to choose which one best fit your needs. Say that you've chosen the 8-column grid, the most simple way is to build it from the first column width (12.5%) and add that to the subsequent grid columns. To make it responsive, simply wrap the appropriate column definitions in a media query that corresponds to the appropriate breakpoint.
See fiddle example: http://jsfiddle.net/ricebunny/C6QEu/12/
On the page you provided there are 4 files that you can download. I would suggest using those and adapting them.
If you only want to do a 2 column layout without a fixed width, why not create your own layout with 2 simple columns and use a percentage as the width?

Resources