Is it possible to prevent breaking rows when auto-paging with tables in pptxgenjs?
Right now when I have a table with autopaging:true like this
N
A header
1
First
2
Second a very long text
3
Third very very very very very long text
The page breaks like this:
Slide 1
N
A header
1
First
2
Second a very long text
3
Third very very very
Slide 2
N
A header
3
very very long text
Result I like to have instead:
Slide 1
N
A header
1
First
2
Second a very long text
Slide 2
N
A header
3
Third very very very very very long text
Related
I have previously asked for a method to split a string each 3 characters and save the results in a dataframe. Now I want to do the same thing but instead in a sliding window of size n.
This question differs from the marked duplicate one as the results here should be outputed in a dataframe. The mapply function given would require quite some extra work to combine it in a new dataframe and to add the positions as column names as explained at the top of my previous question .
Example data
df <- data.frame(id = 1:2, seq = c('ABCDEF', 'XYZZZY'))
Looks like this:
id seq
1 1 ABCDEF
2 2 XYZZZY
Splitting on every third character with a window size of n = 1
id 1 2 3 4
1 ABC BCD CDE DEF
2 XYZ YZZ ZZZ ZZY
I tried to do this using the seperate function as answered on my previous post however as far as I can find this can only split on fixed split points rather than on a range.
I'm new to stack overflow. I'm sorry if the title is not comprehensible. I'll try to do a better job next time.
I have a data frame with duplicate values in the first column but the last column in their respective rows rows differ(few are blank and other might have some value in them). I have been trying to eliminate the duplicate with blank field in last column but every time I use 'duplicated()' or 'unique()' function, I'm only left with the row with blank field. This is possibly happening because the rows are sorted in such a way that the blank field is above the row which has a value in last column.
For example,
Input:
*No. per hmm qty*
1 BARBIE123 new 1
2 AYLIK32 * N/A* 1
3 AYLIK32 new 1
4 BARB mid 1
Output I keep getting:
*No. per hmm qty*
1 BARBIE new 1
2 AYLIK * N/A* 1
4 BARB mid 1
Desired output:
*No. per hmm qty*
1 BARBIE new 1
3 AYLIK new 1
4 BARB mid 1
Is there a way I could specify which row to keep and which row to remove?
Appreciate all the help. Kindly let me know if the question is not comprehensible. Thanks in advance.
Hm, unsure if this is what you want. This will remove all rows with a NA.
df <- df[complete.cases(df), ]
Lets say you have NAs in other columns and you dont want those taken into account. To only look at NAs in a single column, use this:
df <- df[complete.cases(df[,3]), ]
Where 3 is the # of the column you want to look for NAs in.
Maybe this will work for you
df <- read.table(text="No. per hmm qty*
1 BARBIE123 new 1
2 AYLIK32 N/A 1
3 AYLIK32 new 1
4 BARB mid 1", header=TRUE, stringsAsFactors=FALSE)
library(dplyr)
df %>%
filter(!duplicated(per, fromLast=TRUE))
# No. per hmm qty.
# 1 1 BARBIE123 new 1
# 2 3 AYLIK32 new 1
# 3 4 BARB mid 1
I have a dynamic list of items which I would like to display. I would like them to fill the first row of a grid adding columns as needed until the row fits the container. Next, it should fill the second row, then fill the third row, etc. I don't care about the order but it would be nice to have the items displayed from top to bottom, column by column like so:
1 4
2 5
3 6
The parent container doesn't have a fixed height. Here's what it should look like:
This works, but I have to specify the number of rows explicitly. Is there a way to do this without explicitly specifying rows / columns?
Codepen
Here's the order I want the grid to fill up in:
First:
1 2 3 4 |
Next (no more room on first row):
1 3 5 7 |
2 4 6 8 |
Next (no more room on second row):
1 4 7 10 |
2 5 8 11 |
3 6 9 12 |
I don't believe your desired layout is possible with CSS Grid alone.
As I see it, you want grid-auto-flow: row working until the columns fill the first row. At that point, you want to switch to grid-auto-flow: column.
Even if that adjustment could be scripted in, I'm not sure it would work without setting explicit heights or rows on the container.
I have data file of the form:
unimportant1 unimportant2 unimportant3 matrixdata[i]
1e4 2e5 3e2 1 2 3 4 5
2e3 1e1 7e3 5 4 3 2 1
... ... ... ...
2e3 1e4 4e2 4 4 4 4 4
So it has columnheaders (here "unimportant1" to "unimportant3") as the first row. I want gnuplot to ignore these first three unimportant columns columns so the data entries in exponential notation. I want gnuplot to plot the matrixdata as a matrix. So as if I did it like this:
#!/usr/bin/gnuplot -p
plot '-' matrix with image
1 2 3 4 5
5 4 3 2 1
...
4 4 4 4 4
e
How do I get gnuplot to ignore the first three columns and the header row and plot the rest as matrix image? For compatibility, I would prefere a gnuplot built-in to do that, but I could write a shell script and use the `plot '< ...' syntax preprocessing the data file.
Edit: So neuhaus' answer almost solved it. The only thing I'm missing is, how to ignore the first row (line) with the text header data. Every seems to expect numeric data and so the whole plot fails as it's not a matrix. I don't want to comment out the fist line, as I'm using the unimportant data sets for other 2D plots that, in turn, use the header data.
So how do I skip a row in a matrix plot that already uses every to skip columns?
When using matrix gnuplot must first parse the data file before it can skip rows and columns. Now, your first row evaluates to four invalid number, the second row has 8 number and I get an error that Matrix does not represent a grid.
If you don't want to comment out the first line or skip it with an external tool like < tail -n +2 matrix.dat, then you could change it to contain some dummy strings like
unimportant1 unimportant2 unimportant3 matrixdata[i] B C D E
1e4 2e5 3e2 1 2 3 4 5
2e3 1e1 7e3 5 4 3 2 1
... ... ... ...
2e3 1e4 4e2 4 4 4 4 4
Now your first row has as many entries as the other rows, and you can plot this file with
plot 'test.txt' matrix every ::3:1 with image
This still gives you a warning: matrix contains missing or undefined values, but you don't need to care.
I'm not familiar with matrix plots, but I got some sample data and
plot 'matrix.dat' matrix every ::3 with image
seems to do the trick.
You could probably use shell commands, for instance, the following skips the first six lines of a file:
plot '<tail -n +7 terrain0.dem' matrix with image
I was trying to solve a programming problem and got stuck because I couldn't understand one of the examples which goes as follows,
We guess a four digit number and the guess is "1234" . The hints given for this guess are,
Each of the digits is not in it's right place (as per correct answer). That is , 1 is not in position 1, 2 is not in position 2, 3 is not in position 3 and 4 is not in position 4.
The 4 digit correct answer contains the digits 1,2,3,4.
The example gave the number of possible combinations of four digit numbers based on above constraints to be 9.
{2143,2341,2413,3142,3412,3421,4123,4312,4321}
I tried to approach the problem this way:
approach1 :
(Total # of combinations which is 4!) - (( Combinations which start with 1 in position 1 + Combinations with 2 in position 2 + Combinations with 3 in position 3 + Combinations with 4 in position 4)) but Couldn't get to a solution for second part of the above formula.. as Combinations which start with 1 in position 1 will be 3!- (combination which start with 2 in position 2).. and so on and I wasn't able to proceed on writing the number of combinations).
approach2:
(1 can be in 3 positions) * (2 can be in 3 or 2 positions based on where 1 is placed) * (3 can be in 1 or 2 positions based on where 2 is place)*(1 position for 4) -- Again not clear on how to find the # of positions for 2,3,4.
Please help me understand how to approach this problem
So our hint is: n1n2n3n4, use all of 1234 exactly once.
1) There are three places we can put 1 in, leaving us with _1n3n4, _n21n4 and _n2n31.
2) For each of those three places, there is one number that can go in three different places - we can either place it in another denied space (3*2) or in the first space (3*1).
3a) If we put it in another denied space, the final pair of numbers has only one orientation it can be in (6*1).
3b) If we put it in the free space, the final pair of numbers has only one orientation it can be in (3*1)
So there are 9 possibilities:
_1__
2143
4123
3142
__1_
3412
4312
2413
___1
4321
3421
2341
A second way to think of it is like this:
There are 4! = 24 possible permutations.
6 positions have 1 in position 1 (3! ways to arrange the remaining three)
4 positions have 2 in position 2 but DON'T have 1 in position 1 (3! ways to arrange the remaining three, subtract the two cases where 1 is in 1)
3 positions have 3 in position 3 but DON'T have 1 in position 1 OR 2 in position 2 (3! ways to arrange the remaining three, subtract the one case of 12, subtract the one case of 1x remaining, subtract the one case of x2 remaining)
2 positions have 4 in position 4 but DON'T have 1 in 1 OR 2 in 2 OR 3 in 3 (3! ways to arrange them, subtract 2 with 1 in the start, from the remaining subtract 2 with 2 in the middle)
24-15 = 9
It doesn't matter which one is set but how many positions are set. Everytime you set a position, your choice is decremented by 1.
Now, if you're asking how to program it, then we should choose a language first.