[R] selecting columns based on values of two variables

2009-09-06 Thread Thomas Jensen
multiple of shorter object length 4: In `==.default`(idb, c("DEN", "SWD", "FIN")) : longer object length is not a multiple of shorter object length Any help would be greatly appreciated, Best, Thomas Jensen [[alternative HTML version deleted]] __

[R] Creating adjacency matrix from a data frame

2009-09-06 Thread Thomas Jensen
UK 313 365 1618 The full data set has all possible pairings between countries, so the end goal should be a symmetric adjacency matrix. Thank you, Thomas Jensen __ R-help@r-project.org mailing list https://stat.ethz.ch

[R] Breadt-first-search algorithm

2010-03-05 Thread Thomas Jensen
Dear R-list, does anyone of you know whether there exist a breadth-first-search algorithm for R? Best, Thomas Jensen __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R

[R] Count of entries in a row of a data frame

2010-03-18 Thread Thomas Jensen
Dear R-list, I have data in the following format: Country 1 Country 2Country 3 ... 1 0 10 2 1 02 3 0 10 Now I would like to create a variable that counts every

[R] Transform data set

2010-03-23 Thread Thomas Jensen
Dear R Experts, I am having some trouble creating a variable in R. I have data on self-placement of voters, their placement of parties, and which party they feel closest to. The data is structured like this: Party_Closelrplaceself lrplaceParty1 lrplaceParty2 ... party1

[R] Finding common an unique elements in character vectors

2010-03-29 Thread Thomas Jensen
Dear R-list, I have a problem which I think is quite basic, but so far google has not helped me. I have two vectors like this: vector_1 <- c(Belgium, Spain, Greece, Ireland, Luxembourg, Netherlands, Portugal) vector_2 <- c(Denmark, Luxembourg) I would like to find the elements in vector_1 that

[R] Create a new variable

2010-03-30 Thread Thomas Jensen
Dear R-list, Sorry for spamming the list lately, I am just learning the more advanced aspects of R! I have some data that looks like this: Out Country1 Country 2 Country 3 ... CountryN 1 1 1 1 1 0 1 1 0 1 1 1 0 1

[R] Event History Data Recoding

2010-04-23 Thread Thomas Jensen
Dear R list, I have an event history data set that is structured like this: Legislative act Discussion Agreement Time Event Act12006-05-30 2006-06-19 201 Act22004-03-01 2004-06-14 105 1 . . . I have

Re: [R] Event History Data Recoding

2010-04-23 Thread Thomas Jensen
, Joshua Wiley wrote: > If you are talking about changing from a "wide" format to "long" take a look > at > > ?reshape > > > --- > Josh > > On Fri, Apr 23, 2010 at 7:09 AM, Thomas Jensen > wrote: > > Dear R list, > >

[R] Creating quarterly data

2010-06-28 Thread Thomas Jensen
. . . . . . . . . 23 21 100 Can any one tell me how this can be done in R? With kind regards, Thomas Jensen __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] Creating quarterly data

2010-06-28 Thread Thomas Jensen
d, sum) # quarter x1 x2 # 1 0 10 15 # 2 1 13 11 Hope this helps Allan On 28/06/10 13:23, Thomas Jensen wrote: Dear R Experts, I have data in the following format x1x2time 241 312 463 144 565 856 ... ... ..

[R] Help with dates and characters

2010-06-29 Thread Thomas Jensen
Dear R Experts, I have a vector of dates in character format like this: date "2000-01-01" "2000-01-23" "2001-03-12" ... ... ... "2009-12-31" I would like to delete the last part of the character string (i.e. the "day" part), so the vector looks like this: date "2000-01" "2000-01" "2001-03"

[R] Reshaping data

2010-07-19 Thread Thomas Jensen
Dear All, I have some data in the following shape: ID begin_t1end_t1 begin_t2end_t2 Thomas 11/03/0413/05/0604/02/0716/05/08 ... ... ... ...

Re: [R] Reshaping data

2010-07-20 Thread Thomas Jensen
(d2) <- NULL# clear the created row names > d2 <- d2[order(d2$ID), -2] # sort by name, removing the > time order (variable 2) > d2 > ID Begin_Time End_Time > 2 Jens 24/01/02 23/05/03 > 4 Jens 07/06/03 14/11/05 > 1 Thomas 11/03

[R] Voting power indices

2010-09-17 Thread Thomas Jensen
Dear R-experts, I was wondering if anyone know of a library in R that has functions for calculating the Banzhaf and Shaply-Shubik indeces? Best, Thomas __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

[R] YourCast Data Format

2011-01-08 Thread Thomas Jensen
Dear R-List, I have data that is collected in panels like this (output from the dput() function, the first 20 observations in the data set): structure(list(Country = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("Belgium", "Denmark"