Hi,
On 02/23/2012 11:08 AM, Niek de Klein wrote:
Hi everyone,
I have a matrix with multiple columns like this:
charge convexhull_xCoor id
3 3336.43 f_7936733956214261295
3 3339.73 f_7936733956214261295
3 3336.43 f_7936733956214261295
2 3797.14 f_2444900193131259878
2 3799.41 f_2444900193131259878
2 3800.93 f_2444900193131259878
I want to get only one row per uniq id, removing the rest of the rows
(it doesn't matter which of the rows with the uniq id is kept). In R
this is equal to:
> csv <- read.csv('/homes/ndeklein/infiles/feature.csv', head=TRUE,
sep='\t')
> csvUniq <- subset(csv, !duplicated(csv$id))
So using rpy2 this would be
csvData = R.r['read.csv'](file=inputFolder+'feature.csv',
head=True, sep='\t')
csvUniqID = R.r['subset'](csvData,
R.r['duplicated'](csvData[R_funct.index(csvData, 'id')]))
Except that I don't have !duplicated but duplicated.
R.r['!duplicated'] is not recognized and doing
csvUniqID = R.r['subset'](csvData, not
R.r['duplicated'](csvData[R_funct.index(csvData, 'id')]))
Also doesn't work (it seems to ignore the not). So how do I get the !
infront of duplicated?
I don't know about the "!" but couldn't you just use the "unique"
function instead?
Best,
Moritz
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list