
pixel skylines
dirt enthusiast
Cosmic Funnies
Lint Roller? I Barely Know Her
let's talk about Bridgerton tea, my ask is open


titsay
Monterey Bay Aquarium
he wasn't even looking at me and he found me
Game of Thrones Daily
will byers stan first human second

JBB: An Artblog!
🪼
d e v o n
RMH

Product Placement
Alisa U Zemlji Chuda
TVSTRANGERTHINGS

seen from Germany

seen from United States

seen from United States
seen from United Kingdom
seen from United States

seen from India

seen from Colombia

seen from United Kingdom

seen from Malaysia

seen from United States

seen from India
seen from Chile
seen from Netherlands

seen from United States

seen from Belgium

seen from Singapore
seen from United States
seen from Malaysia
seen from South Africa

seen from Hong Kong SAR China
@peterwsetter

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
From Mt Evans, Colorado
Beaver Brook Trail, Windy Saddle Park, Golden, CO
Custom Font Size in `pandoc.table`s
code{white-space: pre;} pre:not([class]) { background-color: white; } if (window.hljs && document.readyState && document.readyState === "complete") { window.setTimeout(function() { hljs.initHighlighting(); }, 0); } .main-container { max-width: 940px; margin-left: auto; margin-right: auto; } code { color: inherit; background-color: rgba(0, 0, 0, 0.04); } img { max-width:100%; height: auto; } h1 { font-size: 34px; } h1.title { font-size: 38px; } h2 { font-size: 30px; } h3 { font-size: 24px; } h4 { font-size: 18px; } h5 { font-size: 16px; } h6 { font-size: 12px; } .tabbed-pane { padding-top: 12px; } button.code-folding-btn:focus { outline: none; }
$(document).ready(function () { window.buildTabsets("TOC"); });
In this post, I will describe an easy method to change the font size of individual table columns in Latex and HTML documents. I thought about this task after reading this Stack Overflow question.
I really love pander's pandoc.table function because it wraps long strings across multiple lines. Consider the following example of a grades table for a student report card.
library(pander) grades <- data.frame(Class = c('Math', 'Reading', 'CS'), Grade = c('B+', 'A-', 'C'), Comments = c('Homework held you back. Make sure you get it in on time!', 'Your final essay was very strong. One area of improvement is your supporting evidence. Remember to use at least two pieces for each of your assertions.', 'You did very well on your homework, but your quarter project did not meet all the requirements. Based on the code, it looked like you rushed through it. Please schedule a meeting with me so we can discuss this issue.')) knitr::kable(grades)
pandoc.table(grades)
When printing tables with long strings, pandoc.table has a clear advantage.
Now imagine if there was limited space for the table in your document. Perhaps, there are several other tables or graphs you want to share. One way to adjust is to change the size of the font of the entire table using a code-block like \\scriptsize.
cat('\\scriptsize') pandoc.table(grades)
The disadvantage here is that the main pieces of information, class and grade, are difficult to read. An alternative is to only apply the new formatting to the comments column. We can accomplish this by adding the code block to the string. This is similar to the implementation of the emphasize arguments in pandoc.table.
library(dplyr) grades %>% mutate(Comments = paste('\\tiny', Comments)) %>% pandoc.table
Using <font>, we can do the same for an HTML table.
grades %>% mutate(Comments = paste('<font size="1">', Comments, '</font>')) %>% pandoc.table
Class Grade Comments Math B+ Homework held you back. Make sure you get it in on time! Reading A- Your final essay was very strong. One area of improvement is your supporting evidence. Remember to use at least two pieces for each of your assertions. CS C You did very well on your homework, but your quarter project did not meet all the requirements. Based on the code, it looked like you rushed through it. Please schedule a meeting with me so we can discuss this issue.
Using Latex and HTML tags is an easy way to add custom formatting to pandoc.tables. I’m curious about using split.single.cells and split.large.cells (functions within pandoc.table) with knitr::kable in order to create Latex output with wrapped text. I’d also like to implement cell.height functionality so rows have a uniform height. Overall, it may be worth creating an ApplyFormatting function (in base-R) for more flexibility.
// add bootstrap table styles to pandoc tables $(document).ready(function () { $('tr.header').parent('thead').parent('table').addClass('table table-condensed'); }); (function () { var script = document.createElement("script"); script.type = "text/javascript"; script.src = "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"; document.getElementsByTagName("head")[0].appendChild(script); })();
Side-by-Side Tables in Rmarkdown and Latex
A major challenge I encountered in creating individualized reproducible reports is placing tables side-by-side. In this post, I will outline several approaches I found searching through Stack Overflow, then explain a new approach using Latex.
Other Approaches
Side-by-side tables can be achieved in HTML by coding a table; however, when using Knit PDF within RStudio, the HTML does not render correctly.
The first method I found used grid graphics as outlined in the vignette from gridExtra. Building a design for a table can be cumbersome, and it took me a lot of trial-and-error to come up with this custom format.
library(grid) library(gridExtra) library(gtable) CustomTable <- function(df, row.names = rownames(df), font.size = 8) { theme1 <- ttheme_minimal( core=list(fg_params=list(fontsize = font.size, hjust = 0)), colhead=list(fg_params=list(fontsize = font.size)), rowhead=list(fg_params=list(fontsize = font.size)) ) horiztonal <- replicate(nrow(df), segmentsGrob( x0 = unit(0,"npc"), y0 = unit(0,"npc"), x1 = unit(1,"npc"), y1 = unit(0,"npc"), gp = gpar(lwd = 1)), simplify = FALSE ) g <- tableGrob(df, theme = theme1, rows = row.names) g <- gtable_add_grob(g, grobs = horiztonal, t = seq_len(nrow(g)-1), b = seq_len(nrow(g)-1), l = 1, r = ncol(g)) g } my.table <- mtcars[1:5, 1:5] grid.arrange(CustomTable(my.table), CustomTable(my.table), nrow = 1)
The difficulty I ran into using this method was when I tried to place the tables on the page, especially in relation to other elements, like a pandoc.table. I was not satisfied with the results, so I decided to pursue other options.
I found the second method at StackOverflow which involves writing the tables to file then placing them in the document. While effective, it is not ideal when creating five hundred individualized reports.
Building a table with Latex
If you run print(knitr::kable(my.table, format = 'latex')) to the console, you can see the Latex syntax. Using this syntax, we can construct a container table and place our tables inside it.
In order to use Latex within a R code-block, I use cat and the chunk-option results='asis'. cat prints the code to the document and results='asis' makes sure the Latex is used in formatting the final document.
In the code below, I start by centering the table on the page with \\begin{center}. (Double \ is required to differentiate from an escape character.) Second, I create the table container and specify there will be two centered columns. \\begin{tabular}{ c c } To add a line between the tables, include a pipe when declaring the columns, like \\begin{tabular}{ c | c }. Third, I print my table using knitr::kable(my.table, format = 'latex'). Next, I separate my first column and table from the next using the &. Last, I print the second table and close out the container.
cat('\\begin{center}') cat('\\begin{tabular}{ c c }') cat('\\footnotesize') print(knitr::kable(my.table, format = 'latex')) cat('&') cat('\\footnotesize') print(knitr::kable(my.table, format = 'latex')) cat('\\end{tabular}') cat('\\end{center}')
In some cases, it is also helpful to change the font size. As explained in this Stack Exchange answer font sizes only apply to one part of the table, so it is necessary to include separate tags.
cat('\\begin{center}') cat('\\begin{tabular}{ c c }') cat('\\footnotesize') print(knitr::kable(my.table, format = 'latex')) cat('&') cat('\\footnotesize') print(knitr::kable(my.table, format = 'latex')) cat('\\end{tabular}') cat('\\end{center}')
Conclusion
Digging into the Latex allowed me to find a relatively easy, workable solution for side-by-side tables in rmarkdown documents. It also helped me understand how knitr::kable(format = 'latex') produces code, which, without too much work, would allow for creating a custom Latex table function.

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
Elk Meadow Park, Evergreen, CO
Elk, Apex Park, Golden, CO
Castle Rock Trail, Mt Falcon Park
Plymouth Creek, Deer Creek Canyon Parl
I Finished the Johns Hopkins Coursera Data Science Specialization, What Should I Do Now?
This was the first topic on episode eight of Non-Standard Deviations. Roger Peng, co-founder of the Coursera series, turned to co-host Hilary Parker for her thoughts since she works outside academia. Parker offered some good advice, but her path to data science -- a PhD in Biostatistics from Johns Hopkins -- was quite different than that of the people who enroll in the Data Science Specialization.
My stereotype of DS Specializers is that they come from a background other than computer science or statistics. They're interested in data analysis and want to make a career change. I base this stereotype partially on myself: I have a technical background, but prior to making the shift to data science, I was a K-12 teacher. Here's my advice for my fellow DS Specializers on what to do next.
1. Do analysis and post it online.
This is the most common piece of advice, and Parker talked about it on NSD, but it's worth repeating. When interviewing for positions, hiring managers want to know what you can do and, as the cliche goes, it's better to show than tell. As you go through the Specialization, for each course project, do a similar one on a different dataset or a problem you're interested in. Upload your code to Github and post your findings on a blog, Github page, or something similar.
2. Learn SQL, deepen your understanding of R, and worry about other languages later.
With all the hype around Big Data, it's easy to forget that most organizations store their data in a SQL database. Before you can do your analysis in R, you'll need get it there. Further, some organizations are unfamiliar with R, but everyone knows of SQL. I used Khan Academy, Mode's SQL School, and Stanford's online course to learn the basics. I personally grew to appreciate the elegance of relational algebra. (One thing that I missed the first time around was the WITH clause. Learn it and love it.)
It's tempting to spend time learning Python or a Big Data tool but leave those for later. Continue to master R and learn other tools when the need arises. The better you understand R, the more approaches you'll have to solving problems. Learning Python -- for data analysis -- is fairly straightforward if you know R. If you're very concerned about tackling medium-large data problems, focus on data.table. While the DSS leads you to the Hadleyverse, data.table was designed to approach medium-large data in a way dplyr wasn't.
Where to learn more R? Hadley has two great books Advanced R and R Packages. The former includes a fair amount of review but will deepen your understanding of R. The latter provides a good introduction to a powerful tool; packages allow not only the sharing of functions but also data. DSS provides a good introduction to ggplot2, but make sure you feel comfortable building graphs; high-quality visuals will always be in demand.
While there is a lot of redundancy, #rstats on Twitter offers many great links and the opportunity to interact with the R community. Similarly, Stack Overflow is a great resource to read through regularly. I often find problems I didn't know I had, and it's an opportunity to compare how you would approach a problem with those of others.
3. Look to apply what you learn do your current position or field.
When I first applied to data science positions, most of my interviews were with organizations in my field. When considering candidates, hiring managers ask: does this person have the skills to complete the job, and does this person understand and care about the problems they'll be working on? While organizations require a certain foundational skills, they'll often be willing to train someone who is invested in the problem. These people are more likely to stay with the organization and work harder, which, generally, comes off better in terms of both opportunity and real costs.
4. Be realistic about that first job.
A crucial point made by Peng in NSD was that if all the positions you really want require a PhD, your next step should be to get a PhD. When I lurked r/machinelearning, many of the posts were questions by people wanting to know how they could land a job where they'd get to apply their favorite algorithm. Realize that your first job will probably be working on "simpler" problems; however, "simpler" doesn't mean unimportant. When I took my first position, I realized there was a big need for reproducible reports. Too many of the reports, at all levels, required too much time and effort to generate. Using R and R Markdown I was able to create reports that contained much more information and could be re-run on a moments notice. There are often many opportunities for this type of work: using R to make things run quicker and look better. Focus on those in order to sharpen skills and gain trust within your organization. From there other opportunities will open up.

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
Introduction to Individualized Reproducible Reports with R & R Markdown
<!DOCTYPE html> code{white-space: pre;} pre:not([class]) { background-color: white; } if (window.hljs && document.readyState && document.readyState === "complete") { window.setTimeout(function() { hljs.initHighlighting(); }, 0); }
The Problem and Possible Solutions
Problem Need to combine information from multiple data sources to create individualized reports for hundreds, or even thousands, of recipients. Further, these reports need to be created weekly.
In my version of the problem, my schools wanted weekly progress reports that included academic and behavior data. Some schools also wanted information on attendance, independent reading, and/or community service.
Mail Merge Solution Download or collect the data in a spreadsheet, and use Microsoft Word's Mail Merge functionality. The template is very easy to customize, but the data must be in wide format and data manipulation is often done by hand.
Visual Basic Solution Download or collect data in one spreadsheet. Write a VBA macro that tidies and transforms the data. This automates the process but is oftentimes very slow.
My predecessor used this solution. It took ~20 minutes to create 400 progress reports that only included academic data.
R and R Markdown Solution Write a R Markdown document that utilizes the power of R to get and clean data and the formatting options of Latex and HTML.
Depending on the report, I retrieve data from a database (RODBC), a GoogleSheet (googlesheets) , and even an Excel file in a shared folder (xlsx or openxlsx) . I replaced the VBA-generated progress report from above with a R Markdown-generated report that also included behavior information and a graph of words read, and the time to generate this report was still under a minute. Further, the entire process was automated. Rather than needing to write the results of a query to a file, then copy this data into the Excel file with the macro, I just opened the R Markdown file and clicked Knit PDF.
The YAML Header
The YAML header includes several of the key elements of your report template. My basic header is:
header-includes: \pagestyle{empty} \usepackage{wallpaper} \LRCornerWallPaper{1}{path/to/image} \URCornerWallPaper{1}{path/to/image} \usepackage{geometry} \geometry{tmargin=1.5in} output: pdf_document
By default, R Markdown documents number their pages. \pagestyle{empty} removes page numbers from all but the first page, which I typically use as a title page with summary information.
The wallpaper Latex package allows you to add header and footer images in the upper-right (UR), lower-right (LR), upper-left (LR), and lower-left (LL). The number inside of the {} is the scaling of the image. On Windows, I experienced the problem of the image being placed directly in the corner of the page with no margin. A work-around is adding white-space to the image.
Depending on the size of your header image, you may need to adjust the margins before the content of the document starts. The geometry Latex package allows you to make these adjustments. ShareLatex provides a good overview of the available options.
I always output to PDF. In general, the formatting turns out cleaner compared to generating Word documents. The Latex used in this document will not render if the output is HTML.
Key R Code Elements
Within your R code the first step is to pull or create a list of individuals who will receive the reports. I approach this problem by pulling a list of distinct ID numbers along with their name and other basic information like adviser and grade. For clarity, I isolate the getting and cleaning of data in the first code block and put the document-creating code in the second block.
For the document-creating code, block options should include at least
{r, echo = FALSE, results = 'asis'}
The asis option allows output to be formatted as normal text rather than R output.
The first line of code provides a way to iterate through your list.
for (i in seq_along(recipients)) {
Inside your for loop, include code for displaying the information in the report. For lines of text, use cat. print should only be used with tables.
library(knitr) name <- 'R Markdown' df <- head(mtcars[1:5]) cat(name, 'is the best!\n\n')
R Markdown is the best!
cat(kable(df))
mpg cyl disp hp drat ------------------ ----- ---- ----- ---- ----- Mazda RX4 21.0 6 160 110 3.90 Mazda RX4 Wag 21.0 6 160 110 3.90 Datsun 710 22.8 4 108 93 3.85 Hornet 4 Drive 21.4 6 258 110 3.08 Hornet Sportabout 18.7 8 360 175 3.15 Valiant 18.1 6 225 105 2.76
# Using the following will throw an error # print(name, 'is the best!\n\n') print(kable(df))
mpg cyl disp hp drat Mazda RX4 21.0 6 160 110 3.90 Mazda RX4 Wag 21.0 6 160 110 3.90 Datsun 710 22.8 4 108 93 3.85 Hornet 4 Drive 21.4 6 258 110 3.08 Hornet Sportabout 18.7 8 360 175 3.15 Valiant 18.1 6 225 105 2.76
Notice that for printed lines, is it necessary to include \n\n to ensure line-breaks, just like when writing in typical Markdown.
Not all tables require print, such as pandoc.table from the pander package or xtable. pandoc.table is particularly useful if you have long text columns, because you can set the cell width.
At the bottom of your code block but inside your for loop, include the page break. cat('\n\n\\pagebreak\n')
This is the first example of needing to include \\. Like with regular expressions, without the extra \, R will think \p as an escape character.
Other Useful Code Elements
Three other building blocks I use often are the section header
cat('\\section*{Name of section}\n\n')
centered text
cat('\\centerline{Centered Text}\n\n')
and a horizontal line
cat('\n\n------\n\n').
If you have multiple graphs and would like to display them side-by-side, rather than the default one graph per line, I suggest grid.arrange from gridExtra. It is also possible to group more than two graphs. This allows you to set the fig.height and fig.width for the entire grouping, helpful if you need to fit all the graphs on a single page.
library(ggplot2) library(gridExtra) a <- rnorm(100, 50) b <- rpois(100, 1) x <- rbinom(100, 1, 0.5) y <- runif(100, 0, 100) p1 <- qplot(a, b) p2 <- qplot(x, y) p3 <- qplot(x, a) p4 <- qplot(b, y) grid.arrange(p1, p2, p3, p4)
// add bootstrap table styles to pandoc tables $(document).ready(function () { $('tr.header').parent('thead').parent('table').addClass('table table-condensed'); }); (function () { var script = document.createElement("script"); script.type = "text/javascript"; script.src = "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"; document.getElementsByTagName("head")[0].appendChild(script); })();
If you’re a Dodgers fan, you may want to try it at a little league game. (via)
In general, value-added models use statistical formulas to generate estimates of how much a particular school or classroom teacher contributed to student learning, as measured by standardized-test scores. Tennessee’s version is known as TVAAS. It is included as one factor in a teacher-evaluation system that was rolled out, somewhat bumpily, in the 2011-12 school year. Under state rules, a teacher with five or fewer tested students is graded on a “schoolwide” measure, based on the progress of all students in the school. Those teachers with six or more tested pupils receive an individual value-added estimate based on those students’ progress. In the case of plaintiff Mark Taylor, an 8th grade science teacher, the value-added score was based on just the 22 students in his regular science class. They represented fewer than 16 percent of the total number of students he instructs, because he also has four sections of students who take an advanced course that does not conclude with a standardized exam. The union says that the state has “no rational basis” for basing the measurement on only a fraction of a teacher’s students, and that the “arbitrary and irrational” categorization of teachers into groups with different evaluation rules violates teachers’ due-process and equal-protection rights under the U.S. Constitution. In an interesting wrinkle, the lawsuit cites as evidence comments made by the developer of TVAAS, the North Carolina-based researcher William Sanders. Mr. Taylor’s parents were apparently acquainted with Mr. Sanders through Sunday school classes, and queried him by email whether TVAAS results based on one course were appropriate to use for evaluation purposes. “For an overall evaluation of the effectiveness of the teacher to facilitate student academic progress, of course not,” Mr. Sanders replied, according to copies appended to the complaint.
Tenn. Teachers’ Union Takes Evaluation Fight Into the Courtroom - Education Week
Let me emphasize this part: “For an overall evaluation of the effectiveness of the teacher to facilitate student academic progress, of course not,” Mr. Sanders replied, according to copies appended to the complaint.”
OF COURSE NOT!!!!!!!!!
(via positivelypersistentteach)
Standardized tests scores in Shelby County, TN, are 50% of our evaluation: 35% growth and 15% achievement. 40% are based on observations, 5% "professionalism" (A portfolio summarizing: leadership, professional development, data-driven instruction, & community partnerships), and 5% student perceptions.
From my point-of-view, this mix is fair. My observations accurately capture my teaching on a day-to-day level. The state end-of-course exam is a stand-in for a final exam. I'm personally looking forward to EOC's being replaced by CCSS and NGSS based exams, since the current standards and format are low-rigor.
What I find unfair about this situation is not that test scores are used, but that an evaluation of his other students' learning is not being made. If there is no state or national exam, he should be evaluated on a portfolio. Fine Arts teachers in Shelby County are evaluated in this way.
The coolest part of this article is how a fourteen year old can share research in a peer reviewed journal, not to mention teenagers developing ideas that can literally save millions of dollars.
Dept. of Education finds pattern of inequality by race
The Department of Education published a report that shows sweeping patterns of disparity by race in public schools across the country, including fewer advanced classes available to students of color and a disproportionately high percentage of suspensions.

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
Would you want to be a learner in your own classroom?
To use Yeshuyahu Leibowitz’s somewhat provocative, if polemical, locution, if there is an Israeli law prohibiting driving on the Sabbath is it not the case that driving on the Sabbath is no longer a religious transgression but a traffic violation? Leibowitz advocated the privatization of religion in Israel not to protect the secular state from religion but to protect religion from the secular state. For Leibowitz, and perhaps for Assad, there is a need to maintain the secular as a space that enables religion to function at all— if we lose the secular, we secularize religion.
Shaul Magid
Modern Judaism
Vol. 29, No. 1, Abraham Joshua Heschel, a Centenary Conference (Feb., 2009), pp. 138-160