[R] %%

2015-02-17 Thread André de Boer
Hello,

Where can I find info about the operator %%?
Never used it but when I search for it I gives no result.

Thanks,
André

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] merge dataframes

2013-07-03 Thread André de Boer
Hello,

I have two dataframes:
dat1-data.frame(x=c(1.0,1.2,3.2,4.0,5.1),y=c(23,17,12,27,8))
dat2-data.frame(x=seq(0,6,by=0.1),y=rep(0,60)))

I want to replace the corresponding rows of dat2 with the ones of dat1.
I tried:

for(i in 1:nrow(dat1))
{
  dat2[dat2$x==dat1[i,1],2]-dat1[i,2]
}

But I discovered that not every 5.1 is equal:

 dat2[52,1][1] 5.1 dat1[5,1][1] 5.1 dat2[52,1]==dat1[5,1][1] FALSE



How to solve this?



Regards,

André

[[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] constructing yieldcurve

2012-01-07 Thread André de Boer
Hello,

With which package can I build a yield curve using swap data with the
bootstrapping method?

Thanks for the reaction,
André

[[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] convert string to variable

2011-04-22 Thread André de Boer
Hello,

Is it possible to convert a string to a variable?

I have a set of names:

 stocks
 [1] ACCELL AHOLD   AJAXARCADIS  BALLAST
BAM.GROEP
 [7] BESIBETER.BED   BINCKBANK.NVBOSKALIS
 CATE  CROWN.V.GELDER

And a data frame with stockquotes.

With a for-loop I want to create variables (ACCEL, AHOLD )  with quotes
from the data frame 'data':

for (i in stocks){
k=1; m=2
m=10
??i - data[,k:m]
k=k+2; m=10+2
}

How can I do this?

Thanks for the answer.
André

[[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] manipulate dataframe

2011-02-06 Thread André de Boer
Hello,

Can someone give me hint to change a data.frame.
I want to split a column in more columns depending on the value of a other
column.
Thanks for the reaction,
Andre

Example:
 dat
  x1 x2
1  1  a
2  1  b
3  1  c
4  2  d
5  2  e
6  2  f
7  3  g
8  3  h
9  3  i

in

 dur
  d1 d2 d3
1  a  d  g
2  b  e  h
3  c  f  i

[[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] big data

2010-09-08 Thread André de Boer
Hello,

I searched the internet but i didn't find the answer for the next problem:
I want to do a glm on a csv file consisting of 25 columns and 4 mln rows.
Not all the columns are relevant. My problem is to read the data into R.
Manipulate the data and then do a glm.

I've tried with:

dd-scan(myfile.csv,colClasses=classes)
dat-as.data.frame(dd)

My question is: what is the right way to do is?
Can someone give me a hint?

Thanks,
Arend

[[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] date conversion

2010-09-03 Thread André de Boer
Hello,

I have a dataframe with data such as:
 dat$BEGINDATUM[3]
[1] 13-09-2007
 dat$BEGINDATUM[4]
[1] 01-11-2007

 class(dat$BEGINDATUM[3])
[1] factor

Now I need to make calculation with these dates.
But I get these result:
 as.date(as.character(dat$BEGINDATUM[3]))
[1] NA
 as.date(as.character(dat$BEGINDATUM[4]))
[1] 11Jan2007

How can i convert these factors to make calculations possible.

Thanks for the answer,
Andre

[[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] calculations with dates

2010-08-29 Thread André de Boer
Hi,

I have a data.frame with factors in columns like

startdate  enddate
27SEP2005 01JAN2006

How can I calculate the duration between those two dates and move this in a
extra column in the data.frame.

Thanks,
André

[[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] extracting year from date

2010-08-29 Thread André de Boer
Hi,

Sorry for this simple question but I searched the internet and can't find
the answer.

From a date I want the year extracted:
 data$start[1
[1] 2006-11-01

Thanks for the answer,
Andre

[[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] conditionally sum

2010-08-28 Thread André de Boer
Hi,

Suppose I have a dataframe like:
 data
yx
1  1 2008
2  1 2008
3  0 2008
4  0 2009
5  1 2009

Now I want to know how much 1 corresponds with 2008 and how much with
2009, the answers are 3 and 1.
How can I achieve this? Thanks for the anwer.
André

[[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] how to eliminate an element of a list

2010-08-12 Thread André de Boer
Hi,

I want to eliminate an element of a list:

list - seq(1,5,1)
s - sample(list,1)

lets say s=3
Now I want to remove 3 from the list: list2 = {1,2,4,5}

Can someone give me a tip?

Thanks,
André

[[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.