Displaying 20 results from an estimated 700 matches similar to: "splitting matrices"
2012 Oct 18
4
speeding read.table
R 2.15.1
OS X
Colleagues,
I am reading a 1 GB file into R using read.table. The file consists of 100 tables, each of which is headed by two lines of characters.
The first of these lines is:
TABLE NO. 1
The second is a list of column headers.
For example:
TABLE NO. 1
COL1 COL2 COL3 COL4 COL5 COL6 COL7 COL8 COL9 COL10
2013 Jan 02
4
list of matrices
dear useRs,
i have a list containing 16 matrices. i want to calculate the column mean of each of them.
i tried
>sr <- lapply(s,function(x) colMeans(x, na.rm=TRUE))
but i am getting the following error
>Error in colMeans(x, na.rm = TRUE) : 'x' must be numeric
can it be done in any other way? and why i am getting this error??
thanks in advance..
elisa
[[alternative
2005 May 02
4
"apply" question
Dear R users,
I??ve got a simple question but somehow I can??t find the solution:
I have a data frame with columns 1-5 containing one set of integer
values, and columns 6-10 containing another set of integer values.
Columns 6-10 contain NA??s at some places.
I now want to calculate
(1) the number of values in each row of columns 6-10 that were NA??s
(2) the sum of all values on columns 1-5
2012 Nov 23
6
Summary statistics for matrix columns
Hi,
is there a way I can calculate a summary statistics for a columns matrix
let say we have this matrix
x <- matrix(sample(1:8000),nrow=100)
colnames(x)<- paste("Col",1:ncol(x),sep="")
if I used summary
summary(x)
i get the output for each column but I need the output to be in matrix with
rownames and all the columns beside it
this how I want it
2006 Nov 30
4
Quicker way of combining vectors into a data.frame
Hi,
In a function, I compute 10 (un-named) vectors of reasonable length
(4471 in the particular example I have to hand) that I want to combine
into a data frame object, that the function will return.
This is very slow, so *I'm* doing something wrong if I want it to be
quick and efficient, though I'm not sure what the best way to do this
would be.
I know it is the combining into data
2005 Apr 14
4
data manipulation
Hello,
my question is about the data handling.
I have a data set that is lined as:
4 1 17 1 1
-5.1536 -0.1668 -2.3412 -0.5062 0.9621 0.3640 0.3678 -0.5081 -0.2227
0.8142 -0.0389 -0.0445 -0.0578 -0.1175 -0.1232 0.8673 -0.1033 -0.0796
-0.0341 -0.1716 -0.1801 -0.7014 0.6578 0.5611
4 1 17 2 1
-5.1536 -0.1668 -2.3412 -0.5062 0.9621 0.3640 0.3678 -0.5081 -0.2227
0.8142 -0.0389 -0.0445
2016 Dec 20
2
colnames for data.frame could be greatly improved
Hello,
colnames seems to be not optimized well for data.frame. It escapes
processing for data.frame in
if (is.data.frame(x) && do.NULL)
return(names(x))
but only when do.NULL true. This makes huge difference when do.NULL
false. Minimal edit to `colnames`:
if (is.data.frame(x)) {
nm <- names(x)
if (do.NULL || !is.null(nm))
return(nm)
else
2006 Mar 28
1
weights in glm (PR#8720)
Full_Name: Robert Pusz
Version: 2.2.1
OS: Windows
Submission from: (NULL) (157.25.9.126)
Hello,
In my opinion something is wrong with 'weights' option in glm.
My code is following:
###begin of the code####
cl <- c(5012, 106, 3410, 5655, 1092, 1513, 557, 1351, 3133, 2063, 3257,
4179, 5582, 5900, 8473, 4932, 3463, 5596, 2262, 0, 2638, 1111,
4881, 4211, 6271, 5257, 6926, 6165, 0, 0,
2005 Mar 23
2
replace values in a matrix subject to boolean condition
Hi everybody!
I am sorry to bother you with a question so simple but
I think there might be a
better solution:
I have a matrix of size 360x501 where I want to check
the value of each 5th
column of each row and replace it (and the 6th, 7th,
8th column) by zero if the
value is less than 1000. I have written a double loop
to do that but that
requires a lot of time.
Is there a faster way to
2009 Nov 05
1
Set colors in a PCA plot based on a gradient vector
Hi all,
I'm making a PCA plot with eight variables (columns taken from a larger data frame "fieldTrial0809[idx,c(39:46)]"). I then want the symbols in the plot to be colored as a gradient from red to blue, depending on the value of another column in "fieldTrial0809[idx, c(48)]" containg temperatures from -12.1 to -5.4.
I don't want to use the heat.colors(n)
2012 Feb 15
1
neuralnet problem
Hello List !
I'm a bright new R user, and I encounter a problem when trying to use the neuralnet package.
I have a training set with 8 inputs, and there are 3 outputs (I need 3 distinct neurones as output). Although I read the examples, and the package article, I don't know how to tell R there are 3 outputs (3 outputs neurones).
Here is my actual code :
# All = input data
All <-
2005 Feb 22
3
Reproducing SAS GLM in R
Hi,
I'm still trying to figure out that GLM procedure in SAS.
Let's start with the simple example:
PROC GLM;
MODEL col1 col3 col5 col7 col9 col11 col13 col15 col17 col19 col21 col23
=/nouni;
repeated roi 6, ord 2/nom mean;
TITLE 'ABDERUS lat ACC 300-500';
That's the same setup that I had in my last email. I have three factors:
facSubj,facCond and facRoi. I had this pretty
2011 Aug 25
2
replicate lines of data frame
Greetings!
I am just now learning to use R for my dissertation project. I need
to manipulate a lot of text and numeric data. I created a data frame
that has 7 columns and 127 unique rows. Now I need to replicate each
line 6 times and then later change values in the first 2 columns.
I am trying to figure out how to accomplish this. I think that I need
to use rep(my.df, each=6) but it does
2016 Dec 27
0
colnames for data.frame could be greatly improved
Hi there,
Any update on this?
Should I create bugzilla ticket and submit patch?
Regards
Jan Gorecki
On 20 December 2016 at 01:27, Jan Gorecki <J.Gorecki at wit.edu.pl> wrote:
> Hello,
>
> colnames seems to be not optimized well for data.frame. It escapes
> processing for data.frame in
>
> if (is.data.frame(x) && do.NULL)
> return(names(x))
>
> but
2006 Jan 23
4
Converting from a dataset to a single "column"
I have a dataset of 3 ?columns? and 5 ?rows?.
temp<-data.frame(col1=c(5,10,14,56,7),col2=c(4,2,8,3,34),col3=c(28,4,52,34,67))
I wish to convert this to a single ?column?, with
column 1 on ?top? and column 3 on ?bottom?.
i.e.
5
10
14
56
7
4
2
8
3
34
28
4
52
34
67
Are there any functions that do this, and that will
work well on much larger datasets (e.g. 1000 rows,
6000 columns)?
2006 Dec 14
5
Better way to change the name of a column in a dataframe?
Hello R users --
If I have a dataframe such as the following, named "frame" with the
columns intended to be named col1 through col6,
> frame
col1 col2 cmlo3 col4 col5 col6
[1,] 3 10 2 6 5 7
[2,] 6 8 4 10 7 1
[3,] 7 5 1 3 1 8
[4,] 10 6 5 4 9 2
and I want to correct or otherwise change the
2006 May 15
1
what's wrong with my "gls"? it does not allocate memory... even for the simplest AR1 model...
> myfit1 <- gls(col1 ~ col2+col3+col4+col5+col6-1, data=data2, corr=corAR1(
0.3202), method='ML')
Error: cannot allocate vector of size 199712 Kb
if I get rid of the "corr=corAR1(0.3202)" option, it works okay...
can anybody help me?
thanks a lot!
[[alternative HTML version deleted]]
2009 Nov 04
4
read.table (again)
Dear R commnuity,
Thanks a lot for your help.
I want to read in tables, the problem is that the table is composed in a
difficult way. In ariginal it looks like this:
669 736 842101610481029114711811166124312081128117611221026 9581024 992
685 720 829 925 995 96010241057116611501104106410711092 983 908 989 904
924 896 882 897 909 933 928 907 916 902
546 734 784 868 970 954
2007 Jan 06
2
Get column value of col1 .. col10
Hi,
I have a table with column name like col1, col2, col3, col4 ... col10.
In rails, after I get the instance of the class, I would like to use a
for loop to retrieve values from these columns and put them into a hash.
The hash will be used for another find call. Is that possible?
Thanks.
Arnold
--
Posted via http://www.ruby-forum.com/.
2012 Jun 07
1
select subrows based on a specific column in a matrix
Hi all,
I have a matrix with 10000 rows and 10 columns. The last columns contains another identifiers but the values are not uniques so that I want to generate another matrix with rows with unique values in the last column.
If I did
tmp<-unique(my_mat$col10)
this will give me 8560 unique entries so the ideal matrix will be 8560X10 columns now then.
I tried
sub_mat<-my_mat[tmp,]
but