R Orientation rep(1, 100) my_object = seq(from=0, to=50, by=2) plot(my_object) getwd() setwd() #use forward slashes even in windows install.packages("readxl") library(readxl) read_excel("data.xlsx") read.csv("data.csv") install.packages("foreign") library(foreign) read.dta("data.dta") install.packages("haven") library(haven) read_sav("data.sav") ?sample sample(c(0,1), 100, replace=TRUE) Import Data read.csv("data.csv", header=TRUE) # consider there is a header sample_csv = read.table("data.csv", header=TRUE, sep=",") Assess Data summary(sample_csv) nrow(sample_csv) max(sample_csv) min(sample_csv) mean(sample_csv) median(sample_csv) unique(sample_csv$E) sort(sample_csv$E) length(sample_csv$E) which(sample_csv$E=0) length(sample_csv$E=0) is.matrix(sample_csv) is.data.frame(sample_csv) Manipulate Data as.matrix(sample_csv) # convert data-frame into a matrix matrix(1, 2, 3) as.data.frame(...
How to Increase Virtual Memory Size in Linux and Windows For Linux: Check if a swapfile is already active: sudo swapon --show Turn off and delete existing swapfile: sudo swapoff /swapfile sudo rm /swapfile Then proceed with recreating it: sudo fallocate -l 4G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile Make it permanent (optional): sudo nano /etc/fstab /swapfile none swap sw 0 0 Optional Tweak: Reduce Swappiness (Better for SSDs & RAM): echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf sudo sysctl -p For Windows 11: Press Windows + R, type sysdm.cpl, and press Enter. Press Advanced, and then Performance (Virtual Effects) -> Settings. Press Advanced, and then Change. Choose the drive [Volume]. Choose Custom Size. Set Initial Size (MB): 4096 Set Maximum Size (MB): 8192 Press Set, and then OK.