similar to: Combinations with restrictions

Displaying 20 results from an estimated 3000 matches similar to: "Combinations with restrictions"

2004 Mar 10
3
converting lists got by tapply to dataframes
I have two lists: xa <- list( X=c(1,2,3), Y=c(4,5,6), Z=c(7,8,9) ) xb <- with( barley, tapply( X=seq(1:nrow(barley)), INDEX=site , FUN=function(z)yield[z])) I can convert xa to a dataframe easily with: as.data.frame(xa) But if i try the same with xb I get: as.data.frame(xb) Error in as.data.frame.default(xb) : can't coerce array into a data.frame What
2008 Dec 30
3
Componentwise means of a list of matrices?
Dear useRs, I have a list, each entry of which is a matrix of constant dimensions. Is there a good way (i.e., not using a for loop) to apply a mean to each matrix entry *across list entries*? Example: foo <- list(rbind(c(1,2,3),c(4,5,6)),rbind(c(7,8,9),c(10,11,12))) some.sort.of.apply(foo,FUN=mean) I'm looking for a componentwise mean across the two entries of foo, i.e., the
2011 Mar 22
1
assigning a list item using a variable for a name
I have a list. my.list <- list(Tom=c(1,2,3), Dick=c(4,5,6), Harry=c(7,8,9)) I assign one of the names of the list to a variable. name <- "Harry" I can access the value of the list using the variable as follows: eval(parse(text=paste("my.list$", name, sep=""))) [1] 7 8 9 But how do I change the value of my.list$Harry using the variable name? This
2007 May 16
3
more woes trying to convert a data.frame to a numerical matrix
I have the following csv file: name,x,y,z category,delta,gamma,epsilon a,1,2,3 b,4,5,6 c,7,8,9 I'd like to create a numeric matrix of just the numbers in this csv dataset. I've tried the following program: sample.data <- read.csv("sample.csv") numerical.data <- as.matrix(sample.data[-1,-1]) However, print(numerical.data) returns what appears to be a matrix of
2010 Sep 01
3
standardize columns selectively within a dataframe
Dear all, I have a dataframe: df<-dataframe(a=c(1,2,3),b=c(4,5,6),c=c(7,8,9),d=c(10,11,12)) I want to obtain a new dataframe with columns a and b being standardized ((x-mean(x))/sd(x)); the other two columns (c,d) I want to leave unchanged. What is the best way to achieve this? I have been trying to use subscripts but did not succeed so far. Any tips? Many thanks, Olga
2010 Apr 22
2
Compare two data frames
I wonder if there is a more efficient way to do this task. Suppose I have two data frames, such as d1 <- data.frame(x = c(1,2,3), y = c(4,5,6), z = c(7,8,9)) d2 <- d1[, c('y', 'x')] The first dataframe d1 has more variables than d2 and the variable columns are in a different order. So, what I want to do is compare the two frames on the variables that are common between
2009 Sep 04
2
transforming a badly organized data base into a list of data frames
Dear R-ers! I have a badly organized data base in Excel. Once I read it into R it looks like this (all variables become factors because of many spaces and other characters in Excel):
2009 Sep 06
1
struggling with "split" function
I am very sorry for such a simple question, but I am struggling with "split". I have the following data frame: x<-data.frame(A=c(NA,NA,NA,NA,"split",NA,NA,NA,NA,"split",NA,NA,NA,NA,"split",NA,NA,NA,NA),
2013 Mar 09
3
data.frame with variable-length list
Hello, I'm trying to create a data frame with three columns, one of which is a variable-length list. I tried: df <- data.frame(name = c("a", "b", "c"), type=c(1, 2, 3), rtn = c(list(1,2,3), list(4, 5,6), list(7,8,9, 10) ) ) This would be useful, for example, if the 'rtn' is a variable number of
2011 Mar 26
2
How to deserialize an array from XML
Hi, to serialize an array to xml we can use: an_array = [ 1, 2, 3] an_array.to_xml But to I can''t find a way to convert back XML to array. I didn''t find a method Array.from_xml like Hash.from_xml. Any ideas? Thanks, Gustavo -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email
2010 Dec 14
4
Change primary_key column name
Hi, after changing a primary key column name, the auto-increment information (MySQL) and sequence (Oracle) are lost. What is the correct way to rename primary keys? Thanks, Gustavo -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2010 Nov 08
4
Create Matrix of 2 Dim from two vectors
Hello, I have two data. x<-c(1, 2, 3) y<-c(4,5,6) How do i create matrix of 3 by 3 from this two, such that (1,4) (1,5) (1,6) (2,4) (2,5) (2,6) (3,4) (3,5) (3,6) I tried some thing like this: xy <- as.data.frame(c(0,0,0), dim=c(3,3)) for(i in 1:3) for(j in 1:3) xy[i][j]<-c(x[i],y[j]) but i got errors..!!!! any help would appreciate -- View this message in
2010 Jul 14
1
Watermark with Ruby on Rails
To whom it may concern, a way to create watermarks with ruby on rails, imagemagick, attachment_fu and mini-magick in Portuguese, but the code is in English;) http://www.woompa.blog.br/2010/07/14/adicionando-marca-dagua-nas-suas-imagens-com-imagemagick-e-mini-magick/ Tnks! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post
2009 Dec 17
2
Problem with spliting a dataframe values
Hi all, Hi this is kiran I am facing a problem to split a dataframe that is.. i have a string like: "a,b,c|1,2,3|4,5,6|7,8,8" first I have to split with respect to "|" I did it with command unlist(strsplit("a,b,c|1,2,3|4,5,6|7,8,8", "\\,")) after getting that set i made it as a dataframe and it comes like a,b,c 1,2,3 4,5,6 7,8,8 now i have to
2011 May 01
2
More detailed Test::Unit error report
Hi, I''m starting to use Test::Unit to create unit tests for my Rails Applications/Plugins. I don''t have much experience in Ruby Unit Testing. The problem is that the output report is very simple and it is very difficult to discover where is the error. Test::Unit does not show the line number of the error and the Stack Trace printed using the --trace option does not help either.
2011 Jul 16
2
Finding all rows of a matrix equal to vector
Hi everyone, my question might be very trivial, but I could not come up with an answer... I want to find out how often a matrix contains a certain vector as row: x1<-c(1,2,3) x2<-c(1,5,6) x3<-c(7,8,9) A<-matrix(c(rep(x1,5),rep(x2,5),rep(x3,5),rep(x1,5)),nrow=20,ncol=3,byrow=T) How can I find out, how many times x1 is a row of A? Thanks in advance and best regards, Sebastian
2010 Aug 01
4
Admin interface for Rails?
Hello folks, I am currently working on a project that has to deliver an admin interface like the Django''s one, I wanna know if you know/ recommend any gem or plugin for that. Cheers, Rodrigo Alves Vieira -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2017 Sep 22
1
update numeric values of list with new values...
Well, that's a bit like driving from Boston to New York by way of Chicago. See ?structure test <- list(a=1,b=2,c=3) new <- c(4,5,6) test.new <- structure(as.list(new), names=names(test)) test.new $a [1] 4 $b [1] 5 $c [1] 6 Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka
2005 Feb 14
3
'combinations' in gtools and stack overflow
Dear R-users, Let me ask about the 'stack overflow' error which I got when I used the function 'combinations' in "gtools". The following is what I did: --------- library(gtools) options(expressions=1e5) combinations(500, 3, 1:500) # or combinations(400, 2, 1:400) Error: protect(): stack overflow --------- How can I overcome this error? Is there perhaps any other
2017 Sep 22
0
update numeric values of list with new values...
Solved it: test <- list(a=1,b=2,c=3) new <- c(4,5,6) hold <- as.list(new) updated_test <- replace(test,c(1:3),hold) $a [1] 4 $b [1] 5 $c [1] 6 mean.parms <- as.list(mean.parms) mm.parms <- replace(far.parms,c(1:length(far.parms)),mean.parms) On 9/22/2017 10:34 AM, Evan Cooch wrote: > Suppose I have the following: > > test <- list(a=1,b=2,c=3) > > I