[TriLUG] R code problem

Brian Henning via TriLUG trilug at trilug.org
Mon Sep 16 13:03:29 EDT 2019


Questionably-helpful peanut-gallery suggestion:

I note you have two things referred to as something.out.  Presumably one of those is actually an input.  Consider, if the language permits (I know nothing about R), labeling inputs as inputs (.in, perhaps?) to improve code readability.

Cheers,
-Brian

-----Original Message-----
From: TriLUG <trilug-bounces+bhenning=pineresearch.com at trilug.org> On Behalf Of M.R. via TriLUG
Sent: Monday, September 16, 2019 12:01 PM
To: trilug at trilug.org
Subject: [TriLUG] R code problem

In case there are some R users among the readership:

After reading in .csv file [It has the class: dataframe] and subsetting the columns down to 16 from 71, I want to write a backup .csv with the following code.

At one time something close to the code below worked, but now it does not. Any ideas?

CODE SNIPPET:
pth.out =
"d:/dox/projects/politics/voter_stats/ncvoter_Statewide/vtr-data-results/"
setwd(pth.out)
#getwd() # testing the path
fyl.out = "vtr_all_01.csv" # 7.6 e6 records/rows, 71 variables/columns # all of the above did work.

# now:
write.csv(fyl.out, fyl.out)                  # sep == , # fails: writes two cells or 30 bytes, not the entire dataframe.
And I do not know why

Any thoughts?

Mike R.

--
This message was sent to: Brian <bhenning at pineresearch.com> To unsubscribe, send a blank message to trilug-leave at trilug.org from that address.
TriLUG mailing list : https://www.trilug.org/mailman/listinfo/trilug
Unsubscribe or edit options on the web	: https://www.trilug.org/mailman/options/trilug/bhenning%40pineresearch.com
Welcome to TriLUG: https://trilug.org/welcome


More information about the TriLUG mailing list