〜代わり(に)
Instead of; in exchangemachine translation
FormationNoun + の代わりに; verb / adjective in plain form + 代わりに
First meaning: noun + の代わりに is "instead of, in place of": 部長の代わりに私が会議に出る (I'll attend the meeting in place of the department head), ご飯の代わりにパンを食べる (eat bread instead of rice). The person or thing before の代わりに is the one being replaced.
Second meaning: plain-form clause + 代わりに expresses TRADE-OFF — "…, but in exchange…": この部屋は狭い代わりに、家賃が安い (this room is small, but in exchange the rent is cheap). The two clauses balance out: one downside traded for one upside, or the reverse — you help with this and get that in return.
Don't confuse it with 割に: 割に compares against an EXPECTED LEVEL (安い割においしい — tastier than you'd expect for the price), with no trade-off involved at all; 代わりに always has two things swapping places or offsetting each other.
Examples
部長の代わりに、私が会議に出ます。
I will attend the meeting in place of the department head.
今日はご飯の代わりにパンを食べました。
Today I ate bread instead of rice.
この部屋は狭い代わりに、家賃が安いです。
This room is small, but in exchange the rent is cheap.