This is a very simple question, so I apologize I couldn't find it online:

I want to shorten the string 'apples.pears' to 'apples'.

string='apples.pears'
string1=substr(string,0,x)

For x above, I would like to have a command like charAt(string,"."), i.e.
the position of the period in the word, but I can't seem to find a charAt
command in R.

Thank you.

	[[alternative HTML version deleted]]

