Skip to content

Commit 6c98ef1

Browse files
committed
additional edits
1 parent 370ee70 commit 6c98ef1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Practice_Assignment.pdf

83 Bytes
Binary file not shown.

practice_assignment.rmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ Don't worry if you can't imagine when that would be useful because you'll see an
148148

149149
Now, let's create a subset of the data frame that shows us just the 25th day for Andy and David.
150150
```{r}
151-
day_25 <- andy_david[andy_david$Day == 25, ]
151+
day_25 <- andy_david[which(andy_david$Day == 25), ]
152152
day_25
153153
```
154154

@@ -206,7 +206,7 @@ median(dat$Weight, na.rm=TRUE)
206206

207207
So 190 is the median weight. We can find the median weight of day 30 by taking the median of a subset of the data where Day=30.
208208
```{r}
209-
dat_30 <- dat[dat[, "Day"] == 30,]
209+
dat_30 <- dat[which(dat[, "Day"] == 30),]
210210
dat_30
211211
median(dat_30$Weight)
212212
```
@@ -236,7 +236,7 @@ weightmedian <- function(directory, day) {
236236
for (i in 1:5) { #loops through the files, rbinding them together
237237
dat <- rbind(dat, read.csv(files_list[i]))
238238
}
239-
dat_subset <- dat[dat[, "Day"] == day,] #subsets the rows that match the 'day' argument
239+
dat_subset <- dat[which(dat[, "Day"] == day),] #subsets the rows that match the 'day' argument
240240
median(dat_subset$Weight, na.rm=TRUE) #identifies the median of the subset
241241
#while stripping out the NAs
242242
}

0 commit comments

Comments
 (0)