R Programming

266 readers
1 users here now

Please use this as a forum to discuss R, and learn more about it. If you have any questions about how to do specific things in R, this is the place to ask.

Getting Started

You can download R here.

You can download RStudio here. RStudio IDE, which is supported by Posit PBC, is a powerful and well-developed IDE for R. Other development environment options include Emacs addon Emacs Speak Statistics and VSCode.

Other Communities

Other communities that may be of interest across the fediverse:

Please send @a_statistician a message to recommend additional communities to add to this list.

Learning resources:

founded 1 year ago
MODERATORS
26
 
 

If you, like me, maintain any package in CRAN with Rcpp dependency, be aware checks in R-devel are failing. The fix is simple (is in the bug report linked), but, at least in my case, must be done before 12/12 or the packages will be removed from CRAN.

27
28
29
30
31
 
 

Some large datasets are pushing memory and some functions I'm writing to the limit. I wanted to ask some questions about subsetting, of matrices and arrays in particular:

  1. Does defining a variable as a subset of another lead to copy? For instance
x <- matrix(rnorm(20*30), nrow=20, ncol=30)
y <- x[, 1:10]

Some exploration with object_size from pryr seems to indicate that a copy is made when y is created, but I'd like to be sure.

  1. If I enter a subset of a matrix/array as argument to a function, does it get copied before the function is started? For instance in
x <- matrix(rnorm(20*30), nrow=20, ncol=30)
y <- dnorm(0, mean=x[,1:10], sd=1)

I wonder if the data in x[,1:10] are copied and then given as input to dnorm.

I've heard that data.table allows one to work with subsets without copies being made (unless necessary), but it seems that one is constrained to two dimensions only โ€“ no arrays โ€“ that way.

Cheers!

32
 
 

I used to frequent r/analytics and r/datascience which are more broad than instances dedicated to a technology or language.

33
1
Marginaleffects book online (vincentarelbundock.github.io)
submitted 1 year ago by [email protected] to c/[email protected]
34
 
 

There is a function format_csv in package readr, which outputs csv formated output to string. It can be used as

to_console<-function(dta){
 cat(readr::format_csv(dta))
}


dta |> someoperation() |> to_console()
35
1
submitted 1 year ago* (last edited 1 year ago) by [email protected] to c/[email protected]
 
 

I will start:

a) as.Date("2022-Jul-01", format ="%Y-%b-%d") will or will not work depending on os language

b) how R handles diacritics and encoding differently on Linux and on windows

c) Rstudio :D

36
 
 

Pola.rs is a Python package to interface with a Rust library, but it's evidently coming to R as well.

As I understand it, Polars is an alternative to wrangling libraries like data.table and dplyr. This book compares the syntax of the 3 libraries.

37
 
 

In the interests of making this community home for those of us who are reddit refugees, let's go ahead and introduce ourselves.

Some suggested things to comment on/include in your introduction:

  • Tidyverse, base, or data.table?
  • Are you primarily a user, a developer, or in between?
  • How long have you been using R?
  • What other languages do you use?
  • What do you use R for? Statistics? generative art? data wrangling?
  • Are you using R primarily for work, fun, hobbies, or something else?
  • Are you a hex sticker collector? Why or why not?
  • Where are you on the data engineering <----> pure statistics continuum?
  • What's your favorite obscure package?
38
 
 

Here's the textbook I use for my classes in R and Python (used to be R and SAS, and I couldn't just drop SAS without adding something else, so now I teach students both). Hoping it's helpful to anyone who is trying to learn R.

39
 
 

I'm sure there are plenty of R coders on Lemmy. Feels like there should be a community for us on this instance...

Introduce yourself here!