Displaying 20 results from an estimated 20000 matches similar to: "Pass Vector from R to C"
2011 Mar 24
2
Using C code in R
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
2011 Mar 28
1
Points on Map
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]]
2011 Apr 05
1
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]]
2011 Jun 12
1
Pointers in R
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]]
2011 Feb 20
1
QuadTree
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]]
2011 Apr 23
1
Pass String from R to C
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]]
2011 Apr 06
2
S4 generic functions/methods vs enclosures
Apologies for asking something that is probably very obvious, i just started
with S4 classes and i guess i am not finding documentation that lays out the
grammar rules and gives enough examples.
I understand that main method of writing a member function is to write a
generic function and setMethod for this particular class. This, however,
presumes that there is "virtuality" for this
2006 Mar 02
5
Deparsing '...'
Hi,
The following function works, but is there a neater way to write it?
f = function(x,...)
{
# return a character vector of the arguments passed in after 'x'
gsub("
","",unlist(strsplit(deparse(substitute(list(...))),"[(,)]")))[-1]
}
> f(x,a,b,c*d)
[1] "a" "b" "c*d"
>
Thanks.
[[alternative HTML
2007 Jun 01
2
Getting names of objects passed with "..."
Is there a tidy way to get the names of objects passed to a function via the
"..." argument?
rbind/cbind does what I want:
test.func1 <- function(...) {
nms <- rownames(rbind(..., deparse.level=1))
print(nms)
}
x <- "some stuff"
second <- "more stuff"
test.func1(first=x, second)
[1] "first" "second"
The usual
2007 Dec 10
5
Neat conditional assignment
I would like to make a new vector with values taken from two existing
vectors conditional upon a third. At present I am doing this with a for loop
but wonder if there is not a neater way, given some of the very neat things
R can do.
a<-rep(c("A","B"),50)
b<-rep(1,100)
c<-rep(2,100)
a is thus "A" "B" "A" "B" "A"
2012 Feb 18
1
Plot OctTree
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]]
2012 Apr 22
1
Return dynamic array from C to R
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:*
2011 Jan 22
4
Crossover cable for E1 ?
I'm looking to connect a BMC 450 to an asterisk with a Digium Quad E1 card.
Am I right in thinking that I'll need a special 'crossover-E1' RJ45 cable?
If so, any clues where I might buy one in the UK? The Digium card sellers don't seem to
stock such a thing.
Thanks.
Tim.
Tim Panton - Web/VoIP consultant and implementor
www.westhawk.co.uk
2020 May 31
4
Simple backup of maildir folder
On 29 May 2020, at 23:49, Admin Beckspaced <admin at beckspaced.com> wrote:
> I also have maildir as mailbox format and use the following script to do daily backups
>
> https://github.com/tachtler/dovecot-backup
A couple of notes on this quite useful script:
My mktemp does not support -p (FreeBSD 12.1) is I had to change the script to:
DIR_TEMP=$($MKTEMP_COMMAND -d $TMP_FOLDER
2006 Feb 28
4
number_to_currency UK pounds
I work in the UK and therefore most of my currency figures will be in UK
pounds. I realise that to format a number to a currency format I can
use:
number_to_currency(amt, :unit => "?")
but it would be more convenient to set ? as the default currency symbol.
What is the best way to do that?
Should I edit line 39 of this file:
2007 Feb 05
3
RSNPper SNPinfo and making it handle a vector
If I run an analysis which generates statistical tests on many SNPs I would
naturally want to get more details on the most significant SNPs. Directly
from within R one can get the information by loading RSNPer (from
Bioconductor) and simply issuing a command SNPinfo(2073285). Unfortunately,
the command cannot handle a vector and therefore only wants to do one at a
time.
I tried the lapply and
2009 May 25
1
Passing a JavaScript variable through a Rails params hash
Hi guys, hoping someone can give me a pointer with this?
I have a Javascript variable that I''m updating dynamically as a user
interacts with the page. I want the user to be able to save it''s value
at any time along with some text data in a pop-up form, so the best way
I can think of is to pass it through the params hash without writing it
into the form. I''m not totally
2020 Apr 16
6
suggestion: "." in [lsv]apply()
Hi,
I would like to make a suggestion for a small syntactic modification of
FUN argument in the family of functions [lsv]apply(). The idea is to
allow one-liner expressions without typing "function(item) {...}" to
surround them. The argument to the anonymous function is simply referred
as ".". Let take an example. With this new feature, the following call
2009 Mar 06
9
Association broken when upgrading from rails 1.2.6 to 2.2.2
I have an app with the following models:
course
belongs_to :semester
semester
has_many: courses
belongs_to :education
education
has_many :semesters
In my old app (rails 1.2.6) I was able to access variables via
controller
@courses = Course.find(:all)
view file:
<% for course in @courses %>
<%= course.name %> <- this line works
<%= course.semester.name %> <- this is now
2020 Nov 18
3
Best practice preparing for disk restoring system
I'd agree with you John. I'm trying to get away from Amanda's
unpredictability and go back to using scripts to drive dump (for
ext2/3/4) and xfsdump (for xfs).
Is there any easy way to tell rear to include xfsdump and dump
capability? If the commands are there then its trivial to restore data.
What I've done in the past is before the nightly backup write a small
file to the