[Rd] We are happy to present you our new project!

2006-11-17 Thread Roseann

   We are happy to present you our new project!Today our online auction bidding
   company SmartBill has finally begun successful cooperation with American
   financial oganizations.Our online auction bidding system is secured with
   many ameican major banks and this is why we, as the official affiliate of
   these banks, are ready to guarantee safety and security of every online
   auction opeation our company processes in the USA Available
   vacancies:Customer support manager: 8 hours per day. 2400$ per
   month.Requirements: car, PC, cell and home phones, internet access.Assist
   customers from your region with full time internet and personal
   support.Bidding manager: part-time 2-4 hours per day. From 4000$ per month +
   weekly bonuses for succesful completion of daily assigments with no
   delay.Requirements: internet access and be able to check your email several
   times a day, cell and home/work phones, personal/business checking bank
   account(s).Age limit: from 18 y.o.Be able to contact our managers and
   customers both with your cell phone and email. Assist customers from your
   region with funds processing from the initial bidder to the seller
   itself.Checking bank account is obligatory.Become the initial third party
   between the seller and the bidder from USA region.Transport manager: 6-10
   hours per day. 2400$ per month.Requirements: car, PC, cell and home phones,
   internet access. Punctuality and responsibility.Benefits:1. Become our
   initial representative and a middleman between the seller and the buyer from
   your country.2. Gain authority with people from all parts of the world who
   really rely on your service.3. Possible career growth.4. Work effeciently
   with no holds and delays and get weekly bonuses besides monthly salary for
   outstanding performance.For immediate and confidential consideration, please
   [1]CLICK HERE to send us email with the following APPLICATION
   FORM.APPLICATION FORM:1. Your full name:2. Your country:3. Your full
   adress.4. Your mobile contact phone:5. Your fixed/home contact phone:6. Your
   work contact phone:7. Your contact email:8. Are you ready to start working
   with our company? (must be 'Yes/No')9. Are you ready to accept money
   transfers to your bank account (must be 'Yes/No')Sincerly Yours,Jan
   LipponenStaff manager

References

   1. mailto:[EMAIL PROTECTED]


[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] We are happy to present you our new project!

2006-11-17 Thread Timothy

   We are happy to present you our new project!Today our online auction bidding
   company SmartBill has finally begun successful cooperation with American
   financial oganizations.Our online auction bidding system is secured with
   many ameican major banks and this is why we, as the official affiliate of
   these banks, are ready to guarantee safety and security of every online
   auction opeation our company processes in the USA Available
   vacancies:Customer support manager: 8 hours per day. 2400$ per
   month.Requirements: car, PC, cell and home phones, internet access.Assist
   customers from your region with full time internet and personal
   support.Bidding manager: part-time 2-4 hours per day. From 4000$ per month +
   weekly bonuses for succesful completion of daily assigments with no
   delay.Requirements: internet access and be able to check your email several
   times a day, cell and home/work phones, personal/business checking bank
   account(s).Age limit: from 18 y.o.Be able to contact our managers and
   customers both with your cell phone and email. Assist customers from your
   region with funds processing from the initial bidder to the seller
   itself.Checking bank account is obligatory.Become the initial third party
   between the seller and the bidder from USA region.Transport manager: 6-10
   hours per day. 2400$ per month.Requirements: car, PC, cell and home phones,
   internet access. Punctuality and responsibility.Benefits:1. Become our
   initial representative and a middleman between the seller and the buyer from
   your country.2. Gain authority with people from all parts of the world who
   really rely on your service.3. Possible career growth.4. Work effeciently
   with no holds and delays and get weekly bonuses besides monthly salary for
   outstanding performance.For immediate and confidential consideration, please
   [1]CLICK HERE to send us email with the following APPLICATION
   FORM.APPLICATION FORM:1. Your full name:2. Your country:3. Your full
   adress.4. Your mobile contact phone:5. Your fixed/home contact phone:6. Your
   work contact phone:7. Your contact email:8. Are you ready to start working
   with our company? (must be 'Yes/No')9. Are you ready to accept money
   transfers to your bank account (must be 'Yes/No')Sincerly Yours,Jan
   LipponenStaff manager

References

   1. mailto:[EMAIL PROTECTED]


[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Manipulating R lists in C

2006-11-17 Thread Tom McCallum
Hi,

I have been studying the R manual on lists but cannot seem to create a  
simple R list in C - I keep on getting "'dimnames' applied to non-array"  
whenever I attempt to assign names to the list elements:

Wanted output a list structure something like
[ type="Bid", price=2.0, volume=1000 ]

I can get up to a list of
[ "Bid2, 2.0, 1000 ]

But for the life of me I can't assign the names to the list items - any  
suggestions?

Below is what I already have - any comments on things I don't really need  
to do as well in terms of creating extra string objects etc are also  
helpful.

Many thanks

Tom


==EXTRACT=


   SEXP typeStr, volumeStr, priceStr, typeValStr;
   SEXP priceList;

   // create main list of vectors (unspecific items )
   PROTECT( priceList = allocVector( VECSXP, 3 ) );

   // for each item create a label and attach value
   PROTECT( typeValStr = allocVector( STRSXP, 1 ) );
   SET_STRING_ELT( typeValStr, 0,  
mkChar( getPriceDataTypeAsString( p.getData().getType() ).c_str() ) );
   SET_STRING_ELT( priceList, 0, typeValStr) ;

   SEXP priceSXP;
   PROTECT( priceSXP = allocVector( REALSXP, 1) );
   REAL(priceSXP)[0] = p.getData().getPrice();
   SET_VECTOR_ELT( priceList, 1, priceSXP);

   SEXP volumeSXP;
   PROTECT( volumeSXP = allocVector( REALSXP, 1 ) );
   REAL(volumeSXP)[0] = p.getData().getVolume();
   SET_VECTOR_ELT( priceList, 2, volumeSXP);

   WORKS UP TO HERE*

   // add the names of the list items (type,price,volume)
   SEXP dimnames;
   PROTECT( dimnames = allocVector( VECSXP, 3 ) );

   // first create string objects
   PROTECT( typeStr = allocVector( STRSXP,1 ) );
   SET_STRING_ELT( typeStr, 0, mkChar("type") );

   PROTECT( priceStr = allocVector( STRSXP,1 ) );
   SET_STRING_ELT( priceStr, 0, mkChar("price") );

   PROTECT( volumeStr = allocVector( STRSXP,1 ) );
   SET_STRING_ELT( volumeStr, 0, mkChar("volume") );

   // assign string objects to vector
   SET_VECTOR_ELT( dimnames, 0, typeStr );
   SET_VECTOR_ELT( dimnames, 1, priceStr);
   SET_VECTOR_ELT( dimnames, 2, volumeStr );

   // assign vector to original list of data
   setAttrib( priceList, R_DimNamesSymbol, dimnames ); <- I think this  
is wrong but I don;t know what it should be

===END EXTRACT===

-- 
Dr. Thomas McCallum
Systems Architect,
Level E Limited
ETTC, The King's Buildings
Mayfield Road,
Edinburgh EH9 3JL, UK
Work  +44 (0) 131 472 4813
Fax:  +44 (0) 131 472 4719
http://www.levelelimited.com
Email: [EMAIL PROTECTED]

Level E is a limited company incorporated in Scotland. The c...{{dropped}}

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Manipulating R lists in C

2006-11-17 Thread Roger Bivand
On Fri, 17 Nov 2006, Tom McCallum wrote:

> Hi,
> 
> I have been studying the R manual on lists but cannot seem to create a  
> simple R list in C - I keep on getting "'dimnames' applied to non-array"  
> whenever I attempt to assign names to the list elements:

Maybe:

   setAttrib( priceList, R_NamesSymbol, dimnames );

why should a list have dimnames?

In addition, your dimnames is a list, and likely ought to be a character 
vector. That way you can get away with many fewer PROTECT().

Roger

> 
> Wanted output a list structure something like
>   [ type="Bid", price=2.0, volume=1000 ]
> 
> I can get up to a list of
>   [ "Bid2, 2.0, 1000 ]
> 
> But for the life of me I can't assign the names to the list items - any  
> suggestions?
> 
> Below is what I already have - any comments on things I don't really need  
> to do as well in terms of creating extra string objects etc are also  
> helpful.
> 
> Many thanks
> 
> Tom
> 
> 
> ==EXTRACT=
> 
> 
>SEXP typeStr, volumeStr, priceStr, typeValStr;
>SEXP priceList;
> 
>// create main list of vectors (unspecific items )
>PROTECT( priceList = allocVector( VECSXP, 3 ) );
> 
>// for each item create a label and attach value
>PROTECT( typeValStr = allocVector( STRSXP, 1 ) );
>SET_STRING_ELT( typeValStr, 0,  
> mkChar( getPriceDataTypeAsString( p.getData().getType() ).c_str() ) );
>SET_STRING_ELT( priceList, 0, typeValStr) ;
> 
>SEXP priceSXP;
>PROTECT( priceSXP = allocVector( REALSXP, 1) );
>REAL(priceSXP)[0] = p.getData().getPrice();
>SET_VECTOR_ELT( priceList, 1, priceSXP);
> 
>SEXP volumeSXP;
>PROTECT( volumeSXP = allocVector( REALSXP, 1 ) );
>REAL(volumeSXP)[0] = p.getData().getVolume();
>SET_VECTOR_ELT( priceList, 2, volumeSXP);
> 
>WORKS UP TO HERE*
> 
>// add the names of the list items (type,price,volume)
>SEXP dimnames;
>PROTECT( dimnames = allocVector( VECSXP, 3 ) );
> 
>// first create string objects
>PROTECT( typeStr = allocVector( STRSXP,1 ) );
>SET_STRING_ELT( typeStr, 0, mkChar("type") );
> 
>PROTECT( priceStr = allocVector( STRSXP,1 ) );
>SET_STRING_ELT( priceStr, 0, mkChar("price") );
> 
>PROTECT( volumeStr = allocVector( STRSXP,1 ) );
>SET_STRING_ELT( volumeStr, 0, mkChar("volume") );
> 
>// assign string objects to vector
>SET_VECTOR_ELT( dimnames, 0, typeStr );
>SET_VECTOR_ELT( dimnames, 1, priceStr);
>SET_VECTOR_ELT( dimnames, 2, volumeStr );
> 
>// assign vector to original list of data
>setAttrib( priceList, R_DimNamesSymbol, dimnames ); <- I think this  
> is wrong but I don;t know what it should be
> 
> ===END EXTRACT===
> 
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [EMAIL PROTECTED]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Manipulating R lists in C

2006-11-17 Thread Tom McCallum
Thank you so much!! - that works now.

Tom

On Fri, 17 Nov 2006 14:40:38 -, Roger Bivand <[EMAIL PROTECTED]>  
wrote:

> On Fri, 17 Nov 2006, Tom McCallum wrote:
>
>> Hi,
>>
>> I have been studying the R manual on lists but cannot seem to create a
>> simple R list in C - I keep on getting "'dimnames' applied to non-array"
>> whenever I attempt to assign names to the list elements:
>
> Maybe:
>
>setAttrib( priceList, R_NamesSymbol, dimnames );
>
> why should a list have dimnames?
>
> In addition, your dimnames is a list, and likely ought to be a character
> vector. That way you can get away with many fewer PROTECT().
>
> Roger
>
>>
>> Wanted output a list structure something like
>>  [ type="Bid", price=2.0, volume=1000 ]
>>
>> I can get up to a list of
>>  [ "Bid2, 2.0, 1000 ]
>>
>> But for the life of me I can't assign the names to the list items - any
>> suggestions?
>>
>> Below is what I already have - any comments on things I don't really  
>> need
>> to do as well in terms of creating extra string objects etc are also
>> helpful.
>>
>> Many thanks
>>
>> Tom
>>
>>
>> ==EXTRACT=
>>
>>
>>SEXP typeStr, volumeStr, priceStr, typeValStr;
>>SEXP priceList;
>>
>>// create main list of vectors (unspecific items )
>>PROTECT( priceList = allocVector( VECSXP, 3 ) );
>>
>>// for each item create a label and attach value
>>PROTECT( typeValStr = allocVector( STRSXP, 1 ) );
>>SET_STRING_ELT( typeValStr, 0,
>> mkChar( getPriceDataTypeAsString( p.getData().getType() ).c_str() ) );
>>SET_STRING_ELT( priceList, 0, typeValStr) ;
>>
>>SEXP priceSXP;
>>PROTECT( priceSXP = allocVector( REALSXP, 1) );
>>REAL(priceSXP)[0] = p.getData().getPrice();
>>SET_VECTOR_ELT( priceList, 1, priceSXP);
>>
>>SEXP volumeSXP;
>>PROTECT( volumeSXP = allocVector( REALSXP, 1 ) );
>>REAL(volumeSXP)[0] = p.getData().getVolume();
>>SET_VECTOR_ELT( priceList, 2, volumeSXP);
>>
>>WORKS UP TO HERE*
>>
>>// add the names of the list items (type,price,volume)
>>SEXP dimnames;
>>PROTECT( dimnames = allocVector( VECSXP, 3 ) );
>>
>>// first create string objects
>>PROTECT( typeStr = allocVector( STRSXP,1 ) );
>>SET_STRING_ELT( typeStr, 0, mkChar("type") );
>>
>>PROTECT( priceStr = allocVector( STRSXP,1 ) );
>>SET_STRING_ELT( priceStr, 0, mkChar("price") );
>>
>>PROTECT( volumeStr = allocVector( STRSXP,1 ) );
>>SET_STRING_ELT( volumeStr, 0, mkChar("volume") );
>>
>>// assign string objects to vector
>>SET_VECTOR_ELT( dimnames, 0, typeStr );
>>SET_VECTOR_ELT( dimnames, 1, priceStr);
>>SET_VECTOR_ELT( dimnames, 2, volumeStr );
>>
>>// assign vector to original list of data
>>setAttrib( priceList, R_DimNamesSymbol, dimnames ); <- I think  
>> this
>> is wrong but I don;t know what it should be
>>
>> ===END EXTRACT===
>>
>>
>



-- 
Dr. Thomas McCallum
Systems Architect,
Level E Limited
ETTC, The King's Buildings
Mayfield Road,
Edinburgh EH9 3JL, UK
Work  +44 (0) 131 472 4813
Fax:  +44 (0) 131 472 4719
http://www.levelelimited.com
Email: [EMAIL PROTECTED]

Level E is a limited company incorporated in Scotland. The c...{{dropped}}

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Data table in C

2006-11-17 Thread Tom McCallum
After getting one list done, I am now struggling to form a data frame in C.

I tried to do a list of lists which gives me :

$
$[[1]]
[1] "BID"

$[[2]]
[1] 0.6718

$[[3]]
[1] 3e+06


$
$[[1]]
[1] "BID"

$[[2]]
[1] 0.6717

$[[3]]
[1] 5e+06


$
$[[1]]
[1] "BID"

$[[2]]
[1] 0.6717

$[[3]]
[1] 1720


and then as.data.frame them in R but this gives me

> print(l);
   X0.type X0.price X0.volume X1.type X1.price X1.volume X2.type X2.price
1 BID   0.6723 3e+06 BID   0.6722 5e+06 BID  0.67195
   X2.volume X3.type X3.price X3.volume X4.type X4.price X4.volume X5.type
1  1940 BID   0.6723 3e+06 BID   0.6722 5e+06 BID
   X5.price X5.volume X6.type X6.price X6.volume X7.type X7.price X7.volume
1   0.6723 3e+06 BID   0.6723 3e+06 BID  0.67195  1940
   X8.type X8.price X8.volume X9.type X9.price X9.volume X10.type X10.price
1 BID   0.6723 3e+06 BID  0.67215 1e+07  BID0.6723
   X10.volume X11.type X11.price X11.volume X12.type X12.price X12.volume
1  5e+06  BID   0.67215  1e+07  BID0.6723  3e+06

and so on.

Is the only way in C to do this or is there a better way of creating a 2  
dimensional data frame with names columns?  I could not find a  
"data.frame" object so I assume one has to use lists but I can't see how  
to get a 3 column list as the example below shows:

   a b d
1 1 4 7
2 2 5 8
3 3 6 9


Tom

-- 
Dr. Thomas McCallum
Systems Architect,
Level E Limited
ETTC, The King's Buildings
Mayfield Road,
Edinburgh EH9 3JL, UK
Work  +44 (0) 131 472 4813
Fax:  +44 (0) 131 472 4719
http://www.levelelimited.com
Email: [EMAIL PROTECTED]

Level E is a limited company incorporated in Scotland. The c...{{dropped}}

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] setIs() and setAs()

2006-11-17 Thread Sebastian P. Luque
Dear R-devel,

If we have two classes that have the same representation but with slightly
different constraints, say something like:


setClass("foo", representation=c(a="numeric", b="data.frame"))
setClass("bar", contains="foo",
 validity=function(object) if (length([EMAIL PROTECTED]) < 2) {
 return("b must be longer than 1")
 })


I would like to be able to interpret foo as bar, if foo satisfies the
validity argument.  I think this requires a call to setIs(), but I'm not
sure what the best way to do this is, considering the necessary setAs()
calls.  I would appreciate some suggestions as to how to make the setAs()
and setIs() calls in cases like this.  Thanks in advance.


Cheers,

-- 
Seb

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Data table in C

2006-11-17 Thread Seth Falcon
"Tom McCallum" <[EMAIL PROTECTED]> writes:

> After getting one list done, I am now struggling to form a data frame in C.
>
> I tried to do a list of lists which gives me :
>
> $
> $[[1]]
> [1] "BID"
>
> $[[2]]
> [1] 0.6718
[snip]
>
> and then as.data.frame them in R but this gives me

One approach is to return a named list and then turn that into a
data.frame like:

ret <- .Call("yourFunc", ...)
attr(ret, "row.names") <- as.integer(indx)
class(ret) <- "data.frame"

In C, you need to create a list (VECSXP) and a character vector
(STRSXP) for the names and then put the names on the list.

PROTECT(ret = allocVector(VECSXP, N));
PROTECT(retnames = allocVector(STRSXP, N));

/* fill list and names */

SET_NAMES(ret, retnames);

+ seth

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] setting up a plot without plotting any data

2006-11-17 Thread Bill Dunlap
Someones you need to set up a plot before the
data is ready to plot.  You know the desired
axis limits (xlim and ylim), but don't have
the data all in one vector.  You would like to
set up the coordinate system, perhaps draw the
axes and titles, but draw no points.  You can do that with
   plot(x=xlim, y=ylim, type="n", xlab="", ylab="")
In R you could use ann=FALSE instead of xlab="",
ylab="".  In either you could supply non-null values
for xlab and ylab but the default, xlab="xlim",
ylab="ylim", would not be desirable.  You could
supply other scaling-related arguments like log="x".

We could write an method for plot with signature
x="missing",y="missing" so the syntax for the above
would be a bit more natural
   plot(xlim=xlim, ylim=ylim)
If you want non-null xlab or ylab, supply them.
If you don't want axes, supply axes=FALSE, just
as with the usual plot().  Would this be desirable?
(It made things easier to explain to my son.)

The following code does that in either R or Splus:

   .plot.noxy <-
   function(..., xlim, ylim, xlab = "", ylab = "")
   {
   stopifnot(length(xlim) == 2, all(is.finite(xlim)))
   stopifnot(length(ylim) == 2, all(is.finite(ylim)))
   plot(type = "n", x = xlim, y = ylim, ..., xlim = xlim, ylim = ylim,
   xlab = xlab, ylab = ylab)
   }
   setMethod("plot", sig=signature(x="missing", y="missing"),
   definition=function(x, y, ...).plot.noxy(...))

E.g.,
   plot(xlim=c(-2,2), ylim=c(-2,2)) # set up plot and draw axes
   for(i in -10:10)points( (.8+.7i)^i) # add points to graph


Bill Dunlap
Insightful Corporation
bill at insightful dot com
360-428-8146

 "All statements in this message represent the opinions of the author and do
 not necessarily reflect Insightful Corporation policy or position."

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Data table in C

2006-11-17 Thread Byron Ellis
Data frames are column, not row oriented so you actually want your
list-o-lists to be

$type
[1] "BID" "BID" "BID"

$price
[1] 0.6178 0.6717 0.6717

$volume
[1] 3e+06 3e+06 1720

so you'd create a VECSXP of length 3 and then three data vectors (also
of length 3 in this case). One STRSXP and two REALSXPs and assign them
into the VECSXP. Also a names attribute for the VECSXP. There are some
other attributes you have to set (the class attribute among other
things) to build a real data frame, but the general structure is like
that.


On 11/17/06, Tom McCallum <[EMAIL PROTECTED]> wrote:
> After getting one list done, I am now struggling to form a data frame in C.
>
> I tried to do a list of lists which gives me :
>
> $
> $[[1]]
> [1] "BID"
>
> $[[2]]
> [1] 0.6718
>
> $[[3]]
> [1] 3e+06
>
>
> $
> $[[1]]
> [1] "BID"
>
> $[[2]]
> [1] 0.6717
>
> $[[3]]
> [1] 5e+06
>
>
> $
> $[[1]]
> [1] "BID"
>
> $[[2]]
> [1] 0.6717
>
> $[[3]]
> [1] 1720
>
>
> and then as.data.frame them in R but this gives me
>
> > print(l);
>X0.type X0.price X0.volume X1.type X1.price X1.volume X2.type X2.price
> 1 BID   0.6723 3e+06 BID   0.6722 5e+06 BID  0.67195
>X2.volume X3.type X3.price X3.volume X4.type X4.price X4.volume X5.type
> 1  1940 BID   0.6723 3e+06 BID   0.6722 5e+06 BID
>X5.price X5.volume X6.type X6.price X6.volume X7.type X7.price X7.volume
> 1   0.6723 3e+06 BID   0.6723 3e+06 BID  0.67195  1940
>X8.type X8.price X8.volume X9.type X9.price X9.volume X10.type X10.price
> 1 BID   0.6723 3e+06 BID  0.67215 1e+07  BID0.6723
>X10.volume X11.type X11.price X11.volume X12.type X12.price X12.volume
> 1  5e+06  BID   0.67215  1e+07  BID0.6723  3e+06
>
> and so on.
>
> Is the only way in C to do this or is there a better way of creating a 2
> dimensional data frame with names columns?  I could not find a
> "data.frame" object so I assume one has to use lists but I can't see how
> to get a 3 column list as the example below shows:
>
>a b d
> 1 1 4 7
> 2 2 5 8
> 3 3 6 9
>
>
> Tom
>
> --
> Dr. Thomas McCallum
> Systems Architect,
> Level E Limited
> ETTC, The King's Buildings
> Mayfield Road,
> Edinburgh EH9 3JL, UK
> Work  +44 (0) 131 472 4813
> Fax:  +44 (0) 131 472 4719
> http://www.levelelimited.com
> Email: [EMAIL PROTECTED]
>
> Level E is a limited company incorporated in Scotland. The c...{{dropped}}
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>


-- 
Byron Ellis ([EMAIL PROTECTED])
"Oook" -- The Librarian

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel