Does anyone know how R works?

  • 57 Replies
  • 1314 Views
*

sokarul

  • 18446
  • Discount Chemist
Re: Does anyone know how R works?
« Reply #30 on: July 13, 2020, 12:27:16 PM »
Scientists use ggplot2 was the point.
ANNIHILATOR OF  SHIFTER

It's no slur if it's fact.

*

Definitely Not Swedish

  • rutabaga
  • 8024
  • Flat Earth Inspector General of High Fashion Crime
Re: Does anyone know how R works?
« Reply #31 on: July 13, 2020, 12:42:00 PM »
You're right, except for the part where you're not.
I bet more scientists do not use ggplot than do use ggplot.

Maybe the data experts that wanna make fancy graphs, sure.

All other scientists, that want to present their data in the cleanest, simplest and most clear way they have no use for ggplot.
Quote from: croutons, the s.o.w.
You have received a warning for breaking the laws of mathematics.

*

Definitely Not Swedish

  • rutabaga
  • 8024
  • Flat Earth Inspector General of High Fashion Crime
Re: Does anyone know how R works?
« Reply #32 on: July 13, 2020, 12:45:39 PM »
I'll create a boxplot now. Tell me one advantage I'd have if I were to use gigagayplot2 instead of normal r, and I'll think about it.
« Last Edit: July 13, 2020, 12:48:44 PM by Definitely Not Swedish »
Quote from: croutons, the s.o.w.
You have received a warning for breaking the laws of mathematics.

*

Definitely Not Swedish

  • rutabaga
  • 8024
  • Flat Earth Inspector General of High Fashion Crime
Re: Does anyone know how R works?
« Reply #33 on: July 13, 2020, 01:04:03 PM »
See, you can't
That proves that GigaGayPlot2 sucks!  O0
Quote from: croutons, the s.o.w.
You have received a warning for breaking the laws of mathematics.

*

sokarul

  • 18446
  • Discount Chemist
Re: Does anyone know how R works?
« Reply #34 on: July 13, 2020, 01:18:02 PM »
The guy who didnít know R existed a week ago is now an expert. Right.

Playing dress up as a scientist. Leave it to us real ones.
ANNIHILATOR OF  SHIFTER

It's no slur if it's fact.

*

Definitely Not Swedish

  • rutabaga
  • 8024
  • Flat Earth Inspector General of High Fashion Crime
Re: Does anyone know how R works?
« Reply #35 on: July 13, 2020, 01:21:11 PM »
The guy who didn’t know R existed a week ago is now an expert. Right.

Playing dress up as a scientist. Leave it to us real ones.
I got the deadline tho, I'll leave R all to you as soon as I can  ;)


Where is the error:
Quote
boxplot(SLRL, LLRL,
        ylab="Latency [ms]",
        ylim = c(0, 80),
        yaxp=c(0,80,2),
        bty="n")
It gives me a boxplot but with lines around the whole graph. bty="n" is supposed to remove them but it doesn't work.
Also it doesn't produce an error. It just kidna ignores it.
« Last Edit: July 13, 2020, 01:23:52 PM by Definitely Not Swedish »
Quote from: croutons, the s.o.w.
You have received a warning for breaking the laws of mathematics.

*

sokarul

  • 18446
  • Discount Chemist
Re: Does anyone know how R works?
« Reply #36 on: July 13, 2020, 01:28:52 PM »
?boxplot

Maybe set it to white to see if it blends in.
ANNIHILATOR OF  SHIFTER

It's no slur if it's fact.

*

Definitely Not Swedish

  • rutabaga
  • 8024
  • Flat Earth Inspector General of High Fashion Crime
Re: Does anyone know how R works?
« Reply #37 on: July 13, 2020, 01:39:02 PM »
Hmm.

The thing that I want to remove is the square around the plot. The bty=n argument worked like a charm in my other plot so its really weird it does not work now.

I could try making the lines white, but that is a not very clean solution, especially since I possibly export it as vectorgraph (pdf).
« Last Edit: July 13, 2020, 01:44:30 PM by Definitely Not Swedish »
Quote from: croutons, the s.o.w.
You have received a warning for breaking the laws of mathematics.

*

sokarul

  • 18446
  • Discount Chemist
Re: Does anyone know how R works?
« Reply #38 on: July 13, 2020, 01:40:23 PM »
edit
ANNIHILATOR OF  SHIFTER

It's no slur if it's fact.

*

Definitely Not Swedish

  • rutabaga
  • 8024
  • Flat Earth Inspector General of High Fashion Crime
Re: Does anyone know how R works?
« Reply #39 on: July 13, 2020, 01:44:06 PM »
Edit what?
Quote from: croutons, the s.o.w.
You have received a warning for breaking the laws of mathematics.

*

sokarul

  • 18446
  • Discount Chemist
Re: Does anyone know how R works?
« Reply #40 on: July 13, 2020, 01:47:51 PM »
I was looking at the wrong command.

par(bty ="n")
boxplot(revenue, expenses,
        ylab="Latency [ms]",
        ylim = c(0, 20000),
        yaxp=c(0,80,2)
       )

This worked.

https://www.r-graph-gallery.com/73-box-style-with-the-bty-function.html
ANNIHILATOR OF  SHIFTER

It's no slur if it's fact.

*

Definitely Not Swedish

  • rutabaga
  • 8024
  • Flat Earth Inspector General of High Fashion Crime
Re: Does anyone know how R works?
« Reply #41 on: July 13, 2020, 02:03:47 PM »
I was looking at the wrong command.

par(bty ="n")
boxplot(revenue, expenses,
        ylab="Latency [ms]",
        ylim = c(0, 20000),
        yaxp=c(0,80,2)
       )

This worked.

https://www.r-graph-gallery.com/73-box-style-with-the-bty-function.html

WTF IS THIS SHIT.
I swear to god I've tried using it with par() before and it didn't work. Now it did.

Thank you  O0
Quote from: croutons, the s.o.w.
You have received a warning for breaking the laws of mathematics.

*

Definitely Not Swedish

  • rutabaga
  • 8024
  • Flat Earth Inspector General of High Fashion Crime
Re: Does anyone know how R works?
« Reply #42 on: July 15, 2020, 11:32:34 AM »
okay I'm fucking stuck again.

Edit: Never mind, see edit 3

How the hell to I get an grey line in a plot(...) function to be like 50% transparent?!

I only found solutions for ggplot2 (yeah fuck me for not using gigagayplot2 :-[)

Function is like that:
Quote
plot()
lines(a,b,col = "grey")


Edit
Quote
lines(a,b,col="grey",alpha = I(1/2))
does not work.

Edit 2
I tried
Quote
mycol <- rgb(0, 0, 255, max = 255, alpha = 125, names = "blue50")
And then
Quote
plot()
lines(a,b,col = "blue50")
and that doesn't work either (I also tried "lines(a,b,col = "mycol")")


Edit 3
Okay I found an acceptable solution. If I use the col="grey" in the plot() function as an argument, the grey line is the one in the background (isntead of foreground like when I use it in the lines() function) and this way it doesn't look like total crap and I don't need the transparency.
« Last Edit: July 15, 2020, 11:46:39 AM by Definitely Not Swedish »
Quote from: croutons, the s.o.w.
You have received a warning for breaking the laws of mathematics.

*

Definitely Not Swedish

  • rutabaga
  • 8024
  • Flat Earth Inspector General of High Fashion Crime
Re: Does anyone know how R works?
« Reply #43 on: July 15, 2020, 12:13:32 PM »
NEW PROBLEM

How do I make a boxplot completely invisible?

I want it to look like this
Boxplot Boxplot  (distance=invisible boxplot) Boxplot Boxplot
Quote from: croutons, the s.o.w.
You have received a warning for breaking the laws of mathematics.

*

Jamie

  • 1466
  • Numbers Archivist
Re: Does anyone know how R works?
« Reply #44 on: July 15, 2020, 12:22:42 PM »
Sometimes it's r; sometimes it's R.

It's pretty simple.
There is a preverb in Turkish:  "Do not think everybody have beard is your grandfather".

*

Definitely Not Swedish

  • rutabaga
  • 8024
  • Flat Earth Inspector General of High Fashion Crime
Re: Does anyone know how R works?
« Reply #45 on: July 15, 2020, 12:31:31 PM »
I am currently trying to use ggplot2 for the boxplot, but I cant manage that fucker to draw a simple boxplot out of super simple data. Like wtf?
Quote from: croutons, the s.o.w.
You have received a warning for breaking the laws of mathematics.

*

Definitely Not Swedish

  • rutabaga
  • 8024
  • Flat Earth Inspector General of High Fashion Crime
Re: Does anyone know how R works?
« Reply #46 on: July 15, 2020, 12:33:29 PM »
I basically got this now:

Quote
setwd("~/R/Boxplot")
library(readxl)
Boxplot2 <- read_excel("~/R/Boxplot/Boxplot2.xlsx")
#View(Boxplot2)
attach(Boxplot2)

library(ggplot2)

Then I tried some different stuff to get it to draw boxplots, but it never worked. The variables I want it to draw boxplots of are SLRL, SLRD, and some more. Any ideas?
Quote from: croutons, the s.o.w.
You have received a warning for breaking the laws of mathematics.

*

Definitely Not Swedish

  • rutabaga
  • 8024
  • Flat Earth Inspector General of High Fashion Crime
Re: Does anyone know how R works?
« Reply #47 on: July 15, 2020, 01:13:05 PM »
Okay I tried it with ggplot2, but that shit is really fucking bad. I have super simple data, but this piece of crap isn't gonna show me a boxplot. How can they program it that shitty? With standard R all I do is boxplot(variable1,varible2) and I get a boxplot. But that crappy ggplot2 thing isn't gonna give me a boxplot after 40min of trying, so it's just a useless piece of trash.
Quote from: croutons, the s.o.w.
You have received a warning for breaking the laws of mathematics.

*

sokarul

  • 18446
  • Discount Chemist
Re: Does anyone know how R works?
« Reply #48 on: July 15, 2020, 02:27:34 PM »
There is so much info out there.

http://www.sthda.com/english/wiki/ggplot2-box-plot-quick-start-guide-r-software-and-data-visualization

You probably skipped a few steps including setting something as factor variable.
ANNIHILATOR OF  SHIFTER

It's no slur if it's fact.

*

Definitely Not Swedish

  • rutabaga
  • 8024
  • Flat Earth Inspector General of High Fashion Crime
Re: Does anyone know how R works?
« Reply #49 on: July 15, 2020, 02:36:45 PM »
Yeah I already was on that link.

I think my issue is with how my data is formatted.
It's like this:

Four groups (A B C D)

For each group I have around 20 values of a time in ms.

Now I want a boxplot for each group (= 4 boxplots).

Y axis would be the time, x axis would be groups a,b,c,d. So far I havent figured out how to do this with gigagayplot.
I probably could do it if I were to invest a whole day (or at least half a day) but I really am not willing to do so right now.
Quote from: croutons, the s.o.w.
You have received a warning for breaking the laws of mathematics.

*

sokarul

  • 18446
  • Discount Chemist
Re: Does anyone know how R works?
« Reply #50 on: July 15, 2020, 04:54:50 PM »
Looks like there should be 20 letter A, 20 letter B and so on all in one column. The ?ggplot2 fake dataframe is made like that and not with A as the column name. Once the data is like that it's simple.
ANNIHILATOR OF  SHIFTER

It's no slur if it's fact.

*

Pezevenk

  • 14897
  • Militant aporfyrodrakonist
Re: Does anyone know how R works?
« Reply #51 on: July 16, 2020, 12:29:59 PM »
Can we at least see the graphs? I like looking at weird looking graphs I don't understand. Here's a graph I just made in Matlab of the bifurcation diagram of the logistic mapping:

Do you understand what it is? Probably not. Does it look kinda neat? Yes. Did you need to understand it to know it looks kinda neat? No. Also it has fractal properties which makes it even more neat.
Member of the BOTD for Anti Fascism and Racism

It is not a scientific fact, it is a scientific fuck!
-Intikam

Read a bit psicology and stick your imo to where it comes from
-Intikam (again)

*

Definitely Not Swedish

  • rutabaga
  • 8024
  • Flat Earth Inspector General of High Fashion Crime
Re: Does anyone know how R works?
« Reply #52 on: July 16, 2020, 12:42:35 PM »
Its unpublic data that will go in a publication, so I cant share it unfortunately.
Quote from: croutons, the s.o.w.
You have received a warning for breaking the laws of mathematics.

*

Pezevenk

  • 14897
  • Militant aporfyrodrakonist
Re: Does anyone know how R works?
« Reply #53 on: July 16, 2020, 12:46:24 PM »
Its unpublic data that will go in a publication, so I cant share it unfortunately.
You can just change all the labels to, idk, fart jokes or something.
Member of the BOTD for Anti Fascism and Racism

It is not a scientific fact, it is a scientific fuck!
-Intikam

Read a bit psicology and stick your imo to where it comes from
-Intikam (again)

*

JJA

  • 4153
  • Math is math!
Re: Does anyone know how R works?
« Reply #54 on: July 16, 2020, 03:10:22 PM »
Its unpublic data that will go in a publication, so I cant share it unfortunately.

Shouldn't that go in an unpublication then? :)

*

Pezevenk

  • 14897
  • Militant aporfyrodrakonist
Re: Does anyone know how R works?
« Reply #55 on: July 17, 2020, 01:23:41 AM »
On a similar note, I just failed a computational physics exam (that course with the weird diagrams and shapes). The professor decided that almost half the points are gonna come from a chapter that he has literally never put another exercise from in any other exams in all the history of the course and wasn't even in our notes. Also he decided to do that on the shittiest year ever since due to COVID we couldn't be examined in front of a computer with all the resources needed available, instead we had to write code on paper. Incredible success!
Member of the BOTD for Anti Fascism and Racism

It is not a scientific fact, it is a scientific fuck!
-Intikam

Read a bit psicology and stick your imo to where it comes from
-Intikam (again)

*

Definitely Not Swedish

  • rutabaga
  • 8024
  • Flat Earth Inspector General of High Fashion Crime
Re: Does anyone know how R works?
« Reply #56 on: July 17, 2020, 02:50:23 AM »
On a similar note, I just failed a computational physics exam (that course with the weird diagrams and shapes). The professor decided that almost half the points are gonna come from a chapter that he has literally never put another exercise from in any other exams in all the history of the course and wasn't even in our notes. Also he decided to do that on the shittiest year ever since due to COVID we couldn't be examined in front of a computer with all the resources needed available, instead we had to write code on paper. Incredible success!
Lol!
Well, you are supposed what is in the lectures and not what was in old exams, so you deserve it  ;)

My exam was super easy. Usually we dont get any additional ressources. Thanks to covid, it was only pass/fail plus it was open book  ;D
Quote from: croutons, the s.o.w.
You have received a warning for breaking the laws of mathematics.

*

Pezevenk

  • 14897
  • Militant aporfyrodrakonist
Re: Does anyone know how R works?
« Reply #57 on: July 17, 2020, 06:08:21 AM »
On a similar note, I just failed a computational physics exam (that course with the weird diagrams and shapes). The professor decided that almost half the points are gonna come from a chapter that he has literally never put another exercise from in any other exams in all the history of the course and wasn't even in our notes. Also he decided to do that on the shittiest year ever since due to COVID we couldn't be examined in front of a computer with all the resources needed available, instead we had to write code on paper. Incredible success!
Lol!
Well, you are supposed what is in the lectures and not what was in old exams, so you deserve it  ;)

My exam was super easy. Usually we dont get any additional ressources. Thanks to covid, it was only pass/fail plus it was open book  ;D

It wasn't in the notes either. It was in his video lectures but there's like 45 hours of them. When you have a limited time to study, you usually focus on the stuff that seems more likely to be important, it's kinda weird for the professor to decide out of left field that that chapter is important enough to take up 4/10 marks.

My exam was also open book but it's almost impossible to pass just by looking at the book/notes (that I was carrying) if you are not already familiar with the exercises and the material is very extensive. Normally it is a bit easier since you are in front of a computer and you can download code similar to what you need from the course's website and just modify it, and then there are some questions that are answered basically by looking at a graph you made, provided you did it right. Although it's still not one of the easier exams.

Would be nice to have pass/fail exams just this once  >:(
Although I think it would just result in professors passing fewer people.
« Last Edit: July 17, 2020, 06:18:37 AM by Pezevenk »
Member of the BOTD for Anti Fascism and Racism

It is not a scientific fact, it is a scientific fuck!
-Intikam

Read a bit psicology and stick your imo to where it comes from
-Intikam (again)