similar to: Creating 250 submatrices from a large single matrix with 2500 variables using loops

Displaying 20 results from an estimated 3000 matches similar to: "Creating 250 submatrices from a large single matrix with 2500 variables using loops"

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 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 05
3
Dropping rows conditionally
Dear R-help team, I am getting addicted to using R but keep on getting many challenges on the way especially on data management (data cleaning). I have been wanting to drop all the rows if there values are `NA' or have specific values like 1 or 2 or 3. mdat <- matrix(1:21, nrow = 7, ncol=3, byrow=TRUE, dimnames = list(c("row1",
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 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 <-
2008 Jul 22
3
Error in installing packages
Dear R Users; I am an R user who has recently bought a new laptop;Toshiba Satellite U405 running on both Windows Vista and Ubuntu. I have problems on the wondows vista when installing packages. The argument 'lib' is missing. How do i solve this problem? Illustration: > install.packages("epicalc") Warning in install.packages("epicalc") : argument 'lib'
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.
2009 Aug 20
2
getting R 2.9.1 from the tar.gz file
Dear Sir, I am almost giving up on getting the R-2.9.1 on the ubuntu 9.04 using the instructions found on the R site. I decided to use the R-2.9.1.tar.gz and untarred it. I then typed ./configure and the results are shown below. However, on typing make, I got an error, "No targets specified and no makefile found stop" What is the solution? lmramba at LMramba-dll-d:~$ su Password:
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),
2008 Aug 06
3
Help in running Stata dataset in R
Dear All, I installed R 2.7.0 and tried to call a dataset i had ealier own called on R2.6.2 but i keep on getting an error: use("maltreat.dta") Error in fromchar(x) : character string is not in a standard unambiguous format Tried doing the same with R2.7.1 but i get the same error. However if i call the same on R 2.6.2, there is no error: use("maltreat.dta") > des()
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 <-
2009 Oct 10
1
Setting a mirror "permanently" on R on ubuntu
Dear all, I seem to have many problems as I run R on my ubuntu system. want to set a mirror so that anytime I use the command "install.packages", it does not ask me for which mirror to use but go direct. This is because of the error I keep on getting below and I dont know how to solve it. Please help. Kind regards, Lazarus > library(epicalc) Loading required package: foreign
2009 Oct 10
1
Errors in installing package "rJava" on Ubuntu (PR#13992)
*Hello, I have had this serious problem while trying to install package rJava. It is a requirement by the package JGR and it cannot be downloaded due to the error indicated below. I have googled and looked at the FAQ but no solution yet. Please advise. Kind regards, Lazarus > install.packages("rJava")* Warning in install.packages("rJava") : argument 'lib' is
2009 Oct 10
1
Setting a mirror "permanently" on R on ubuntu (PR#13995)
Dear all, I seem to have many problems as I run R on my ubuntu system. want to set a mirror so that anytime I use the command "install.packages", it does not ask me for which mirror to use but go direct. This is because of the error I keep on getting below and I dont know how to solve it. Please help. Kind regards, Lazarus > library(epicalc) Loading required package: foreign
2009 Oct 10
1
rJava downloads but cannot load, when I run R as root (PR#13994)
> library(rJava) Error in library(rJava) : there is no package called 'rJava' > install.packages("rJava") Warning in install.packages("rJava") : argument 'lib' is missing: using '/usr/local/lib/R/site-library' --- Please select a CRAN mirror for use in this session --- Loading Tcl/Tk interface ... done trying URL
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 Jul 26
0
Diagonal Submatrices Extraction
Yes you are right ... an example is mandatory. So ... I have a matrix of 0 with just a single 1 per row and per column I need to extract all maximal 'diagonal' submatrices Let's say I have the following matrix A B C D E a 0 1 0 0 0 b 1 0 0 0 0 c 0 0 1 0 0 d 0 0 0 1 0 e 0 0 0 0 1 well I would like to get, for this example, the two following submatrices A B C D E
2012 Oct 30
2
Put submatrices in an array
Dear R users, I have a Hadamard matrix 16x15 and i want to put 16x5 submatrices in an array put i have an error. > A1<-matrix(c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1, + 0,1,1,0,0,1,1,0,0,1,1,0,0,1,1, + 1,1,0,0,1,1,0,0,1,1,0,0,1,1,0, + 0,0,0,1,1,1,1,0,0,0,0,1,1,1,1, + 1,0,1,1,0,1,0,0,1,0,1,1,0,1,0, + 0,1,1,1,1,0,0,0,0,1,1,1,1,0,0, + 1,1,0,1,0,0,1,0,1,1,0,1,0,0,1, +
2012 Oct 22
4
Help with applying a function to all possible 2x2 submatrices
Hi all, I'm working with a large data set (on the order of 300X300) and trying to apply a function which compares the elements of all possible 2x2 submatrices. There are rc(r-1)(c-1) such submatrices, so obviously the naive method of looping through the rows and columns is computationally unfeasible for my data set: for(i in 1:(nrow(data)-1)) { for(j in (i+1):nrow(data)) { for (m