forked from CrumpLab/LabJournalWebsite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDictionary.Rmd
More file actions
202 lines (126 loc) · 2.93 KB
/
Dictionary.Rmd
File metadata and controls
202 lines (126 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
---
title: "Dictionary"
output:
html_document:
toc: true
toc_float: true
collapsed: false
number_sections: false
toc_depth: 1
#code_folding: hide
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(message=FALSE,warning=FALSE, cache=TRUE)
```
# List of functions
# General bits
1. help(topic) function enables you to describe the function
```{r}
help("mode")
````
2. ?topic Usually, a name or character string specifying the topic for which help is sought
```{r}
?mode
````
3. Is() function lists objects to be examined or defined
```{r}
ls()
````
4. dir() function - lists the files in a directory/folder
```{r}
dir()
````
5. list.files() function - List the Files in a Directory/Folder
```{r}
list.files()
````
# Input and Output
1. save() function - saves objects in R
```{r}
z<- 30
save("z", file = "zorenfile.txt")
````
2. load() function reloads saved datasets
```{r}
load(file = "zorenfile.txt")
````
3. data() function Loads specified data sets, or list the available data sets.
```{r}
data(lib.loc = NULL)
````
4. library() function Loads/Attaches and Listsing of Packages
```{r}
library(lib.loc = NULL)
````
5. read.table() function Reads a file in table format and creates a data frame from it, with cases corresponding to lines and variables to fields in the file.
```{r}
apple <- read.table("Dictionary function.txt")
apple
````
6. read.csv() function Reads a file in table format and creates a data frame from it, with cases corresponding to lines and variables to fields in the file.
```{r}
read.csv("input output.csv")
````
7. scan() function reads data into a vector or list from the console or file
```{r}
scan ("numbers.txt")
````
8. print() function prints its argument and returns it
```{r}
print("whats up")
````
9. cat() function concatenates and prints
```{r}
cat("whats up","duck")
````
10. write.table() making a document
```{r}
write.table(c(1,2,3,4,5),"numbers.txt")
````
# Data Creation
1. c() function Combines Values into a Vector or List
```{r}
c(1,2,3,4,5)
````
2. from:to function - (where from and to are replaced with numbers, e.g. 1:10)
```{r}
10:100
````
```{r}
100:50
````
3. seq() function
```{r}
seq(1,100,3)
````
4. rep() function replicates elements of vectors and lists
```{r}
rep("programing",3)
````
5. data.frame() function creates data frames, tightly coupled collections of variables
```{r}
data.frame(2,2,3,3,4,4)
````
```{r}
data.frame(c(2,2,3,3,4,4),c(5,5,6,6,7,7))
````
6. list() function constructs vector of vectors
```{r}
list(c(2,2,3,3,4,4),c(5,5,6,6,7,7))
````
7. matrix() function matrix creates a matrix from the given set of values.
```{r}
matrix(c(2,2,3,3,4,4))
````
8. factor() function
```{r}
factor(numbers<-c(2,2,3,3,4,4))
````
9. rbind() function combines R Objects by Rows
```{r}
rbind(c(2,2,3,3,4,4),c(1,1,1,1,1,1))
````
10. cbind() function combines objects by columns
```{r}
cbind(c(2,2,3,3,4,4),c(9,9,9,9,9,9))
````