R markdown table with a caption - r

I'm trying to create a table outside of a code chunk using normal markdown notation and to add a caption to it. Here's an example file (taken from here:
---
output: pdf_document
---
| First Header | Second Header | Third Header |
| :------------ | :-----------: | -------------------: |
| First row | Data | Very long data entry |
| Second row | **Cell** | *Cell* |
| Third row | Cell that spans across two columns ||
[Table caption, works as a reference][section-mmd-tables-table1]
This unfortunately produces a rather sad string:
Removing the caption line in square brackets produces the table fine (but without the caption, obviously):
This can be achieved if I made my data into an actual data.frame and used kable as shown here but I'm looking to avoid having to do this.

The linked guide refers to MultiMarkdown, while RMarkdown uses Pandocs. Captions work a little bit differently in Pandoc. The following should do the trick. The syntax is Table: followed by your caption; Pandocs numbers automatically. Leave one line blank between the end of the table and the caption line.
---
output: pdf_document
---
| First Header | Second Header | Third Header |
| :------------ | :-----------: | -------------------: |
| First row | Data | Very long data entry |
| Second row | **Cell** | *Cell* |
| Third row | Cell that spans across two columns ||
Table: Your Caption

Related

R line break problem; uses commas as line breaks

I have used R to remove line breaks in a csv file containing text strings in one column. However, my problem is that some rows contain multiple columns when they should just have one. After a close inspection, I have found out that these columns appear when there are some types of commas in the text.
Please note that in my original dataset there are alot of break lines within a text. For example:
"I do not like apples.
Even so they are good for your eyes."
Here my aim is to remove and join them (for some reason I can't represent this example on the table below)
This is an example of the input:
| message |
| -------- |
| I love chocolate.|
| I dislike asparagus, they are not good for me.|
This is an example of the output:
| message | |
| -------- | -------------- |
| I love chocolate | |
| I dislike asparagus | they are not good for me |
I have used the str_replace_all(x, "[\r\n]" , "") function but it does not work. Can anyone help?

Join and merge are only working partially and completely in R

I am working with a dataset that was obtained from a global environment and loaded into R. It has been saved as a CSV and is being read in R as a data frame from that CSV. This dataset (survey_df) has almost 3 million entries, I am trying to join this dataset based on a column ID (repeated multiple times since there are multiple entries per id) to what originally was a shapefile and is now loaded in R as a data frame shapefile_df . This data frame has 60,000 unique entries, each representing a geometry in a country. We expect to have many entries per geometry in most cases. I am using a simple left_join which should in theory join these two datasets together. I am running into an issue where they are not fully joining together, only some entries are. I have tried inner,fully and right join as well as merge and I keep getting the same issue. I made a full_join and a copy of the id columns to compare the ones that are not joining and I do not see any patterns. They seem to be the same id, they are not joining for some reason. I tried formatting them as.character and as.factor and yet nothing. Below I pasted a sample of the join/unjoined df.
Matched ids
| survey_df_id | survey_id_copy | shapefile_df_id
-------------- | -------------- |--------------
0901200010229 | 0901200010229 | 0901200010229
0901500010729 | 0901500010729 | 0901500010729
090050001087A | 090050001087A | 090050001087A
0900600010467 | 0900600010467 | 0900600010467
0901400010897 | 0901400010897 | 0901400010897
0901200011960 | 0901200011960 | 0901200011960
Unmatched ids
| survey_df_id | survey_id_copy | shapefile_df_id
-------------- | -------------- |--------------
01903900010480 | 01903900010480 | NA
070470001010A | NA | 070470001010A
0704700010117 | NA | 0704700010117
0704700010140 | NA | 0704700010140
0705200010672 | NA | 0705200010672
0705200010742 | NA | 0705200010742
Most of the entries that are unmatched are like the first row where shapefile_df_id is NA. However, there are a few where survey_id_copy is NA. This field is simply a mutate of survey_df_id and in theory should not be any different yet they are. Any idea what could be causing this? I suspect this is a formatting issue but as a said, using as. hasn't fixed the issue. I am using tidyverse and read.csv. Any help?

Selenium IDE, identify row in table based on 3 columns

I am trying to find a row in a table which contains specific values on three columns.
I have tried methods in #paul trmbrth's answer to find XPath to identify cell in table based on other column. Worked fine for 2 columns, but didn't worked with 3. I didn't find any example for cases with more than 2 values.
VEHICLE CATEGORY | CATEGORY | SUBCATEGORY
A | Exteriors | Badges
A | Exteriors | Badges
A | Exteriors | Mirrors
A | Interiors | Wheels
A | Interiors | Rears
Want cell with the combination that contains:
A | Exteriors | Mirrors
I have tried but no success:
//tr[contains(td[1], 'A')]/td[2][contains(., 'Exterior')] td[3][contains(., 'Mirror')]
//tr[contains(td[1], 'A')]/td[2][contains(., 'Exterior')] /td[3][contains(., 'Mirror')]
css=tr([td:contains('A')][td:contains('Exterior')][td:contains('Mirror')])
css=tr([td:contains('A')][td:contains('Exterior')][td:contains('Mirror')])
Can anyone help?
I think you have a couple of typos:
//tr[contains(td[1], '1') and contains(td[2], 'Eve') and contains(td[3], 'Jackson')]
But I'm not 100% this is most efficient, but it will work.

How to Merge two column of ASPxGridView in DevExpress?

I want to Merge and show the two column of the gridview as single column.
Example:
I have two different columns
--------------------
|Amount | Currency |
--------------------
| 1000 | INR |
--------------------
| 2000 | EUR |
--------------------
| 500 | USD |
--------------------
Result as one column
-----------
|Amount |
-----------
| 1000INR |
-----------
| 2000EUR |
-----------
| 500USD |
-----------
Two columns are seperate fields from databaes.i don't want to do it in procedure, need to be done in frontend because i want to put total for this amount column.
It sounds like you're looking for calculated columns.
Have a look at the following links:
devex unbound columns
devex calculated columns

Custom line chart - the Gap between the vertical linear axis needs to be dynamic

I am stuck up with custom line chart. I need some help to move further.
The line chart looks like this
100 |
|
|
|
|
|
| (90,x)
90 | *
|
|
|
50 |
|
10 |
|
0 ------------------------------------------
where the vertical axis, intervals needs to be variable, not evenly and the line chart should plot accordingly.
Can we achieve this ? I need some help.
i guess this what you are looking for what

Resources