Dear R helpers,
I have two queries.
(1) If the dataset contains some variables having all the entries = 0 and while
analysing I want to delete those pericular columns, how do acheive this. i.e.
dataset1
sr_no var1 var2 var3 var4 var5
1 5 0 3 1 0
2 3 0 2 9 0
3 4 0 4 7 0
4 11 0 1 6 0
In the above dataset, var2 and var3 are all 0's so I don't want to select these
columns. It is not that always these two variables will be zeros, so in general
how the dataset can be filtered in order to have only non-zero columns.
(2) Suppose I have variable no of datasets 'say n = 10'. I wish to write a
loop assigning each of these datasets to diffrent csv files e.g.
for (i in 1:10)
{
write.csv(data.frame(dataset[,,i]), 'data_set[i].csv', row.names = FALSE)
}
The result of this command is generation of a csv file 'data_set[i].csv'
containing the last dataset (owing to the wrong command written by me).
What I need is creation of say data_set[1].csv, data_set[2].csv,
.........data_set[10].csv i.e. 10 different csv files containing 10 different
datasets.
Thanking you in advance
Anna
Your Mail works best with the New Yahoo Optimized IE8. Get it NOW!
http://downloads.yahoo.com/in/internetexplorer/
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.