ccowens
ccowens
Charley Cowens
105 posts
Fount of Profundity
Don't wanna be here? Send us removal request.
ccowens · 6 months ago
Text
“A thing is not necessarily true because a man dies for it.”
— Oscar Wilde, “The Portrait of Mr. W. H.”
264 notes · View notes
ccowens · 5 years ago
Text
Hamachi Tatsuta-Age
At Tokyo Fish Market in Berkeley, the fish counter often has different kinds of fish chunks available. One day, I decided to get some hamachi (yellowtail) chunks.
When I went online for a recipe for hamachi chunks, this was the only one, but it's only available as a video. It uses subtitles to describe the recipe, but that doesn't work for recipe apps, like CopyMeThat (which I use). Also, it's nice to have it written out too. So, in this post, I'm writing out the recipe.
Ingredients
Hamachi -- 1 lb.
Soy sauce -- 3 tbsp.
Sake -- 3 tbsp.
Mirin -- 2 tbsp.
Grated ginger -- 1 tsp.
Grated garlic -- 1 tsp.
Corn starch -- sufficient to coat hamachi pieces
Oil -- sufficient to deep fry hamachi pieces
Steps
Cut up the hamachi into bite-size chunks and toss into bowl, unless you bought it already cut up
Combine soy sauce, sake, mirin, grated ginger, and grated garlic with the hamachi and mix together well
Cover and marinate for 30 minutes in the refrigerator
Prepare to fry:
Remove each piece and lightly roll in corn starch
Heat oil to 350
Fry pieces till well browned and cooked through
7 notes · View notes
ccowens · 5 years ago
Photo
Tumblr media Tumblr media
Untangling Panhandled Data
Time for yet another R script to solve a problem that’s only relevant (or interesting) to 2 or 3 people in the world.
I’ve run into this spreadsheet format a few times that takes two related datasets and mashes them together into the same sheet for ease of manual viewing and updating. The panhandle is the parent data displayed once and the rest is child data. There can be many separate “Oklahomas” in the sheet.
How to unmash them into two tidy datasets for importing into some other system? My script and readme file is on Github at ccowens/Panhandled-Spreadsheets.
0 notes
ccowens · 7 years ago
Text
“You can dance the Macarena to anything.”
-Madison Edwards
0 notes
ccowens · 7 years ago
Text
Attention without Tension
0 notes
ccowens · 7 years ago
Text
Every breath is equal.
0 notes
ccowens · 7 years ago
Quote
dolce far niente
0 notes
ccowens · 7 years ago
Quote
“Just because people are doing extraordinary things doesn’t mean they’re not ordinary people.” ~ Laird Hamilton #dailyqotd
http://dailyqotd.com/1tFYIXn
0 notes
ccowens · 8 years ago
Photo
Tumblr media
Social media explained.
0 notes
ccowens · 8 years ago
Quote
I married a German. Every night I dress up as Poland and he invades me.
- Bette Midler (http://bit.ly/1bydCZw 23,000 Quotes)
0 notes
ccowens · 8 years ago
Quote
Here are ten things you'll hear in almost any toxic workplace:    This is how we've always done it.    That's not your decision to make.    If you can't measure it, you can't manage it.    Don't ask questions -- just do your job.    That sounds like a personal problem.    That's not our policy.    Please don't question the way we do things.    If you don't like the job, we'll hire someone who will.    You should be glad you have a job.    It's work -- it's not supposed to be fun.
Ten Things You'll Hear In A Toxic Workplace (Liz Ryan)
0 notes
ccowens · 8 years ago
Quote
No matter how rich you become, how famous or powerful, when you die the size of your funeral will still pretty much depend on the weather.
Michael Pritchard via http://www.quotationspage.com/quote/23549.html
0 notes
ccowens · 9 years ago
Quote
Do you really know the back of your hand that well?
The Great Pumpkin
0 notes
ccowens · 9 years ago
Photo
Tumblr media
4 notes · View notes
ccowens · 9 years ago
Text
Some Political Data Wrangling
I had been thinking about what a U.S. presidential election would be like if decided by a majority of the state delegations of the House of Representatives in case no majority of electors in the Electoral College votes for a President. It’s not completely clear to me whether the outgoing (“immediately��) or the incoming members (starting Jan. 3rd) vote, but I thought I’d check the current delegations by party control. I went to the Wikipedia article to check this, but didn’t find exacly what I wanted. The closest was this list of members that included columns for their district and party affiliation: Voting members by state. So I decided to do some data wrangling to get the information I need.
Getting the Data Out
I wanted to use R scripting for the main work, because it’s so handy for data wrangling, but, to get the data out initially, I figured I would just use a Firefox extension called TableTools2. Using this extension, I copied the HTML table as a tab-delimited file and saved the text into a file called congress.tsv in the same file folder as my script.
The R Script
From here, I followed these overall steps:
Make sure needed packages to extend R are loaded.
Read in the data.
Make a table with a row for each member by state and party.
Convert this to a summary table with a row for each state and with columns for counts for each party in that state delegation and for which party controls that delegation.
Print out a summary table of the counts for category of party control (Democratic, Close Democratic, Republican, Close Republican, Tied)
As I go along in the description, I’ll show a sample of current results at certain points using head and glimpse commands.
Load Packages
These are the add-on packages I used to add some non-base-R functions to use:
dplyr : select, transmute, count, glimpse
tidyr : spread
Open them, or install them and then open them.
if(!require(dplyr)) {install.packages("dplyr"); library(dplyr)} if(!require(tidyr)) {install.packages("tidyr"); library(tidyr)}
Read in the Data
I want to exclude vacant positions. It’s easier to strip out the lines that list vacant positions by making an initial pass to clean out these lines through text processing, saving out as a new file, and then reading it back in as a data frame.
read_pass_1 <- readLines("congress.tsv", warn = FALSE) read_pass_1 <- read_pass_1[!grepl("Vacant|vacant", read_pass_1)] writeLines(read_pass_1, "cleaned-congress.tsv") read_pass_2 <- read.delim("cleaned-congress.tsv")
Here’s a “glimpse” of what the data frame looks like:
## Observations: 432 ## Variables: 8 ## $ District <fctr> Alabama 1, Alabama 2, Alabama 3, Alabama 4, ... ## $ Representative <fctr> Rep Bradley Byrne.jpg Byrne, BradleyBradley ... ## $ Party <lgl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N... ## $ Party.1 <fctr> Republican, Republican, Republican, Republic... ## $ Prior.experience <fctr> Alabama Senate, Alabama State Board of Educa... ## $ Education <fctr> Duke University University of Alabama, New Y... ## $ Assumed.Office <fctr> 2013*, 2011, 2003, 1997, 2011, 2015, 2011, 1... ## $ Born.In <int> 1955, 1976, 1958, 1965, 1954, 1954, 1965, 193...
Create a Table of Current Members with Just State and Party Information
Toss out the columns we don’t need.
representatives <- select(read_pass_2, District, Party.1)
## District Party.1 ## 1 Alabama 1 Republican ## 2 Alabama 2 Republican ## 3 Alabama 3 Republican ## 4 Alabama 4 Republican ## 5 Alabama 5 Republican ## 6 Alabama 6 Republican ## 7 Alabama 7 Democratic ## 8 Alaska At Large Republican ## 9 Arizona 1 Democratic ## 10 Arizona 2 Republican
Strip out everything inside the District column, so only the bare state name remains, and rename the column State.
representatives <- transmute(representatives, State = gsub(" At Large| [0-9]+", "",representatives$District), Party = Party.1)
## State Party ## 1 Alabama Republican ## 2 Alabama Republican ## 3 Alabama Republican ## 4 Alabama Republican ## 5 Alabama Republican ## 6 Alabama Republican ## 7 Alabama Democratic ## 8 Alaska Republican ## 9 Arizona Democratic ## 10 Arizona Republican
Convert to a Summary Table of State Counts by Party
“Roll up” counts of members for each unique pairing of state and party and make a new table.
state_delegations <- as.data.frame(count(representatives, State, Party))
## State Party n ## 1 Alabama Democratic 1 ## 2 Alabama Republican 6 ## 3 Alaska Republican 1 ## 4 Arizona Democratic 4 ## 5 Arizona Republican 5 ## 6 Arkansas Republican 4
Create a table with one state per row and move the counts under separate columns for each party using the spread function from the tidyr package. I set fill = 0 to make sure the absence of a party count is recorded as a 0 in the table (instead of NAs that would complicate the arithmetic I need to do).
state_delegations <- spread(state_delegations, Party, n, fill = 0)
## State Democratic Republican ## 1 Alabama 1 6 ## 2 Alaska 0 1 ## 3 Arizona 4 5 ## 4 Arkansas 0 4 ## 5 California 39 14 ## 6 Colorado 3 4
Add a column now that determines which party controls the delegation, but first set a variable called margin that can be used to distinguish bare majorities. For example, with a margin of 2, a split of 6R/4D would be counted as close R while 7R/4D would just be counted as R for control.
margin <- 0 state_delegations$Controlled <- ifelse(state_delegations$Republican > state_delegations$Democratic + margin, "Republican", ifelse(state_delegations$Democratic > state_delegations$Republican + margin, "Democratic", ifelse(state_delegations$Democratic == state_delegations$Republican, "Split", ifelse(state_delegations$Republican > state_delegations$Democratic, "Close Republican", "Close Democratic"))))
## State Democratic Republican Controlled ## 1 Alabama 1 6 Republican ## 2 Alaska 0 1 Republican ## 3 Arizona 4 5 Republican ## 4 Arkansas 0 4 Republican ## 5 California 39 14 Democratic ## 6 Colorado 3 4 Republican
Show the Breakdown by Category of Party Control for Various Margins
Finally, use the count function to roll up summary counts by category of control. (Because the delegations number 50, you can easily convert to percentages in your head from the counts.)
as.data.frame(count(state_delegations, Controlled))
Margin = 0:
## Controlled n ## 1 Democratic 14 ## 2 Republican 33 ## 3 Split 3
Margin = 1:
## Controlled n ## 1 Close Democratic 4 ## 2 Close Republican 8 ## 3 Democratic 10 ## 4 Republican 25 ## 5 Split 3
Margin = 2:
## Controlled n ## 1 Close Democratic 8 ## 2 Close Republican 13 ## 3 Democratic 6 ## 4 Republican 20 ## 5 Split 3
Conclusion
Because of voting by State, the Republicans and thus Trump would seem to have an even greater advantage in the House in case of it deciding a Presidential election (66% of states vs. 57% of members). But, because of the relative lack of cohesion in the Republican Party and disdain for Trump, defections to Clinton are a possibility, particularly if there are enough close Republican state delegations. There are 8 Republican majorities within state delegations of just 1 member, so, If just one Republican per state were to defect, the vote would be split down the middle. There are 5 more Republican majorities within state delegations of just 2 members, so, If two members per state were to defect, the vote would go against Trump by 30 to 20.
Keep in mind, this scenario is for the current House. If Democrats pick up more seats in the House and it’s the incoming House that makes the decision, close Republican states (8 with a margin of 1 and 13 with a margin of 2) could easily be flipped via new membership without requiring defections.
0 notes
ccowens · 9 years ago
Text
How oral cultures memorize so much information
Tumblr media
Ancient Celtic bards were famous for the sheer quantity of information they could memorize. This included thousands of songs, stories, chants and poems that could take hours to recite in full.
Today we are pretty spoiled. Practically the whole of human knowledge is conveniently available at our fingertips. Why worry about memorizing something when we can simply Google it?
The answer seems pretty evident when we go into a panic after losing our smartphones!
Long before the ancient Celts, Aboriginal Australians were recording vast scores of knowledge to memory and passing it to successive generations.
Aboriginal people demonstrate that their oral traditions are not only highly detailed and complex, but they can survive – accurately – for thousands, even tens of thousands, of years. Read more.
1K notes · View notes
ccowens · 9 years ago
Text
I like these decider diagrams
For Chart Types
http://extremepresentation.typepad.com/.shared/image.html?/photos/uncategorized/choosing_a_good_chart.jpg
For Slide Types
http://extremepresentation.typepad.com/.a/6a00d8341bfd2e53ef01b8d0bfb4ec970c-pi
http://extremepresentation.typepad.com/.a/6a00d8341bfd2e53ef01b7c7364507970b-pi
0 notes