How can I read data with 0 in front, eg:
read.table(header=T, stringsAsFactors=F,text="
a b
1 2
3 04
")
I got the second row of 3, 4 instead of 3, 04, what should I do to keep the 0 in front, thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use
read.table()‘scolClasses=argument to let it know that you want to read the columns in as vectors of class"character":(Or, to read your first column as numeric and only the second one as character, set
colClasses=c("numeric", "character"))