Question: Write a function named month _ convert ( x , from _ lang, to _ lang ) that will convert month names from one language
Write a function named monthconvertx fromlang, tolang that will convert month names from one language to another. The function will accept three arguments: x which is a factor with month information; the language from which we are translating fromlang; and the language to which we are translating tolang.
I have uploaded a file called monthnames.txt on Canvas which has the month names in several European languages. Use
monthnames read.delimmonthnames.txt encoding"UTF row.names to import the file.
Then apply your conversion function, for example:
## marzo marzo febrero junio
## Levels: febrero junio marzo
If the input contains a value that is not a real month, then it will be replaced with NA Any values that are not real months should have the corresponding levels removed as well.
## marzo marzo febrero junio
## Levels: febrero junio marzo
The order of the levels should remain the same before and after conversion between languages they should not be realphabetized
## August April December April
## Levels: April August December
monthconvertx "English", "Italian" ## agosto aprile dicembre aprile
## Levels: aprile agosto dicembre
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
