[R] strsplit

Peter Dalgaard p.dalgaard at biostat.ku.dk
Tue Nov 15 18:03:39 CET 2005


tom wright <tom at maladmin.com> writes:

> I'm stuck on what I feel should be a minor problem.
> I have a dataseries obtained from a MS Access database that consists of
> a series of numbers seperated by carridge returns (\r)
> Currently this data is in R as mode numeric???
> 
> I want to separate this into a vector of the componant numbers.
> Perhaps a little code will help describe what I've got here!!
> 
> library(rodbc)
> s_sql<-'SELECT Data from table where id=1' #only one record returned
> oWave<-sqlQuery(oConn,s_sql)
> 
> wave.data<-oWave$data
> 
> > mode(data)
> [1] "numeric"
> 
> Any clues will be much appreciated

Er, did you mean to say mode(wave.data)? 

Anyways, you say that you want to obtain a vector of numbers, and you
got an object of mode numeric, which means that it is a vector of
numbers. So what was the problem in the first place?

If you had data with carriage returns inside, then you should have
them as mode "character".

So there seems to be something that you're not telling us...

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907




More information about the R-help mailing list