#justgettingstarted
Check out the progress on my website!
www.francescafiore.com
Built from scratch with a lot more to come.
h
🪼
let's talk about Bridgerton tea, my ask is open
d e v o n
KIROKAZE
The Stonewall Inn

if i look back, i am lost
Cosimo Galluzzi
🩵 avery cochrane 🩵

Game Changer & Make Some Noise
One Nice Bug Per Day

Product Placement
cherry valley forever
Keni
macklin celebrini has autism
tumblr dot com
noise dept.

shark vs the universe
Sweet Seals For You, Always
art blog(derogatory)
seen from Poland
seen from United States
seen from Italy

seen from Colombia

seen from Malaysia

seen from United States

seen from United States

seen from United States

seen from Russia
seen from United Kingdom

seen from Egypt
seen from United States

seen from Malaysia
seen from T1
seen from Russia
seen from Bolivia
seen from United States
seen from Brazil
seen from United States

seen from Armenia
@francescalearnstocode-blog
#justgettingstarted
Check out the progress on my website!
www.francescafiore.com
Built from scratch with a lot more to come.
I am Learning HTML
www.francescafiore.com
Yay!
Picante
You can learn more about the Picante package here.
5 Introductory Tools to Programming
Have you been toying with the idea of learning how to program but don’t know how to get started? Check out these introductory tools to help you begin to think like a programmer. Figure out how a computer works, instruct computers to performs tasks, create your first game, and more.
Scratch: One of the easiest ways to get started with programming is to remix someone else’s already existing program. Remix a project using this free programming language called Scratch. You can build games, animations, music videos, and more.
Minecraft: Use blocks to build just about anything you can imagine in a virtual world. Discover engineering concepts, architecture, mathematics, as well as critical thinking skills and teamwork.
Develop a Game: Get started on building out the code, artwork, and music for a video game. These tools will help you build an interactive experience.
Remix a Website: Never seen the insides of a website? Use Hackasaurus to hack your favorite website to have it look and do whatever you want.
Run a Node.js Server: With Node.js, you can mimic the back and forth request/response your browser sends to servers when you visit a website. Set up your first development environment.
All the PCH Symbols
Over these last few weeks, I put in what felt like a thousand hours at the office, planned my wedding, took a weekend trip to London, and otherwise existed in a state of varying degrees of exhaustion.
I spent whatever spare energy I had thinking about this burning question: How did the person who came up with that initial valentine from last month know that pch = 169 made a heart symbol when font = 5?
I am totally not kidding.
If I had actually read through the post and tried looking at help(points), I would have gotten part way through to an answer.
But I'm glad I didn't because I like my solution better.
So first, I randomly tried plotting points with different pch values and font = 5. 255 worked, but I got this message at 256:
In plot.xy(xy.coords(x, y), type = type, ...) : pch value '256' is invalid in this locale
I got the same error for higher values and then confirmed here and elsewhere that 255 is the maximum value.
I decided to plot each value so that I could compare it to an actual set of coordinates. Since the square root of 255 is almost 16, I decided on xlim = c(0,15) and slim = c(0,15).
And I ended up writing this:
plot.new() plot.window(xlim=c(0,15),ylim=c(0,15)) axis(1) axis(2) for (i in 0:15) for (j in seq(1:15)) {points(data.frame(0,i),pch=i,font=5,cex=1,col="blue") points(data.frame(j,i),pch=i+j*16,font=5,cex=1.5,col="blue")}
And it seemed to work, but two things bothered me:
1. It wasn't clear without having to do some math which symbol was associated with which pch value from the coordinates alone. This was one of my issues with the sample code displayed in help(points).
2. It didn't make sense why I needed the first statement inside the for-loop. However, when I ran it without, I didn't get any output for x=0.
The first issue was solved by changing the calculations to pch=i*10+j, but I needed some help to figure out how to fix the second issue:
You can read more about you can read more about colon operators and sequence generation here and here.
And so long story short, with:
plot.new() plot.window(xlim=c(0,26),ylim=c(0,10)) title(main="pch symbols for font = 5",xlab="(in tens)") mtext("for example, pch169 = (16,9)") axis(1) axis(2) for (i in 0:25) {for (j in 0:9) points(data.frame(i,j),pch=i*10+j,font=5,cex=1.5,col="blue")}
I now have all of the pch symbols for font = 5 in an easy to read, easy to understand plot.
You're welcome.
Heart Loops
I loved art class when I was in high school, and my favorite assignments had to do with this technique called stippling, which is basically drawing with dots. I would sit there for hours with my pen in hand, making dot after dot after dot after dot until I had just the right shading in my rendition of the pieces of fruit on the table, or the leaves of the plant in my parents' living room, or whatever.
I must have been either a really bored or a really patient teenager, because plotting the smaller hearts in my valentine (which, by the way, was a TOTAL! AWESOME! SUCCESS!) felt like the exact same process. After five minutes, I was on the verge of tears plotting each heart one by one trying to get the pattern and size and color right.
Here's what the code looked like:
And then I started thinking about what it would be like if I wanted to put hundreds or thousands of hearts (you can never have too many hearts or too much love in your life), and the idea of doing this all one by one started to get me seriously annoyed, so I started writing something like this:
It was better, and at first I thought it wouldn't be such a big deal to just copy and edit each of the lines as needed.
But after copying and editing for the fifth or sixth time, I started getting annoyed and frustrated again.
And as I'm coming to see, annoyance and frustration are really excellent motivations to learn new things. Today, I learned about for-loops.
And with this:
plot.new() plot.window(xlim=c(0,500),ylim=c(0,500)) axis(1) axis(2) var1 <- c(0:50) for (i in 0:25) {points(data.frame(i*20,var1*20),pch=169,font=5,cex=1,col="red") points(data.frame(i*20,var1*20+10),pch=169,font=5,cex=1.5,col="blue")} for(i in 0:25) {points(data.frame(i*20+10,var1*20),pch=169,font=5,cex=1.5,col="blue") points(data.frame(i*20+10,var1*20+10),pch=169,font=5,cex=1,col="red")}
I made this:
I don't even want to know what it'd be like to have done this a week ago.
Valentine
Me: I haven’t forgotten your challenge. I’m totally getting back on it.
My BF: What challenge?
That’s right. It’s been so long since I’ve touched this sort of thing that my boyfriend, who is now my fiancé (!!), forgot the very challenge he issued in the first place.
Oh, and by the way, that conversation happened like the day after New Year’s.
And then last week, two things happened:
1. I realized that Valentine’s Day was fast approaching. I love a good, handmade valentine, but I was drawing a blank on ideas for something awesome, so I started to panic.
2. Someone at work asked me how things were going with my R learning. Clearly, I didn’t have a good answer, so I just stared down at the floor in shame.
And then the inspiration hit. I was going to make a valentine using R.
I searched for something like “Make a Valentine Using R Code” and eventually got to this post on Stack Overflow with code for making a pink heart surrounded by four smaller hearts.
Before I could even copy the code and make it, I had to relearn everything I had forgotten over these last few months, meaning that I had to go back and relearn pretty much everything I had learned to begin with. How to run R in Aquamacs. How to set my working directory. How to call a function. It was really quite sad.
But I had true love and Stack Overflow on my side and would be neither discouraged nor defeated.
And when that pink heart surrounded by those four tiny hearts finally popped up on my screen, I jumped out of my seat with joy.
And then I sat down immediately and decided that that shade of pink really wasn’t going to work. So I looked up how to change colors and decided on palevioletred3.
And I didn’t like that black border around the big heart, so I changed it to match the fill.
And then I decided that those four tiny hearts were kind of puny, so I tried to make them bigger. When changing font=5 to font=2 or font=10 didn’t work, I looked up how to change font size, learned about cex and went from there.
And then I decided that the valentine needed more than just four hearts. It needed LOTS more. Different sizes and colors of hearts in some cool pattern. By that point, I knew enough to plot them completely on my own.
After that, there was no stopping me.
I didn’t like the axes, so I figured out how to take them out, except for the x axes, which I relabeled appropriately.
I decided to add a text box, something that said “I love you” or “Happy Valentine’s Day.”
And then I decided that within the text box, there should be some reference to that initial challenge.
The basis of the challenge, in case you need a memory refresher, was a .csv file containing all of our iMessages over some period of time.
I decided that I was going to insert the number of times I had written “I love you” into that text box. (aaawwww)
So I learned about str_count and boolean operators, and when I tried
love <- sum(str_count(valentine,”I love you”))
and got some error message, I looked it up and learned a little bit about atomic vectors.
And when I decided I wanted the last line italicized, and I realized why changing the font to a different number earlier with the hearts didn’t do what I thought it would.
Everything finally worked (I think), and the valentine looked exactly the way I had hoped.
May your Valentine’s Day be filled with many new things to learn. And maybe some love too.
Starting Challenge Part 2 at 10:30 PM When You Have To Be Up Early for a Conference Is A Bad Idea
Just don't do it.
Especially when you are also one of the first presenters at said conference.
Double especially when you know that Challenge Part 2 was not meant to be easy.
I got this far.
And then things froze. Twice, actually.
Worst. Idea. Ever.
I haven't even eaten dinner yet.
Part 1 of the Challenge Solved Three Ways
A few hours ago, I solved the first part of my boyfriend's challenge. It was super easy, and I did it in like two minutes by typing these commands.
> imessage <- read.csv("imessage.csv") > summary(imessage)
The most common message was "Yes" followed by "Yes."
Clearly, we are in total agreement about all things always.
So then I wanted to do it write the commands in a text file called "challenge1.R" and execute them. However, running
> source("challenge1.R")
did not produce anything on the screen. I was soon reminded of the importance of the print function in these situations.
And so I wrote
imessage <- read.csv("imessage.csv"); print(summary(imessage))
and it ran perfectly. Which was awesome.
Then I tried to write something that could be run for any file.
summarize_x <- function(x){ file <- read.csv(file = x); print(summary(file))}
> source("challenge1.R") > summarize_x("imessage.csv")
When that worked, I felt so fucking incredible that I got really bold and tried using return( ).
Then everything ended up freezing, so I decided that quitting while ahead was an excellent strategy for the night.
And so today's lesson is that there is always a better, simpler, more elegant, more sophisticated way of doing something. Even if that something seems so simple that you thought you solved it hours ago in just two minutes.
The Challenge
Could you even imagine?
It's a good thing I love a good challenge.
Things I Learned Today: The Importance of Spacing
So clearly from the lack of progress in my blog posts, I haven't been doing a whole lot of learning to code as of late.
That being said, the blanket I've been knitting is coming along quite nicely. And just this weekend, I finished reading Chapterhouse: Dune, thus completing the series. And my Halloween costume is halfway put together. (Disco Unicorn. It's going to be off the chain amazing.)
But the coding? Not so much progress on that front.
Until tonight. I am now fully back on track.
And my big lesson of the day? That spaces are important.
It took me awhile to get into the habit. I only noticed it because I kept having to refer back to the line of code i was trying to reference. That one space felt just like too much of an extra step.
So like here I'm trying to extract a subset of data from climate where ozone values are more than 31 and temperature values equal 90.
Clearly, this:
x.sub1 <- subset(climate, Ozone > 31 & Temp == 90)
is preferable to this:
x.sub1<-subset(climate,Ozone>31&Temp==90)
Even from this simple example, it should be totally obvious, right? If you are looking at many, many lines of long, dense code, you need spaces in between things to make it easier to read.
Not that I'm anywhere near the point of coding anything long or dense, but a girl can still dream.
Big Data in Action Makes A Winning Combination
I Just Spent Over an Hour Learning Why I Need to Learn the Print Function
It all started with me working through something like this exercise:
… And over an hour later ….
Here are some not-pointless ways of using it:
To display some sort of output;
To explain what a function or program is actually doing;
To add debug comments;
To make sure things are working properly.
I guess everyone needs to start somewhere.
Past Tense Versus Gerund
(A quick Google search later…)
read.table( ), plot( ) and the full range of human emotions
I experienced the full range of human emotions trying to import a spreadsheet into R. Two hours later, I'm kind of tired.
It should have been so simple. Chapter 2 of one of my books laid the whole thing out. As an example, I create a .csv file called test and save it on my Desktop. Then, I just type:
table <- read.table(file="Desktop/test.csv", Header = TRUE)
And then the file is imported. Easy peasy.
Only really, read.table ( ) should have been read.csv ( ) because I was importing a .csv file
And there was some issue with the final line in the table, which I had no idea could even possibly be an issue (but now know the solution is to go to the last character of the last line in the file and hit return).
And there was a typo in the book. One that referenced the wrong command.
The range of emotions I was feeling at this point was pretty damn negative.
So I got help, and then I gave myself a swift kick in the ass to end the pity party and get back to work.
And I imported the file. And then another one. Because practice makes perfect.
Then I got big time and downloaded this huge file about trees in NYC.
> Tree <- read.csv(file = "Desktop/ManhattanTree.csv", header = TRUE)
And I was such a roll that I figured out how to make this plot of tree condition by zip code.
> attach(Tree) > plot(ZIPCODE, TREECONDIT)
I totally squealed and jumped up and down in my seat when the graph popped up on the screen, and I'm still so psyched about the whole thing that I'm not even ashamed to admit it.
cat( ) is not c( )
I’ve decided to work through each chapter of each of my books on R in tandem. Overkill? Perhaps. A crazy waste of time? Maybe. Evidence of my thoroughness and intellectual rigor? I like to think so.
Either way, it’s been slow going. I’m on Chapter 2. Several times over.
One book introduces the c( ) command as concatenating data to create a vector.
One book introduces the cat( ) command as combining data into some sort of print output.
However, cat( ) is not the same as c( ).
One concatenates data and one combines data, and before I started working on this, I could have sworn they meant the same thing.