After capturing Gengar in Chapter 3, it will tell Tim and Pikachu all it knows when they question it. While doing this, Gengar will tell of a secret lab that can be found within the library. On top of this, Gengar will even tell Tim and Pikachu how to Find said laboratory in order to hopefully find the culprit working with it!
In order to Find the secret lab within the PCL Library, Gengar will tell you that you must remove books of a certain color from the shelves in a specific order. Once learning this, head to the Library. Once there, carefully pull the Book with the yellow spine, then the book with the blue spine, then the book with the green spine, and, finally, then the book with the red spine. By doing this, the entrance to the secret lab with open. Within said lab, Tim and Pikachu will learn more about the chemical known as R.