search for: struct1_type

Displaying 2 results from an estimated 2 matches for "struct1_type".

2008 Jun 06
1
calling a C function with a struct
...pack fields into an array of type raw that could be passed directly to the function. Here is some more detail. The C struct is simple, but has mixed types: struct STRUCT1 { long type; long nx; double *x; double a; double b; }; typedef struct 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...
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.