15 Software
This wikipage contains the collective lab knowledge about software and coding. Sections are kind of organized logically.
15.1 R & Rstudio
There are tons more stuff about R in my Data Science for Psychologists class.
15.1.3 R Code
This subsection contains R code that I have googled more than once.
15.1.3.1 How do I export a dataframe?
Description: export a dataframe to specific data type?
Source: Quick-R
- dat
write.table(mydata, “mydata.dat”, sep=“)
- csv
write.csv(mydata,“mydata.csv”, row.names = FALSE)
15.1.3.2 How do I merge a list of dataframes?
Description: Merges list of dataframes into a single dataframe
Source: stackoverflow
bind_rows(list_of_dataframes, .id = “column_label”)
Note: .id = “column_label” adds the unique row names based on the list element names
15.1.3.3 How do I produce all combinations of list elements?
Description: produce all combinations of list elements
Source: rdrr.io
require(utils)
expand.grid(height = seq(60, 80, 5),
weight = seq(100, 300, 50),
type = c("Cat","Dog"))
#> height weight type
#> 1 60 100 Cat
#> 2 65 100 Cat
#> 3 70 100 Cat
#> 4 75 100 Cat
#> 5 80 100 Cat
#> 6 60 150 Cat
#> 7 65 150 Cat
#> 8 70 150 Cat
#> 9 75 150 Cat
#> 10 80 150 Cat
#> 11 60 200 Cat
#> 12 65 200 Cat
#> 13 70 200 Cat
#> 14 75 200 Cat
#> 15 80 200 Cat
#> 16 60 250 Cat
#> 17 65 250 Cat
#> 18 70 250 Cat
#> 19 75 250 Cat
#> 20 80 250 Cat
#> 21 60 300 Cat
#> 22 65 300 Cat
#> 23 70 300 Cat
#> 24 75 300 Cat
#> 25 80 300 Cat
#> 26 60 100 Dog
#> 27 65 100 Dog
#> 28 70 100 Dog
#> 29 75 100 Dog
#> 30 80 100 Dog
#> 31 60 150 Dog
#> 32 65 150 Dog
#> 33 70 150 Dog
#> 34 75 150 Dog
#> 35 80 150 Dog
#> 36 60 200 Dog
#> 37 65 200 Dog
#> 38 70 200 Dog
#> 39 75 200 Dog
#> 40 80 200 Dog
#> 41 60 250 Dog
#> 42 65 250 Dog
#> 43 70 250 Dog
#> 44 75 250 Dog
#> 45 80 250 Dog
#> 46 60 300 Dog
#> 47 65 300 Dog
#> 48 70 300 Dog
#> 49 75 300 Dog
#> 50 80 300 Dog
15.1.3.4 How to remove scientific notation?
Description: Stop R from printing tiny decimals as strings
Source: stackoverflow
options(scipen = 999)