If you want to know how many lines of code are in an Rmd file:
rmarkdown::render("file.Rmd", output_format = "md_document")
cat file.md | grep -c '^ \{4\}'
And then how many lines of code in .R files:
If you want to know how many lines of code are in an Rmd file:
rmarkdown::render("file.Rmd", output_format = "md_document")
cat file.md | grep -c '^ \{4\}'
And then how many lines of code in .R files:
| strip_glm <- function(cm) { | |
| cm$y = c() | |
| cm$model = c() | |
| cm$residuals = c() | |
| cm$fitted.values = c() | |
| cm$effects = c() | |
| cm$qr$qr = c() | |
| cm$linear.predictors = c() | |
| cm$weights = c() |
| #!/usr/bin/env bash | |
| # Configuration | |
| # The remote target branch name needs to be | |
| # 1. DIFFERENT from the local development branch | |
| # 2. Set as the default branch name on GitHub | |
| remote_target_branch=master | |
| generated_contents_dir=_site | |
| get-working-branch() { |
| <script language="JavaScript"> | |
| $(function() { | |
| /* Lets the user click on the images to view them in full resolution. */ | |
| $("div.figure img").wrap(function() { | |
| var link = $('<a/>'); | |
| link.attr('href', $(this).attr('src')); | |
| link.attr('title', $(this).attr('alt')); | |
| link.attr('target', '_blank'); | |
| return link; | |
| }); |
| #!/usr/bin/env python3 | |
| import csv | |
| import time | |
| import tweepy | |
| import datetime | |
| # Read http://docs.tweepy.org/en/v3.5.0/auth_tutorial.html to fill in the two lines below. | |
| auth = tweepy.OAuthHandler('XXX', 'YYY') | |
| auth.set_access_token('123', '456') |
| # Try-out of Hastie, Tibshirani, & Friedman (ESL, 2009) p.659 | |
| # Generate high-dimensional dataset | |
| beta <- -100:100/100 | |
| X <- matrix(rnorm(100*201), 100) | |
| y <- X%*%beta + rnorm(100, 0, sqrt(crossprod(beta))) | |
| # Ridge estimates | |
| bhat_ridge <- solve(crossprod(X) + diag(rep(.1, 201)), crossprod(X, y)) |
| #' Function to partition unequal sized groups into shards of similar size. | |
| #' | |
| #' Based on the greedy algorithm described in [The Wikipedia article on the | |
| #' the partitioning problem](https://en.wikipedia.org/wiki/Partition_problem#The_greedy_algorithm) | |
| #' | |
| #' @param groups_vector An integer vector of group ids, such as a group ID | |
| #' column in a data frame | |
| #' @param n_shards The number of shards to split groups up into | |
| #' @examples | |
| #' n_groups <- 200 |
| walk_source <- function( | |
| file = NULL, | |
| delay = 1.5, | |
| clear_each_cmd = TRUE, | |
| style = styler::tidyverse_style | |
| ) { | |
| options("walk_source_cancel" = FALSE) | |
| if (is.null(file)) { | |
| txt <- rstudioapi::getSourceEditorContext()$contents | |
| } else { |