[R] write.csv / string extraction and field limits

Xavier Abulker xavier_abulker at yahoo.fr
Mon Sep 10 18:10:34 CEST 2007


This example works fine:

test<-matrix(c(1,2,'VOICIUNPETITTESTTTTTTTTTTTTTTTTTTTT',3),ncol=2,nrow=2)
write.csv(test,file='C:/xavier/test.csv')


Could you provide the same small example when it doesn't work?



kwaj wrote:
> 
> Hello, 
> 
> I have a peculiar problem which I am hoping I can get help on. 
> 
> I am using the write.csv command to write a matrix structure to a file,
> which I later read in excel. The command works quite well for most strings
> and numerical values in the matrix structure. 
> 
> However, I have found that when a field in the matrix contains a string of
> long length, when the matrix is finally written the file - the field shows
> up as "NA". I am assuming write.csv has a limit on the field size? Maybe
> 16 characters?
> 
> Assuming the above is correct - I tried to extract a portion of the string
> using the 'substring' command and enter the extracted portion into the
> field before using the write.csv command. However I find, that when a
> string is extracted, the output from write.csv generates a NA in the file
> output. 
> 
> My questions are:
> 
> 1) Does write.csv have a limit on the size of strings in the matrix
> fields? Is there anyway to place large strings in the field?
> 
> 2) Is there anyway to make the substring command or an alternative but
> similar command, compatible with write.csv? I have tried
> 'as.character(substring(phrase, min, max)' and that does not seem to work
> 
> cheers
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/write.csv---string-extraction-and-field-limits-tf4395535.html#a12596551
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list