[R] Help with writing data to csv
jim holtman
jholtman at gmail.com
Sun May 13 03:18:15 CEST 2012
Take a look at the data in a text file and you will see that it is a
CSV file with a single column:
"1 ONE.LEVEL.ANALYSIS.WITH.Speaker..random..and.folseg..5.04e.08....preseg..3.77e.07....position..0.402....sylstress..0.93. "
"2 $preseg "
"3 factor coef tokens mean "
"4 s 0.128 1 1.075 "
"5 i 0.028 50 1.040 "
"6 e -0.009 27 1.001 "
"7 z -0.009 3 1.036 "
"8 a -0.018 52 0.996 "
"9 o -0.057 23 0.960 "
"10 u -0.064 10 0.942 "
"11 $folseg "
"12 factor coef tokens mean "
"13 i 0.063 50 1.041 "
"14 e 0.060 19 1.026 "
"15 s 0.007 8 1.001 "
"16 a 0.005 61 0.996 "
It appears that you have data stored in a list, and not a dataframe,
that you are calling write.csv with. Show the actual write.csv file
and the 'str' of the object that you are trying to write. Also your
data has varying number of columns. Exactly what were you trying to
do? The system is doing exactly what you are telling it to do. So
what I would need to see is the actual object you are working with and
then what you expect to see as output.
On Sat, May 12, 2012 at 9:10 PM, Delano L <chombito718 at hotmail.com> wrote:
> Hi Jim,
>
> Thank you for responding. I wanted to reply to you in the forum but I'm not
> able to access it due to database being updated. I hope I am not offending
> you by replying directly to your email.
>
> This is the information that I'm trying to write to a csv file:
>
> The attached file is what I get. You'll see that it's separated by rows but
> not by columns.
> Thanks for your help.
> Delano
>
> ONE-LEVEL ANALYSIS WITH Speaker [random] and folseg (5.04e-08) + preseg
> (3.77e-07) + position (0.402) + sylstress (0.93)
> $preseg
> factor coef tokens mean
> s 0.128 1 1.075
> i 0.028 50 1.040
> e -0.009 27 1.001
> z -0.009 3 1.036
> a -0.018 52 0.996
> o -0.057 23 0.960
> u -0.064 10 0.942
>
> $folseg
> factor coef tokens mean
> i 0.063 50 1.041
> e 0.060 19 1.026
> s 0.007 8 1.001
> a 0.005 61 0.996
> u -0.040 2 0.944
> z -0.041 25 0.939
> o -0.054 1 0.871
>
> $position
> factor coef tokens mean
> i 0.011 52 1.013
> f -0.002 68 0.992
> m -0.009 46 1.008
>
> $sylstress
> factor coef tokens mean
> a 0.001 104 1.008
> t -0.001 62 0.995
>
> $Speaker
> random coef tokens mean std dev
> part005 0 33 1.002 0
> part017 0 55 1.004 0
> part018 0 27 1.001 0
> part019 0 51 1.004 0
>
> $misc
> deviance df intercept grand mean
> -469.687 18 0.991 1.003
>
>
>
>> Date: Sat, 12 May 2012 20:20:38 -0400
>> Subject: Re: [R] Help with writing data to csv
>> From: jholtman at gmail.com
>> To: chombito718 at hotmail.com
>> CC: r-help at r-project.org
>>
>> I have had no problem at all with writing CSV files and copy/pasting
>> the data into WORD. What you really need to show is what is the
>> actual output in the file that you are working with, and then exactly
>> what you are doing with the data in WORD. So I know that it works
>> fine, so it must be "pilot error".
>>
>> On Sat, May 12, 2012 at 7:24 PM, DL <chombito718 at hotmail.com> wrote:
>> > Thank you for replying. The result of the first command was an excel
>> > sheet
>> > with the data separated by rows but not columns, which is basically what
>> > I
>> > get when I copy and paste into Excel. I would like to have the
>> > information
>> > separated by rows and columns so I can just copy and paste it into a
>> > table
>> > in word and not have to type the data. I'm not sure if I'm being clear.
>> >
>> > --
>> > View this message in context:
>> > http://r.789695.n4.nabble.com/Help-with-writing-data-to-csv-tp4629436p4629724.html
>> > Sent from the R help mailing list archive at Nabble.com.
>> >
>> > ______________________________________________
>> > R-help at 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.
>>
>>
>>
>> --
>> Jim Holtman
>> Data Munger Guru
>>
>> What is the problem that you are trying to solve?
>> Tell me what you want to do, not how you want to do it.
--
Jim Holtman
Data Munger Guru
What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.
More information about the R-help
mailing list