# Propose your Valentine with R

This post is dedicated to all the R programming lovers. It's not easy to impress tech-savvy valentine with conventional surprises.You might have tried all conventional surprises for your valentine. If your valentine is R programming lover, you can have an impact on her with your cool coding skill.

 Wish Valentine with R

How to Use

Ask your valentine to run the following R program and see what you mean

Method 1 : Heart Curve
# Enter the name of person you love
mylove = "Katie"

library(ggplot2)

# Create data frame
k = seq(0, 2*pi, pi/60)
mydata = data.frame(
x = 16*sin(k)^3 +25,
y = 13*cos(k) - 5*cos(2*k) - 2*cos(3*k) - cos(4*k) +20
)

# Generate Plot
Valentine = ggplot(data = mydata, aes(x, y)) +
geom_polygon(aes(group = 1), fill = "red") +
geom_text(aes(x = 25, y = 20, label = "Happy Valentine's Day!"),
size = 8, colour = "white") +
geom_text(aes(x = 15, y = 5, label = paste("To :", mylove)),
size = 5, colour = "#444444")

Valentine

Method 2 : Text Message

paste(intToUtf8(acos(log(1))*180/pi-17),
intToUtf8(atan(1/sqrt(3))*180/pi+2), toupper(substr(month.name[4],5,5)),
intToUtf8(acos(exp(0)/2)*180/pi+2^4+3),toupper(substr(month.name[11],3,3)),
LETTERS[3^2-2^2],intToUtf8(atan(1/sqrt(3))*180/pi+2),
intToUtf8(acos(log(1))*180/pi-1), substr(month.name[10],1,1),
intToUtf8(acos(log(1))*180/pi-5), sep = intToUtf8(0))

Don't tell your valentine what the program returns and make it a surprise.
 Output

Related Posts
Share

Deepanshu founded ListenData with a simple objective - Make analytics easy to understand and follow. He has over 10 years of experience in data science. During his tenure, he worked with global clients in various domains like Banking, Insurance, Private Equity, Telecom and HR.

Post Comment 22 Responses to "Propose your Valentine with R"
1. Thank you for your appreciation.

1. getting an error

Error in UseMethod("weekdays") :
no applicable method for 'weekdays' applied to an object of class "c('double', 'numeric')"

1. It seems R version issue. I have updated the code. It should work now. Thanks!

2. it doesn't work for me :(

1. It seems R version issue. I have updated the code. It should work now. Thanks!

3. I can't run it. I have next error:
Error in UseMethod("weekdays") :
no applicable method for 'weekdays' applied to an object of class "c('double', 'numeric')"

1. It seems R version issue. I have updated the code. It should work now. Thanks!

2. It works now. Thank you!

4. Awesome. It is working for me. Yipeee :-)

5. still doesn't work

1. Updated the code. It should work now. See the snapshot of the output. I apologize for the inconvenience caused. Please confirm if it still does not work.

6. doesn't work, even with the new code

1. Updated the code. It should work now. See the snapshot of the output. I apologize for the inconvenience caused. Please confirm if it still does not work.

7. thanks!!! My girlfriend loved it!!!

1. Awesome. It served its purpose!

8. All because of "I LOVE YOU" ? Anyway, it's interesting, but what if my crush is not using R? Well done.

9. The way to print those characters one by one using code conversion. I liked it.

10. thank you very much. very funny program.

11. So romantic!

12. it will certainly work in R-fiddle

13. Thank you, very cool; how can I customize it to add the name of a specific person?

Next → ← Prev