Displaying 20 results from an estimated 700 matches similar to: "Combinations with two part column"
2005 Jun 01
7
Which variable exist after random
Dear R-helper,
How could I count only some variable was exist after running sample
(random) function.
For example,
> testx <- factor(c("Game","Paper","Internet","Time","Money"))
> for(i in 1:2) {
+ x <- sample(testx,replace=TRUE)
+ print(x)
+ }
[1] Money Money Time Internet Time
Levels: Game Internet
2012 Mar 28
6
How to get all possible combinations?
Dear all, suppose I have a vector with elements as:
Vec <- c(2,3,4,5,6)
Now I want to have all possible combination of length 3 using those
elements and without any repetition. Like, I want to have 1
possibility like 2-3-4 but not 3-2-4.
Can somebody guide me how to achieve that in R?
Thanks for your help.
2011 Nov 30
1
All combinations
Dear all,
I would like something simple to do in R that I do not know how I should search for it.
Let's say that I have a list of
a<-c(1,2,3,4,5)
b<-(6,7,8)
and I want to get back all their possible cominations like
1,6
1,7
1,8
2,6
2,7
2,8
3,6
3,7
3,8
and so on.
How I can do that?
B.R
Alex
[[alternative HTML version deleted]]
2013 Apr 24
2
Distance matrices Combinations
Dear UseRs,
MY PROBLEM IS A SMALL PIECE OF A REAL BIG AND A COMPLICATED PROBLEM. IF I DELIBERATE IN A VERY SIMPLE WAY THEN ALL I
WANT IS TO PUT ALL THE POSSIBLE COMBINATIONS OF 75 DISTANCE MATRICES (BY TAKING 4 MATRICES, MORE COMMONLY 75C4), in the following equation.
t<-as.matrix((MAT1)^2+(MAT2)^2+(MAT3)^2+(MAT4)^2+,upper=T,diag=T))
Then "1215450" values of "t"(one for
2009 Apr 16
2
Count data with several numbers separated by commas
Dear all,
I have a data file with 3 variables (x1, x2, x3) where variable x1
have data that consists of several numbers separated by commas.
id name x1 x2 x3
aa101 1,4,5 2 1
aa102 1,2,5 1 2
aa103 1,2,5 1 1
aa104 1,2,3 1 2
aa105 1,5 2 2
aa106 1,2,5 2 2
aa107 1,2,5 2 1
aa108 1,4,5 2 1
aa109 1,2 1 2
aa110 3,5 1 2
I want to count the number of data for each
2013 Jan 24
1
Copy on assignment and .Internal(inspect())
Hi,
I would like to know if it's ok to use .Internal(inspect(x)) in order
to detect vector copying.
Take for example the following silly code:
f <- function() {
x = seq(10)
print(.Internal(inspect(x)))
for(i in seq(10)) {
x[i] <- x[i] + 1
print(.Internal(inspect(x)))
}
}
The output of f() was:
@bd7acf0 13 INTSXP g0c4 [NAM(1)] (len=10, tl=0) 1,2,3,4,5,...
[1] 1 2
2011 Jan 09
1
Rectangle height in lattice xyplot key
Dear All
I have a problem with the height of the boxes in the key in the following.
(The text is over 2 lines to accentuate the problem of no space
between the rectangles.)
Is there an easy way to put a space between the rectangles; size
controls the width but there appears to be nothing for the height?
xyplot(1~1,
key = list(corner = c(0.8,0.8),
2010 Mar 04
1
sum of list elements
Dear list,
I have some difficulty in manipulating list elements. More specifically, I
am performing svm regression and have a list of lists, called pred.svm. The
elements of the second list are 3D arrays. Thus I have pred.svm[[i]][[j]],
with 1<=i<=5 and 1<=j<=20.
I want to take the sum of the elements a specific array dimension across all
j, for one i. Mathematically speaking, I want
2007 Jul 29
2
array writing and their filenames
Hi,
I want to save a array (say, array[6,7,8]) write a cvs file. How can I do
that??? can I write in one file?
if I could not write in one file, i want to use a loop to save in different
files (in the matrix[6,7,8], should be 8 csv files), such as the filename
structure should be: file ="filename" +str(i) +"." +"csv"
Many thanks.
Dong
[[alternative HTML version
2010 Aug 13
6
Equality of Vectors
Hello,
Is there a way to get a single TRUE or FALSE statement from comparing two
vectors? For example,
c(1,2,3) == c(1,2,3)
produces
TRUE TRUE TRUE
where I would like it to produce only
TRUE
for use in an if statement.
Likewise, when two vectors are not exactly identical (in all elements) I
would like a single FALSE result, as opposed to
c(1,2,3) == c(1,2,5)
TRUE TRUE FALSE
Any ideas?
2008 Jan 30
6
Schedule parser
Hi,
I was trying to schedule a worker to run during the midnight hour
like this:
:schedules:
:collector:
:process_something:
:trigger_args: 30 * 0 * * 2,3,4,5,6
When I try to start backgroundrb, the "collector" worker failed to
start up and I find this in backgroundrb_server.log:
/home/mengkuan/apps/testrailsapp/current/vendor/plugins/backgroundrb/
2007 Jul 29
2
write.csv
Hi,
I want to save an array(say, array[6,7,8]) write a cvs file. How can I do
that??? can I write in one file?
if I could not write in one file, i want to use a loop to save in different
files (in the array[6,7,8], should be 8 csv files), such as the filename
structure should be: file ="filename" +str(i) +"." +"csv"
Many thanks.
[[alternative HTML version
2005 Jun 04
1
barplot and missing values?
I want to include missing values in my barplot to get the correct x-axis,
for example,
x <- c(1,2,3,4, 9)
y <- c(2,4,6,8,18)
barplot(y)
The above looks wrong because the last height in y should be a long way
over.
So I want to do something like...
x <- c(1,2,3,4,5,6,7,8, 9)
y <- c(2,4,6,8,0,0,0,0,18)
barplot(y)
However...
I am actually using barplot2 to use the
2009 Aug 06
2
problem with r import data
Good moorning,
yesterday, i asked for how we can import data into R i found that it is necessary to make the file in csv format then use L<- read.csv2("path of file")
now i see that the dimension of my table importing into R is 1 colonne (i have realy 20) and (655555) the number of all my lines in the excel file (i want to have only the 2600 lines in my table)
Also, when i say to do
2011 Mar 15
1
Bug in lattice auto.key argument
The Lattice auto.key argument has a bug in R.12.2.
R version 2.12.2 (2011-02-25)
Platform: i386-pc-mingw32/i386 (32-bit)
....
other attached packages:
[1] lattice_0.19-17
loaded via a namespace (and not attached):
[1] grid_2.12.2
If I set up my plot parameters as
require(lattice)
superpose.line.settings <- trellis.par.get("superpose.line")
str(superpose.line.settings)
2007 Nov 19
4
sequence of vectors
Dear All,
I wonder if there is any R function to generate a sequence of vectors from existing ones. For example:
x 1<- c(1,2,3)
x2 <- c(4,5)
x3 <- c(6,7,8)
The desired output is a list of all 3*2*3 = 18 possible combinations of elements of x1,x2 and x3. One element for example is (1,4,6).
Many thanks in advance,
Bernard
2008 Jul 30
2
problem with read.table()
Hello R-User
I have a table as tab-delimited textfile (291 rows, 83 columns).
The first row are labels and the first line the variable names.
I used the following code several times with different similar tables and it
always worked.
But now:
setClass("of")
setAs("character", "of", function(from) as.ordered(from))
Classe82<-cclasses <-
2006 Apr 11
6
Oracle unit test problem in Rails 1.1.2/Ruby-OCI 0.1.14
I''ve upgraded to Rails 1.1.2, and I''m trying to push this change through
to our build server (Linux/Oracle) and we are getting some errors in the
unit tests using Oracle. Looking at the data in the tests reveals a
precision problem. Looking at the tables tells the whole story.
My development database contains this table:
SQL> describe dls_grids;
Name
2007 Jun 24
3
Facter operatingsystemrelease on Fedora
Currently, facter returns the kernel version as both the kernel and
operatingsystemrelease facts. I would like to change that so that on
Fedora, operatingsystemrelease is the release number (5,6,7 etc.) or
''Rawhide'' ... are there any objections to making that change ?
David
2008 Jul 14
5
A question about using function plot
Hello, everyone! I have spent two hours to get what I wanted in a simple situation and have not been successful. The set up is extremely simple
x = c(1,2,4,8)
y = c(1,2,3,4)
plot(x, y)
What I need, however, is for the 4 points of 1,2,4,8 to be spaced evenly, not by their numerical scale. Also, there should not be any other values such as 5,6,7 marked on the axis.
So I tried the following
x =