Displaying 20 results from an estimated 10000 matches similar to: "Lattice - parallel: xlim and adding lines"
2011 Mar 14
2
*Building* a covariance matrix efficiently
deaRs,
I want to build a covariance matrix out of the data from a binary
file, that I can read in chunk by chunk, with each chunk containing a
single observation vector X. I wonder how to do that most efficiently,
avoiding the calculation of the full symmetric matrices XX'. The
trivial non-optimal approach boils down to something like:
Q <- matrix(rnorm(100000),ncol=200)
M <-
2011 Apr 17
5
cube root
This is some interesting:
> -8^(1/3)
[1] -2
> x=(-8:8)
> y=x^(1/3)
> y
[1] NaN NaN NaN NaN NaN NaN NaN NaN
0.000000 1.000000
[11] 1.259921 1.442250 1.587401 1.709976 1.817121 1.912931 2.000000
So, can anybody explain this?! (Why is x[1]^(1/3)=y[1]=NaN, but
-8^(1/3)=-2?)
Thx!!!
[[alternative HTML version deleted]]
2011 Aug 24
3
Efficient way to Calculate the squared distances for a set of vectors to a fixed vector
I am pretty new to R. So this may be an easy question for most of you.
?
I would like to calculate the squared distances of a large set (let's say 20000) of vectors (let's say dimension of 5) to a fixed vector.
?
Say I have a data frame MY_VECTORS with 20000 rows and 5 columns, and one 5x1 vector y. I would like to efficiently calculate the squared distances?between each of the 20000
2011 Feb 08
2
Plot colour according to column
Hi,
I am trying to plot several columns in different graphs in columns and rows.
The first column of my data file is the time, and the third is the
'elevation angle' with 19 different numbers. I would like to plot the rest
of the columns with the x axis as time and the individual angles in
different colours.
Here is the code I am using right now. It plots the different columns with
time,
2009 Mar 27
3
color vectors other than gray()
I'm trying to create a graph where different cells of a grid (a shapefile)
will be painted with a color share scale, where the most easy way is to use
gray().
Can I somehow get a vector (gradient) of colors, a vector of colors with
other methods but gray()?
I'm doing this until now
quad_N_sp <-
2012 Mar 14
3
Creating 250 submatrices from a large single matrix with 2500 variables using loops
Dear all,
I have a large matrix with about 2500 variables, and 100 rows.
I would like to calculate the means of the every 10 variables starting from
1:2500 and saving the results as a vector or matrix.
How can I do that?
Alternatively, How can I create 250 subset matrices in the order of
variables 1:2500 in groups of 10 from the single matrix which had initially
2500 variables ?
I guess I have
2013 Jan 21
2
Regex for ^ (the caret symbol)?
Hello R-helpers,
I am trying to search for string that includes the caret symbol, using the
following code:
grepl("latitude^2",temp)
And R doesn't like that. It gives me:
> temp<-c("latitude^2","latitude and latitude^2","longitude^2","longitude
and longitude^2")
> temp
[1] "latitude^2" "latitude and
2007 Aug 24
2
Applying a function to an array
Dear R-users,
I would like to apply a function (more precisely sd()) over the third dimension of a three-dimension array. The function apply would be interesting but the chosen function can only be applied on the rows and columns of the array according to the help file. I can use a loop to cut the array in matrices and then use apply for each replication, but it's not very nice. A small
2008 Jul 18
2
matrix multiplication question
Hello,
I am a newcomer to R and therefore apologize for posting such a
basic question. I am
trying to multiply 2 matrices t(X1)%*%X1, where t(X1) is:
1 2 3 4 5 8 12 13 20 24 26 27 31 33 34 36 37 40 41 42 45 46
47 48 49
ones 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1
Shadow 0 1 1 1 1 1 1 1 0 1 1 1 1 0 1 0
2012 Feb 15
3
built a lower triangular matrix from dataframe
Hello!
I'm trying to build a lower triangular matrix (with zeros in the diagonal)
from a particular dataframe.
The matrix I have to construct has 203 rows and 203 columns and that makes
20503 values to be included within (that's why I can't do it manually).
To illustrate the dataframe I have, I'll give you an example of a dataframe
and matrix with dimensions 6x6 (to make it
2011 Feb 13
4
A Math question
Dear all, I admit this is not anything to do R and even with
Statistics perhaps. Strictly speaking this is a math related question.
However I have some reasonable feeling that experts here would come up
with some elegant suggestion to my question.
Here my question is: What is sum of all Integers? I somewhere heard
that it is Zero as positive and negative integers will just cancel
each other out.
2005 Feb 17
1
Factor level coloring in trellis plot
Hi :)
Was just wondering whether someone could help me with
adjustments to trellis plots (parallel).
I've got two way multivariate data. I want to make
parallel plots for one of the factors, and want to color
the lines according to the other factor. The first thing I
manage, but with the other I'm lost :( Can only change the
overall color.
This is basically how far I get:
2009 Mar 19
2
find the index of the smallest or biggest number in a vetor or data.frame
Dear R experts,
How to find out the index of minimum or maxmum number in a vetor or
data.frame?
For example,
a=
n price
1 50
-2 100
0 200
-1 300
......
I want to find out the row which the n is the smallest or largestest and
extract the price.
Thanks
Ted
--
View this message in context:
2011 Feb 23
4
The L Word
I've been wondering what L means in the R computing context, and was
wondering if someone could point me to a reference where I could read about
it, or tell me what it's called so that I can search for it myself. (L by
itself is a little too general for a search term).
I encounter it in strange places, most recently in the "save" documentation.
save(..., list = character(0L),
2006 Sep 20
5
multiple lines and plot
Hi. Please, how can I put together 2 or more lines at the same
scatterplot ? Example: measures of protein intake (quantitative) of 4
children over 30 days, by day. How to plot all children at same graphic:
Protein X Time ? Is there any command like "overlay" ?
Thank you,
Mauricio
2012 Aug 10
3
Parsing large XML documents in R - how to optimize the speed?
Hello everyone,
I would like to parse very large xml files from MS/MS experiments and
create R objects from their content. (By very large, I mean going up to
5-10Gb, although I am using a 'small' 40M file to test my code.)
My first attempt at parsing the 40M file, using the XML package, took more
than 2200 seconds and left me quite disappointed.
I managed to cut that down to around 40
2011 Jan 26
3
Need help with my homework
Hello to all again :)
Again, I have an issue with my homework. I was troubling myself for two
days, and I still can't get it :(
So, if someone can help me, I would be so grateful...
HOMEWORK 1.
I need to draw function,
random walk take the length of walk, and its in 2D. As a result, I have to
take matrix in which are i-lines of matrix, written coordinates on i-steps
radnom.walk <-
2011 Apr 07
1
Two questions about metacharacter in regexprs and function return
for the script, please kindly see the script below. At line 10 and line 13,
my problems occurs.
The first one is I try to retrieve the gene official name from a column of a
table. The pattern of official name is something starting with gene_name.
For detail problems, please see the according lines.
Any suggestions are appreciated
example of matching source (extract the Nnat, sometime it would
2008 Jun 16
1
Separator with " | " for read.table
Hi,
I have the following data file to be parsed and captured as a data frame:
__DATA__
#GDS_ID GENE_NAME GENE_DESCRIPTION GENE_FUNCTION
1007_s_at | DDR1 | discoidin domain receptor tyrosine kinase 1 | protein-coding
1053_at | RFC2 | replication factor C (activator 1) 2, 40kDa | protein-coding
117_at | HSPA6 | heat shock 70kDa protein 6 (HSP70B') | protein-coding
__END__
In particular it is
2024 Apr 16
5
read.csv
Dear R-developers,
I came to a somewhat unexpected behaviour of read.csv() which is trivial but worthwhile to note -- my data involves a protein named "1433E" but to save space I drop the quote so it becomes,
Gene,SNP,prot,log10p
YWHAE,13:62129097_C_T,1433E,7.35
YWHAE,4:72617557_T_TA,1433E,7.73
Both read.cv() and readr::read_csv() consider prot(ein) name as (possibly confused by