Displaying 20 results from an estimated 600000 matches similar to: "why the dim gave me different results"
2010 Nov 04
4
how to work with long vectors
HI, Dear R community,
I have one data set like this, What I want to do is to calculate the
cumulative coverage. The following codes works for small data set (#rows =
100), but when feed the whole data set, it still running after 24 hours.
Can someone give some suggestions for long vector?
id reads
Contig79:1 4
Contig79:2 8
Contig79:3 13
Contig79:4 14
Contig79:5 17
2010 Jun 01
3
problem with intToChar
Hi, Dear R- community,
I am use the intToChar function to convert the integers to letters. But the
output is mess. Can you guys give some suggestions? Thanks!
> outcome.predict
[1] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 7 4 4 4 4 4 4
4 4
[26] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 7 4 4 4 4 4 7 4 4
4 4
[51] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
2010 May 26
1
how to Store loop output from a function
HI, Dear R community,
I am writing the following function to create one data set(*tree.pred*) and
one vector(*valid.out*) from loops. Later, I want to use the data set from
this loop to plot curves. I have tried return, list, but I can not use the
*tree.pred* data and *valid.out* vector.
auc.tree<- function(msplit,mbucket) {
* tree.pred<-data.frame()
2011 Sep 01
3
how to split a data frame by two variables
HI, Dear R community,
I want to split a data frame by using two variables: let and g
> x = data.frame(num =
c(10,11,12,43,23,14,52,52,12,23,21,23,32,31,24,45,56,56,76,45), let =
letters[1:5], g = 1:2)
> x
num let g
1 10 a 1
2 11 b 2
3 12 c 1
4 43 d 2
5 23 e 1
6 14 a 2
7 52 b 1
8 52 c 2
9 12 d 1
10 23 e 2
11 21 a 1
12 23 b 2
13 32 c 1
14
2010 Jun 24
1
help in SVM
HI, GUYS,
I used the following codes to run SVM and get prediction on new data set hh.
dim(all_h)
[1] 2034 24
dim(hh) # it contains all the variables besides the variables in all_h
data set.
[1] 640 415
require(e1071)
svm.tune<-tune(svm, as.factor(out) ~ ., data=all_h,
ranges=list(gamma=2^(-5:5), cost=2^(-5:5)))# find the best parameters.
bestg<-svm.tune$best.parameters[[1]]
2010 May 25
4
R eat my data
HI, Dear R community,
My original file has 1932 lines, but when I read into R, it changed to 1068
lines, how comes?
cdu@nuuk:~/operon$ wc -l id_name_gh5.txt
1932 id_name_gh5.txt
> gene_name<-read.table("/home/cdu/operon/id_name_gh5.txt", sep="\t",
skip=0, header=F, fill=T)
> dim(gene_name)
[1] 1068 3
--
Sincerely,
Changbin
--
Changbin Du
DOE Joint Genome
2005 Dec 08
1
kronecker(... , make.dimnames=TRUE)
Hi
I'm using kronecker() with a matrix and a vector. I'm interested in
the column names that kronecker() returns:
> a <- matrix(1:9,3,3)
> rownames(a) <- letters[1:3]
> colnames(a) <- LETTERS[1:3]
> b <- c(x=1,y=2)
> kronecker(a,b,make.dimnames=TRUE)
A: B: C:
a:x 1 4 7
a:y 2 8 14
b:x 2 5 8
b:y 4 10 16
c:x 3 6 9
c:y 6 12 18
>
The
2001 Dec 03
6
appending similar data frames?
Dear R gang,
Can anyone help me sort out how to append one data frame to
another while adding a factor to distinguish which was the
original frame?
For example, I have two frames, x and y
> x
exp size
1 a 10
2 b 9
3 c 10
4 d 12
5 e 11
> y
exp size
1 a 13
2 b 15
3 c 12
4 d 20
5 e 15
and I'd like to create a new frame that looks like
2010 May 11
1
how to extract the variables used in decision tree
HI, Dear R community,
How to extract the variables actually used in tree construction? I want to
extract these variables and combine other variable as my features in next
step model building.
> printcp(fit.dimer)
Classification tree:
rpart(formula = outcome ~ ., data = p_df, method = "class")
Variables actually used in tree construction:
[1] CT DP DY FC NE NW QT SK TA WC WD WG WW
2023 Aug 06
1
Stacking matrix columns
Or just dim(x) <- NULL.
(as matrices in base R are just vectors with a dim attribute stored in
column major order)
ergo:
> x
[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
> x<- 1:20 ## a vector
> is.matrix(x)
[1] FALSE
> dim(x) <- c(5,4)
> is.matrix(x)
[1] TRUE
> attributes(x)
$dim
[1] 5 4
> ## in painful and unnecessary detail as dim() should
2009 Sep 30
1
How to calculate KMO?
Hi All,
How do i calculate KMO for a dataset?
*Dataset:---------------------*
m1 m2 m3 m4 m5 m6 m7 m8
1 2 20 20 2 1 4 14 12
2 9 16 3 5 2 5 5 15
3 18 18 18 13 17 9 2 4
4 7 7 2 12 2 11 11 11
5 7 8 5 19 5 2 20 18
6 7 4 7 4 7 9 3 3
7 5 5 5 12 5 13 13 12
8 6 6 4 3 5 17 17 16
9 12 12 4 2 4 4 14 14
10 5 14
2012 Oct 07
3
what exactly is the dim of data set yarn in package "pls"?
Hi list,
I am looking at the data yarn in package, I don't understand what is
dimension of this data set.
I did the following:
> library(pls)
> data(yarn)
> dim(yarn)
[1] 28 3
> head(yarn)
NIR.1 NIR.2 NIR.3 NIR.4 NIR.5 NIR.6 NIR.7 NIR.8 NIR.9
NIR.10 NIR.11
1 3.06630 3.08610 3.10790 3.09720 2.99790 2.82730 2.62330 2.40390 2.19310
2.00580 1.83790
2
2009 Aug 12
2
Problem with function in fortran 95
I am writing a function in fortran 95, but the intrinsic function MATMUL is not working properly. Here's an example.
SUBROUTINE mymult(x,y,res,m,n)
IMPLICIT NONE
INTEGER :: m,n
REAL :: x, y, res
DIMENSION :: x(m,n), y(n,m), res(m,m)
res = MATMUL(x,y)
END SUBROUTINE mymult
R CMD SHLIB mat.f95
In R:
dyn.load("mat.so")
x <-
2023 Aug 06
2
Stacking matrix columns
You could also do
dim(x) <- c(length(x), 1)
On Sat, Aug 5, 2023, 20:12 Steven Yen <styen at ntu.edu.tw> wrote:
> I wish to stack columns of a matrix into one column. The following
> matrix command does it. Any other ways? Thanks.
>
> > x<-matrix(1:20,5,4)
> > x
> [,1] [,2] [,3] [,4]
> [1,] 1 6 11 16
> [2,] 2 7 12 17
> [3,]
2012 Jun 04
2
Convert 2-dim array to 3-dim array
Hello R-users,
I'd like to load data from a CSV-file to a 3-dimensional array. However
the default seems to be 2-dimensional. It would also be ok to load the
data and then convert it to a 3-dimensional structure.
I've been trying:
dat = read.csv(filename)
myArr = as.array(dat, dim = c(12,100,3))
However, I get an error message:
Error in `dimnames<-.data.frame`(`*tmp*`,
2023 Aug 06
1
Stacking matrix columns
Stacking columns of a matrix is a standard operation in multilinear
algebra, usually written as the operator vec().
I checked to see if there is an R package that deals with multilinear
algebra. I found rTensor, which has a function vec().
So, yet another way to accomplish what you want would be:
> library(rTensor)
> vec(as.tensor(x))
Eric
On Sun, Aug 6, 2023 at 5:05?AM Bert Gunter
2014 Apr 26
1
SIGSEGV with pam_winbind kerberos authentication
Hello,
I can't get Kerberos authentication works with my Linux clients.
Server : samba 4.1.4 (compiled from source)
Client : Debian Wheezy with sernet-samba 4.0.17-8
Without Kerberos authentication, everything works :
-> the domain users can log with pam_winbind (with ssh, gdm ....).
-> "kinit myuser at MYREALM" works fine.
-> "wbinfo -K MYDOM\\myuser" works.
2010 Oct 12
1
need help with nnet
HI, Dear R community,
My data set has 2409 variables, the last one is response variable. I have
used the nnet after feature selection and works. But this time, I am using
nnet to fit a model without feature selection. I got the following error
information:
> dim(train)
[1] 1827 2409
nnet.fit<-nnet(as.factor(out) ~ ., data=train, size=3, rang=0.3,
decay=5e-4, maxit=500) # model
2007 Jan 30
5
how to join two arrays using their column names intersection
Dear all,
I have a problem that may be someone of you can help. I am a newbie and
do not find how to do it in manuals.
I have two arrays, for example:
ar1 <- array(data=c(1:16),dim=c(4,4))
ar2 <- array(data=c(1:16),dim=c(4,4))
colnames(ar1)<-c("A","B","D","E")
colnames(ar2)<-c("C","A","E","B")
> ar1
2004 Sep 13
1
do.call("dim<-" , ... )
OK guys
another problem. I have a 3D array "x" with dim(x)=c(a,a,b^2)
and I want to rearrange the elements of x to make a matrix "y"
with dimensions c(a*b,a*b). Neither a nor b is known in advance.
I want the "n-th" a*a submatrix of y to be x[,,n] (where 1 <= n <=
b^2). Needless to say, this has gotta be vectorized!
Toy example with a=2, b=3 follows: