R for Dart Developers
Move from Dart to base R: vectors, missing values, data frames, functions, S3 dispatch, S4 validity and closure state. Build a connected multi-file basket and port a stock ledger.
Dart and R side by side
The same program in Dart and in R, from the lessons of this course.
Text and Output
Dart print writes a value with a line ending, while stdout.write allows output without one. R cat needs an explicit final newline; paste and paste0 construct strings. Rscript runs an entry file, and source evaluates supporting declarations. R print can add…
Dart1 2void main() {3print("Hi" + ", Ada");4}R1ready <- 32cat(paste0("Ready: ", ready), "\n", sep="")Comparisons and Recycling
Dart core lists normally use identity equality, while strings and classes with operator == overrides can compare values. R == is elementwise and can recycle shorter operands. Use all for a reduced decision or identical when types and attributes belong to…
Dart1 2void main() {3final a=[1], b=[1]; print(a==b);4}R1cat(identical(1L, 1), all(c(2, 3) == c(2, 3)), "\n")Vector Subsetting
Dart lists use zero-based positions and expose last for a nonempty list; negative indexes are not end-relative. R positive indexes start at one, negative indexes exclude positions and zero selects nothing. Mixing positive and negative selectors is invalid…
Dart1 2void main(){3final values=[4,8,12];print(values.last);4}R1values <- c(4, 8, 12)2cat(paste(values[-1], collapse=" "), "\n", sep="")Typed Iteration
Dart Iterable.map creates a lazy iterable, and toList materializes its results. R lapply returns a list immediately, sapply attempts simplification and vapply checks a type-and-length prototype for each result. Choose the expected result shape explicitly…
Dart1 2void main(){3final words=["a","tea"];final lengths=words.map((word)=>word.length).toList();print(lengths.join(":"));4}R1words <- c("a", "tea")2sizes <- vapply(words, nchar, integer(1), USE.NAMES=FALSE)3cat(paste(sizes, collapse=" "), "\n", sep="")Functions and Returns
Dart functions use return statements or arrow bodies to provide values and ordinarily evaluate arguments before calls. R returns the last evaluated expression by default and uses lazy argument promises. return remains available for early exit. Helpers…
Dart1 2void main() {3int twice(int x)=>x*2; print(twice(4));4}R1is_long <- function(text) nchar(text)>42cat(is_long("coffee"), "\n", sep="")String Parsing
Dart RegExp captures and int.tryParse separate pattern recognition from successful numeric conversion. R trimws and strsplit work on character vectors, and strsplit returns a list of token vectors. A fixed separator is different from a regular expression.…
Dart1 2void main() {3final match=RegExp(r"^([a-z]+)=([0-9]+)$").firstMatch("pen=12"); if(match!=null){print(match.group(2));}4}R1parts <- strsplit("tea,cake", ",", fixed=TRUE)[[1]]2cat(length(parts), "\n", sep="")
Syllabus
10 chapters48 lessons1 project48 challenges99 quiz questionsFiles and Atomic Values
6 lessonsLogic and Iteration
6 lessonsCollections and Ownership
5 lessonsData and Transformations
4 lessonsFunctions and Closures
5 lessonsParsing and S3 Dispatch
5 lessonsObjects and Invariants
6 lessonsCollaboration and Contracts
5 lessonsProject: Basket
4 lessonsFinal Challenges
2 lessonsFrequently asked questions
Who is R for Dart Developers for?
For people who already write Dart and want to learn R. Each lesson starts from Dart you know and shows how R does the same thing, so you skip the beginner basics.
Do I need to know R already?
No. The course starts with your first R program. You need Dart basics: variables, conditions, loops, functions and collections.
How many lessons does R for Dart Developers have?
R for Dart Developers contains 48 interactive lessons you can complete at your own pace.
What does R for Dart Developers cover?
The course is organized into chapters covering: Files and Atomic Values, Logic and Iteration, Collections and Ownership, Data and Transformations, and more.
Is R for Dart Developers free?
Yes. Every course on Coddy is free to start. You can complete lessons in your browser without any downloads or signup.