y = x + 3
function f turns x into x + 3
we apply function f by saying f(something)
f = function (x) { return(x + 3) }
```python | |
import matplotlib.pyplot as plt | |
from matplotlib import colors | |
import numpy as np | |
def make_forest( height, width, density ): | |
''' | |
This function will take in a width, height, and density specified by the user and use those values | |
to generate a forest (2-d numpy array) matching those characteristics. A 0 will represent an empty | |
space, a 1 will represent a tree |
# Early in the script | |
pkgs_pre_script <- try(devtools::loaded_packages(), silent = TRUE) | |
# Late in the script | |
pkgs_used_during_script <- try(devtools::loaded_packages(), silent = TRUE) | |
cat("* ") | |
print(citation(), style="text") # or Bibtex or LaTeX |
sudo rm -rf /Library/Frameworks/R.framework \ | |
/Applications/R.app \ | |
/usr/bin/R /usr/bin/Rscript | |
pkgutil --regexp --forget org\.r-project* |
%matplotlib inline | |
try: | |
import seaborn as sns | |
print('seaborn is already installed') | |
except: | |
try: | |
import sys | |
sys.path | |
sys.path.insert(0,'./packages') |
import pandas as pd | |
import seaborn as sns | |
flint_data = pd.DataFrame.from_csv( | |
'https://raw.githubusercontent.com/ComputationalModeling/intro-to-computational-modeling/master/201-spring-2017/day05-flint-water-data-analysis-day1/flint_data_with_simplified_column_names.csv?token=AAUJNLxtLQZh8meM0qSXyn4U1REp-PLAks5Ym3SjwA%3D%3D' | |
) | |
sns.distplot(flint_data['zipCode']) |
const parseRecord = function (rawRecord) { | |
// Parsing logic goes here | |
} | |
const fs = require('fs') | |
const records = fs.readFileSync('myBibfile.bib') | |
.split('@') // @ is the delimiter in bibfiles | |
// Array.from() takes an iterable argument *and* a mapping function | |
// if you want to map elements from the source array |
y = x + 3
function f turns x into x + 3
we apply function f by saying f(something)
f = function (x) { return(x + 3) }