Skip to content

Instantly share code, notes, and snippets.

@korkridake
Created November 15, 2018 13:44
Show Gist options
  • Save korkridake/0fa7f0acfab3e18e25abd8b007699ede to your computer and use it in GitHub Desktop.
Save korkridake/0fa7f0acfab3e18e25abd8b007699ede to your computer and use it in GitHub Desktop.
# ------------------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------------------
# How to Install Packages Through Jupyter Notebook
# https://stackoverflow.com/questions/42459423/cannot-install-r-packages-in-jupyter-notebook
# install.packages("tidyverse", repos='http://cran.us.r-project.org')
# install.packages("MASS", repos='http://cran.us.r-project.org')
# ------------------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------------------
library(dplyr)
library(ggplot2)
library(RCurl)
library(tidyverse)
library(MASS)
print(' In case variable x is declared and assigned a value in any other windows then you can use it in other windows too')
#R base contains many default datasets.
#One of the most common datasets in use is the Iris dataset.
#Load it with
data(iris)
#Let's write it into a file and read it from input.
#This goes into your working directory.
write.table(iris,file='iris.txt',sep='\t',col.names=T,quote=F,row.names=F)
rm(iris)
#Read in the file we just wrote.
Iris=read.table('iris.txt',header=T,stringsAsFactors=F,sep='\t')
print('Check column names')
colnames(Iris)
head(Iris)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment