similar to: Faster way to do it??...using apply?

Displaying 20 results from an estimated 50000 matches similar to: "Faster way to do it??...using apply?"

2011 May 12
3
Help with "apply"
Hello R gurus, I have a simple routine using for loops that i was just trying to make it faster y <- rnorm(10) Nindiv <- 10 x <-matrix(sample(c(0:2),50,re = T),10) gtemp <- rnorm(10) ycorr <- array(0,c(Nindiv,1)) for (i in 1:Nindiv) { for (k in 1:ncol(x)) { ycorr[i] <- y[i] - x[i,k]*gtemp[k] } } It works fine but I wanted to make it faster and I think an apply function
2009 Oct 28
1
Is there a faster way to do it?
#Mdarts is a matrix 2343x788 #frequencia is a vector 2343x1 # 9 in Mdarts[fri,frj] stands for my missing values which i want to replace by the value in the vector frequencia Mdarts<-t(matrix(scan("C:/GWS/CNB/dartg.txt"),ncol=nindT,nrow=nm, byrow=T)) frequencia <- matrix(scan("C:/GWS/CNB/freq.txt"),ncol=1) for (fri in 1:nindT){ for (frj in 1:nm){ Mdarts[fri,frj] <- if
2010 Oct 29
2
Differenciate numbers from reference for rows
So, I am having a tricky reference file to extract information from. The format of the file is x 1 + 4 * 3 + 5 + 6 + 11 * 0.5 So, the elements that are not being multiplied (1, 5 and 6) and the elements before the multiplication sign (4 and 11) means actually the reference for the row in a matrix where I need to extract the element from. The numbers after the multiplication sign are regular
2006 May 30
3
Faster way to zero-pad a data frame...?
Hello List, I am working on creating periodograms from IP network traffic logs using the Fast Fourier Transform. The FFT requires all the data points to be evenly-spaced in the time domain (constant delta-T), so I have a step where I zero-pad the data. Lately I've been wondering if there is a faster way to do this. Here's what I've got: * data1 is a data frame consisting of
2006 Dec 10
4
sample "n" random positions from a matrix
Hi there, I have a binary matrix (dim 100x100) filled with values 0 and 1. I need select a record "n" positions of that matrix when values are 1. How can I do that? Thanks for all, Miltinho Brazil --------------------------------- [[alternative HTML version deleted]]
2010 Apr 16
3
Is it ok to apply the z.test this way?
Dear R-users, I want to check if certain values are from random distribution, that includes values between 0-1. So, it is not really normal even though shapiro.test says it is highly normal... Can I do something like this and think that the values given are right. z.test is from package TeachingDemos. -------------------------------------------------------------------------------
2010 Oct 29
3
How to scan df from a specific word?
Hi R-helpers, I need to read some file with different lines (I don't know the number of lines to skip) and I would like to find a way to start reading the data.frame from the word "source". ex: djhsafk asdfhkjash shdfjkash asfhjkash #those lines contain numbers and words, I want to skip then but they have different sizes asdfhjkash asdfhjksa source tret 2 res 3 Can
2009 Sep 27
2
Count number of zeros in a collumn
I have a matrix 700x2000 which is sampled in each cycle from another matrix 788x2000 with the numbers 0,1 and 9 There is one specific collumn of this matrix, dart[,1977], that usually, after the samplimg procedure has only 1 and 9 (because the zero frequency in this collumn is low). However, when this happens, I want to include an IF conditional in my code. so basically what i wanted to do was to
2012 Mar 22
2
Quicker way to apply values to a function
Hi all, myint=function(mu,sigma){ integrate(function(x) dnorm(x,mu,sigma)/(1+exp(-x)),-Inf,Inf)$value } mymu=seq(-3,3,length(1000)) mysigma=seq(0,1,length(500))[-1] k=1 v=c() for (j in 1:length(mymu)) { for (i in 1:length(mysigma)) { v[k]=myint(mymu[j],mysigma[i]) k=k+1 } } Basically, I want to investigate for what values of mu and sigma, the integral is divergent. Is there another way
2010 Mar 26
2
Is there a faster way to do this?
Hi guys, I am still learning R, and not well familiar with all the apply functions. I am trying to find faster alternatives to replace the for cycle. Is there a faster way to do the example below? nm <- 1000 b <- matrix (rnorm (5000, 0, 1), nrow = 500, ncol = nm) a <- matrix (0, nm, nm) for (i in 1 : nm) { for (j in 1 : nm) { if ( j == i) { next } a[i, j] <- t (b [, i]) %*% b[, j] } }
2006 Nov 07
2
changing image dimensions
Um texto embutido e sem conjunto de caracteres especificado associado... Nome: n?o dispon?vel Url: https://stat.ethz.ch/pipermail/r-help/attachments/20061107/c586ecc7/attachment.pl
2003 Jan 08
1
try.Silent
In an email to the help list John Chambers wrote about the function helpSilent which is in the methods package, pointing out that there is no restrictive reason to be in this package. I did not know about this function and just incorporate it in several functions of the geoR package where a much less elegant solution was being used. I guess other packages could use it as well. Therefore,
2010 Mar 15
5
storing matrix(variables) in loop
Hello R-helpers, I have the following code that works well, b <-list() for (i in 1:3){ a <- matrix(runif(1),3,3) b[[i]] <- a } b however, I need to do something similar with two loops and I was looking for something that would look like b <- list() for (i in 1:3){ for (j in 1:4){ a <- matrix(runif(1),3,3) b[[i,j]] <- a #but this doesn?t work } } Anyway, I wanted
2003 Sep 16
3
Is Samba ready for it?
Hi, I am migrating from WinNT 4 to Samba 3 beta3 in a production environment. It would be nice to have some advice, because I don't know if Samba is ready for assuming this ;-) I never heard about any one that had something like this. This is kind of a big network so it will be 1 PDC (Samba) , 4 BDC's (Samba) and 2 File Servers (w2k). I will have a minimum of 800 machines and 2000 users
2010 Nov 17
1
Color on trellis device
Hi, I try to make a xyplot withou colors. I try: pdf(file="test.pdf") trellis.device(color=F) Depth <- equal.count(quakes$depth, number=8, overlap=.1) xyplot(lat ~ long | Depth, data = quakes) dev.off() the graphic is showed without colors in a X device but it dont work saving directly on pdf device. How I made to put color off in trellis device? Thanks Ronaldo -- 2ยช lei - Na
2016 Apr 20
10
[Bug 95031] New: [NVE4] Random GPU lockups
https://bugs.freedesktop.org/show_bug.cgi?id=95031 Bug ID: 95031 Summary: [NVE4] Random GPU lockups Product: xorg Version: unspecified Hardware: Other OS: All Status: NEW Severity: normal Priority: medium Component: Driver/nouveau Assignee: nouveau at lists.freedesktop.org
2010 Nov 28
6
has_one accepts_nested_attributes_for fields_for NOT WORKING HELP
MODEL class User < ActiveRecord::Base has_one :address, :dependent => :destroy accepts_nested_attributes_for :address end CONTROL def new @user = User.new @user.build_address # Adicionei ... VIEW partial _form .... <% f.fields_for :address do |b| %> # Adicionei <%= b.text_field :city_manual %> # Adicionei <% end %>
2001 Nov 21
2
contour as a generic function?
After "image" and "persp" would it be interesting to als have contour as a generic function? Cheers Paulo Justiniano Ribeiro Jr Dept Maths & Stats - Fylde College Lancaster University Lancaster LA1 4YF - U.K. e-mail: Paulo.Ribeiro@est.ufpr.br http://www.maths.lancs.ac.uk/~ribeiro -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
2007 Aug 24
3
It is possible to use a Shell command inside a R script?
Hi, It is possible to use a shell command inside a R script? I'm write a R script and I like to put somes shell commands inside to R. Somethink like: convert fig01.png fig01.xpm or sed ..., etc. It is possible? How? Thanks Ronaldo -- Acalme-se, s??o somente 0's e 1's -- > Prof. Ronaldo Reis J?nior | .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Ecologia | : :' :
2008 May 13
6
Testing that named_scope is defined
Hi guys, I''m just beginning to use RSpec and I ran into the issue of testing a named_scope. I''m not actually trying to test its behavior, as it''s not my code, but I wanted to test at least that it''s defined. I tried doing this: describe Post, ".most_recent" do it "should be defined" do Post.method_defined?(:most_recent).should be_true