[R] Return dynamic array from C to R

2012-04-21 Thread Jaimin Dave
Hi Everyone,
I am new to R and I am trying to return array(dynamic) from C to R. But
when I print array(vector) in R it gives NA as output. When I print array
in C it gives correct o/p but some how it is not returned to R.

*Code in C:*
void test(double *vec,double *size){
vec = (double *)calloc(2 , sizeof(double));
*(vec+0) = 1;
*(vec+1) = 2;
*size = 2;
}

*Code in R:*
test-.C(test,vec=as.double(),size=as.integer())
print(test$vec[1:test$size])

Is there any other way to implement above thing?

Any help would be appreciated
Thanks

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


[R] Plot OctTree

2012-02-18 Thread Jaimin Dave
Hi Everyone,
I have csv file which is in following format
 xmin,xmax,ymin,ymax,zmin,zmax

I want to plot 3d graph with all the all octants being displayed as well.
Any idea?  I have used scatterplot3d package but it does not seem to have
anything by which i can draw octants inside cube as well.

Thanks

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


[R] Pass Vector from R to C

2011-06-18 Thread Jaimin Dave
Hi ,
I have a function which passes a vector from R to C. However the size of the
vector is decided inside the c program. But as I have to pass the size while
calling the function from R lot of my space is getting wasted. Is there any
other alternative?

I call c function as :
hi-.C(main,v1=as.double(vector(double,1000)),v2=as.double(vector(double,1000)),v3=as.double(vector(double,1000)),v4=as.double(vector(double,1000)),points.csv,as.integer(15000),quad.csv)
Here if only 250 space are filled then in remaining 750 space 0.0 is
returned and I don't want that
moreover I want that the resultant vector should be returned back to R.

Thanks

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


[R] Pointers in R

2011-06-12 Thread Jaimin Dave
Hello Everyone,
I am new to R and would like to create a quad tree in R. However the problem
is that I don't think R has pointers. Is there any way to create a tree in
R?

Thanks

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


Re: [R] Pass String from R to C

2011-04-25 Thread Jaimin Dave
I tried using char ** but it is printing some random string.

On Sat, Apr 23, 2011 at 6:08 PM, Duncan Murdoch murdoch.dun...@gmail.comwrote:

 On 11-04-23 7:04 PM, Jaimin Dave wrote:

 Hi,
 I am using a function which accepts the string from R and prints it.
 But when I am calling .C(main,hello);
 it is printing any random thing.
 My C function is
 void main(char *str)


 See Writing R Extensions.  The declaration should be char **str.

 Duncan Murdoch

  {
 Rprintf(%s,str);
 }

 Can you help how to achieve this using .C interface?

 Thanks
 Jaimin

[[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


[R] Pass String from R to C

2011-04-23 Thread Jaimin Dave
Hi,
I am using a function which accepts the string from R and prints it.
But when I am calling .C(main,hello);
it is printing any random thing.
My C function is
void main(char *str)
{
Rprintf(%s,str);
}

Can you help how to achieve this using .C interface?

Thanks
Jaimin

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


Re: [R] Grid on Map

2011-04-07 Thread Jaimin Dave
Hi,
I tried it using abline but it is not showing any o/p(i.e no grids are
formed on map). I did following :

 map('state','new york',proj='azequalarea',orient=c(42.5,-74.56,0))
 abline(h=seq(41, 44, length=3))
 abline(v=seq(-79, -76, length=3))

I also tried using map.grid() but in some cases it is dividing into exact 4
quadrants.

On Wed, Apr 6, 2011 at 2:49 PM, MacQueen, Don macque...@llnl.gov wrote:

 Possibly something similar to

  abline(v=seq(long.min, long.max, length=3)
  abline(h=seq(lat.min, lat.max, length=3)

 ?

 The above will add vertical and horizontal lines to an existing plot, and
 assumes that the plot is in long/lat coordinates. Of course, this ignores
 the fact that long/lat is not a cartesian coordinate system.

 (can't provide more detail without more information)

 -Don

 --
 Don MacQueen

 Lawrence Livermore National Laboratory
 7000 East Ave., L-627
 Livermore, CA 94550
 925-423-1062





 -Original Message-
 From: Jaimin Dave davejaim...@gmail.com
 Date: Mon, 4 Apr 2011 18:39:45 -0700
 To: r-help@r-project.org r-help@r-project.org
 Subject: [R] Grid on Map

 I am new to R.I want to draw grid from a csv file which contains latitude
 minimum ,latitude maximum ,longitude minimum ,longitude maximum.The grid
 should be divided into exactly 4 quadrants. The map is of NY state of
 USA. I
 want to know how can I do it.
 Help would be appreciated.
 
 Thanks
 Jaimin
 
 [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org 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.



[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


[R] Grid on Map

2011-04-04 Thread Jaimin Dave
I am new to R.I want to draw grid from a csv file which contains latitude
minimum ,latitude maximum ,longitude minimum ,longitude maximum.The grid
should be divided into exactly 4 quadrants. The map is of NY state of USA. I
want to know how can I do it.
Help would be appreciated.

Thanks
Jaimin

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


[R] Points on Map

2011-03-28 Thread Jaimin Dave
Hi,
I am new to R and I want to plot points on the Map of New York .  I also
want to divide map of New York into small grids(not fixed) .I want that
these point should be plotted from a file.How can I do it?Any help would be
greatly appreciated.


Thanks
Jaimin

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


[R] Using C code in R

2011-03-23 Thread Jaimin Dave
Hi,
I am new to R and I want to know how to use C code which contains two
functions one called inside another.I know that how to use C code in R if it
has only one function but dont know how to do it in above case. I want to
use the same in R .My C code is as follows.

//#include R.h

void sayHello();

void g();



void sayhello() {

Rprintf(Hello world %d\n,global);

}

void g()

{

int a=9;

int b=1;

Rprintf(Hello world\n %d,(a+b));

sayHello();

}

Help would be greatly appreciated

Thanks

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


[R] QuadTree

2011-02-20 Thread Jaimin Dave
Could any one tell me how to implement QuadTree in R?
Or are there any packages avaialble to implement it in R.

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.