Apple - How do I force a partition and format on a USB key in OS X Mountain Lion Disk Utility or from CLI diskutil?
You need to use /dev/disk4
in place of just disk 4
in your command. It should read like this
diskutil partitionDisk /dev/disk4 1 GPT HFS+ newdisk R