Typical desktop height is 30″ from the floor. If you are choosing to use a shelf as a desk, use a stud finder to locate the wall studs. Any shelf that will be deeper than 12″ and used as a desk should be installed with heavy duty brackets using #10 screws in studs. Wall anchors will not provide sufficient support.
Use a level to ensure your brackets and shelf/desktop is level before installing the 2nd bracket. Install the first bracket and then hold the second bracket in place with a piece of wood lying on top of the two brackets. Place the level on the wood and reposition the 2nd bracket until the level indicates the wood is completely level. Mark the top hole on the wall using a pencil pushed through the top screw hole of the bracket. Take down the piece of wood and position the bracket using the pencil mark as your guide. Install the 2nd bracket and then place the wood top and screw the brackets to the wood top using the 3/4″ screws.