I worked it out. It wasn't actually the write.csv command - it was the fact that I wasn't putting "as.is" in the read.csv that was corrupting the process
Xavier Abulker wrote: > > 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#a12673415 Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.