Two columns layout in Quarto - text

Quarto
I am creating a website in Quarto and would like to have a two columns layout so I can nicely show text side by side. In streamlit you can use columns to get a two columns layout. Here is an example code of how to layout should look like:
---
title: "Two columns layout Quarto"
format:
html:
code-fold: true
engine: knitr
---
I would like to have text here and here
Sentence becomes longer, it should automatically stay in their column More text
Output:
As you can see the text is combined into one sentence, while I would like to have it separately like a two columns layout. So I was wondering if this is possible in Quarto?
Streamlit
Here is an example in streamlit:
# Package
import streamlit as st
# Function with columns
def txt(a, b):
col1, col2 = st.columns([7,2])
with col1:
st.markdown(a)
with col2:
st.markdown(b)
# Example
st.write('# Example in Streamlit')
txt('I would like to have text here', 'and here')
Output:
As you can see this is nicely shown in two column layout.

You can use pandoc .columns div to create column layout
---
title: "Two columns layout Quarto"
format:
html:
code-fold: true
engine: knitr
---
:::: {.columns}
::: {.column width="70%"}
I would like to have text here
Sentence becomes longer, it should automatically stay in their column
:::
::: {.column width="10%"}
<!-- empty column to create gap -->
:::
::: {.column width="20%"}
and here
More text
:::
::::

Alternatively, you could utilize the bootstrap css grid system for such kind of questions. You would not need an additional empty column to create space, you could change columns gaps easily (see here):
---
title: "Two columns layout Quarto"
format: html
engine: knitr
---
::: {.grid}
::: {.g-col-6}
## First column
I would like to have text here
Sentence becomes longer, it should automatically stay in their column
:::
::: {.g-col-6}
## Second column
and here
More text
:::
:::

Related

pdfplumber - How to extract table with no horizontal lines?

So I have a table like this one, with an unknown number of description lines. Some can have 1, 2, 5, even zero, or more lines:
(I removed all sensitive informations.)
and I use :
with pdfplumber.open("invoice.pdf") as pdf:
pages = pdf.pages
for page in pages:
page.extract_table()
which is does extract all data from the table but the second column it treats as one row.
I want somehow to split the lines of second column (or better all columns) by a small blank row, which so I put it on red rectangles to highlight it.
I know that I need to use table_settings={}, but I can't figure out ... yet, which property (ies), to use ?
What I tried:
print(page.extract_table(table_settings={
"horizontal_strategy": "text",
"snap_y_tolerance": 3,
"keep_blank_chars": True,
}))
Which, again, it splits when he wants ..
So it's possible to extract a mix-borderless table ?

How do i split the web scraped column name?

Hey I'm actually doing a web scraping analysis on pokemon data. So i have this below code:
pokemon='https://pokemondb.net//pokedex/bulbasaur'
tables = pd.read_html(requests.get(pokemon, headers={'User-agent': 'Mozilla/5.0'}).text)[-2].T
tables.columns = tables.iloc[0]
tables=tables.drop(tables.index[0])
tables
That gives me something like this:
Columns with pokemon location
Now what i want is the column to split for different games for example, RedBlue would be Red and Blue separately with the same data for RedBlue being shown for Red and blue separate columns. I think i can do that when scraping the data but I don't know how to go about it.
I'm attaching below a screenshot of the html tags related to the data. I think the Red and blue can be split as there's a '&' between them. How do I do this?
HTML tags
In this case, you should iterate per columns:
(Pdb) tables.columns
Index(['RedBlue', 'Yellow', 'GoldSilverCrystal', 'RubySapphire',
'FireRedLeafGreen', 'Emerald', 'DiamondPearlPlatinum',
'HeartGoldSoulSilver', 'BlackWhiteBlack 2White 2', 'XY',
'Omega RubyAlpha Sapphire', 'SunMoon', 'Ultra SunUltra Moon',
'Let's Go PikachuLet's Go Eevee', 'SwordShield'],
And create a special logic like:
for column in tables.columns:
if column = "RedBlue":
# create new columns
As you don't have any special character separating the strings, is difficult to create a logic for all columns

Table Format Report in Acumatica

I want to design a report in table format. I am using Panel and Line Control for now, but it's time consuming to adjust. Is there a better way to do this?
Example:
| column1 | column2 | column3 |
| aaaaa1 | sdf | sdfsdf |
| aaaaa2 | sdf | sdfsdf |
| aaaaa3 | sdf | sdfsdf |
The row background color should be alternating (gray & white).
Your question is a bit ambiguous I am going to assume you mean using the Report designer you would like to generate a report that looks like the image below.
That being said you have two different items you have to accomplish the table layout and the alternating Row color.
For the Table Layout
Unless I am missing something this is the easy part you only need to use the field controls and border settings on the controls to generate the grids. I have added a screen cap of the standard layout for the report above in the designer
For the Alternating Row Color
This is the challenge because without a little but of work it cant be done. What you have to do is using the visible expression create two sets of duplicate controls one placed directly on top of each other. I used the row number to build my expression that looked like
=IIf( $RowNumber % 2 = '0', True, False )
=IIf( $RowNumber % 2 = '0', False, True )
That divides each row number by two and if there is a remainder (Bottom equation) shows it and vise versa for the other set of controls.

String to Word Vector in R

There are 40 rows in my dataset and 3 attribute columns. Each row is a separate text document. I converted strings to separate terms using TermdocumentMatrix() function of library(tm). But this functions is treating number of attribute columns as number of documents. Why is it so? Am I making some mistake?
Is there any attribute filter in R which is similar to weka's StringToWordVector filter? I want the result to be same as weka's StringToWordVector filter
Sample is shown below :
Title, Author, BookSummary
The Da Vinci Code, Dan Brown, Louvre curator and Priory of Sion Grand Master Jacques<br>
This sample is showing just 1 row.
I tried this code :-
data<-read.csv("C:/Users/admin/Desktop/RTextMining/dataset.csv")
corpus.tmp<-Corpus(VectorSource(data))
View(corpus.tmp)
corpus.tmp<- tm_map(corpus.tmp,removePunctuation)
corpus.tmp<- tm_map(corpus.tmp, stripWhitespace)
corpus.tmp<- tm_map(corpus.tmp, tolower)
corpus.tmp<- tm_map(corpus.tmp, removeWords, stopwords("english"))
library(SnowballC)
corpus.tmp <- tm_map(corpus.tmp, stemDocument)
TDM <- TermDocumentMatrix(corpus.tmp)

Hide a column of a specific Row-Grouped Table in RDLC

I have a matrix which contains a rowgroup and groups my products based on the Category. I have three categories: Laptops, Tablets, Televisions. My first two categories contain columns i.e. RAM which I don't want to display for the Televisions. Each category is separated by a page break.
I'm trying to hide the column 'RAM' if the Category name is 'Televisions' but only for the specific page
My structure:
[Categories]
[ProductID] [Processor] [RAM] [Colour] [etc]
Desired result:
[Laptop]
[125] [Intel Pentium] [250 MB RAM] [Black] [etc]
Desired result:
[Television]
[126] [Ix TV processor] [White] [etc]
Current result:
[Television]
[126] [Intel Pentium] [need to hide this] [White] [etc]
It is possible to do. The reason you're having trouble with it is because the matrix column falls outside of the category row-grouping scope. To hide the entire column, you have to move the category group above it. The easiest way to do that is to nest your matrix inside of a list control. Put your Category grouping/page breaks at the List level, and then set your RAM column of the matrix (which is now entirely inside of the category grouping scope since it is inside the list control) visibility based on the value of the Category as follows:
=Iif(Fields!Category.Value = "Televisions",True,False)

Resources