JRで よこはまに いきます
to take the JR to Yokohama
Cassiopeiaで ほっかいどうに いきます
to take the Cassiopeia to Hokkaido
とくべつな でんしゃで はこだてに いきます
to take the special train to Hakodate
あおい でんしゃで あおもりに いきます
to take the blue train to Aomori
Doraemonでんしゃで いきます
to take the Doraemon train
あおい でんしゃで けんぶつを します
to take the blue train for sightseeing
あたらしい でんしゃで おばさんの
うちに いきます
to take the new train to Auntie’s place
ちかてつで どうぶつえんに いきます
to take the subway to the zoo
で by means of
In English you “take the train” somewhere. In Japanese you “go by” train. The idea of taking a train (in your pocket?) seems an odd way of expressing the idea of using transport, but there you have it. Even the travelling “on” the train seems a bit unusual these days. The police would get involved, if you really travelled “on the train“. In Japanese you “travel by means of transport” and the particle for that is で.
This also applies to travelling by bus, by car, by plane, or by Shinkansen.