Skip to content

Commit 7cea997

Browse files
committed
Update FAQ.md
1 parent 70ce756 commit 7cea997

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

FAQ.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ You want the first approach, not the second.
5353

5454
####7) My function seems to work when `id` is a single value but I get the following error message when it's something like `70:72`: "In pollutant1$ID == 1:332 : longer object length is not a multiple of shorter object length".
5555

56+
You probably have a line of code that looks something like this: `dat_subset <- dat[which(dat[ , "ID"] == id), ]`
57+
5658
Subsetting by `ID` works when `id` is a vector of length 1. However, when `id = 1:10` for example, you have a problem. The issue goes back to the SWIRL example (and maybe lecture?) regarding how R handles vectors of differing lengths.
5759

5860
An example:

0 commit comments

Comments
 (0)