According to the New York Department of Taxation and Finance:
A New York Resident is an individual who is domiciled in New York or an individual that maintains a permanent place of abode in New York for more than 11 months and spends 184 or more days in the state during the tax year.
A Nonresident of New York is an individual that was not domiciled nor maintained a permanent place of abode in New York during the tax year.
A Part-Year Resident is an individual that meets the definition of resident or nonresident for only part of the year.
What if I am a resident and my spouse is not?
If one spouse is a resident and the other is not, file separate New York returns. If you choose to file a married filing joint New York return, all income will be taxed as if both spouses are residents. To file separate returns within your account, you can file the federal return and wait for the return to be accepted. Then, change the filing status for the primary taxpayer and file a separate return for the first spouse. The second spouse will need to create a new account and file the separate state return in that account (if required to file).
For more information, please see: