Displaying 2 results from an estimated 2 matches for "convert2raw".
Did you mean:
convert2raid
2008 Jun 06
1
calling a C function with a struct
...t STRUCT1 STRUCT1_TYPE;
The C function header is
void func1( long method, STRUCT1 my_struct, double *output);
I would like to have an R list mimicking the C struct,
and then use .C to call func1 with this information, e.g.
my.struct <- list(type=3,nx=5,x=1:5,a=2.5,b=8.3)
my.func1( 3, convert2raw( my.struct ), )
where R function convert2raw would return a vector of type raw with
the fields of my.struct packed into memory just like STRUCT1, and then
I could call func1 with that vector of raws.
Can I write a convert2raw( ) function and then use
my.func1 <- function( method, buf ) {...
2008 Jun 06
6
Subsetting to unique values
I want to take the first row of each unique ID value from a data frame.
For instance
> ddTable <-
data.frame(Id=c(1,1,2,2),name=c("Paul","Joe","Bob","Larry"))
I want a dataset that is
Id Name
1 Paul
2 Bob
> unique(ddTable)
Will give me all 4 rows, and
> unique(ddTable$Id)
Will give me c(1,2), but not accompanied by the name column.