similar to: Help with loops and how R stores data

Displaying 20 results from an estimated 4000 matches similar to: "Help with loops and how R stores data"

2010 Jan 15
2
How to delete matrix rows based on NA frequency?
Hi all, I would like to remove rows from a matrix, based on the frequency of missing values. If there are more than 10 % missing values, the row should be deleted. I use the following to calculate the frequencies, thereby getting a new matrix with the frequencies: freqNA=rowMeans(is.na(exprdata)) But is there a shorter way to remove the rows based on "(1-freqNA)>0.1"
2012 Mar 21
1
enableJIT() and internal R completions (was: [ESS-bugs] ess-mode 12.03; ess hangs emacs)
Hello, JIT compiler interferes with internal R completions: compiler::enableJIT(2) utils:::functionArgs("density", '') gives: utils:::functionArgs("density", '') Note: no visible global function definition for 'bw.nrd0' Note: no visible global function definition for 'bw.nrd' Note: no visible global function definition for 'bw.ucv'
2016 Apr 25
0
use switch or function in connecting different cases.
This is my current work.Now i am trying to use a function to do the normal distribution simulation. rm(list=ls()) t <- u<- mann<- rep(0, 45) Nsimulation<-function(S1,S2,Sds,nSims) { set.seed(1) for (sim in 1:nSims) { matrix_t <-matrix(0,nrow=nSims,ncol=3) matrix_u<-matrix(0,nrow=nSims,ncol=3)
2005 Mar 09
2
Question about biasing in sd()???
Hi, Can anyone help me with the following. I have been using R for Monte Carlo simulations and got some results I couldn't explain. Therefor I performed following short test: -------------- mean.sds <- NULL sample.sizes <- 3:30 for(N in sample.sizes){ dum <- NULL for(I in 1:5000){ x <- rnorm(N,0,1) dum <- c(dum,sd(x)) } mean.sds<- c(mean.sds,mean(dum)) }
2016 Apr 25
2
R: use switch or function in connecting different cases.
HI, I am trying to use switch () function to connect the three distribution (normal ,gamma with equal skewness and gamma with unequal skewness. But i am losing my ideas since i have sample sizes-(10,10),(10,25),(25,25),(25,50),(25,100),50,25),(50,100), (100,25),(100,100) standard deviation ratio- (1.00, 1.50, 2.00, 2.50, 3.00 and 3.50) distribution of gamma distribution with unequal skewness
2013 Sep 10
1
[PATCH] show vector length in summary()
(summary.default): show the vector length in addition to quantiles diff -u -i -p -F '^(def' -b -w -B /home/sds/src/R-3.0.1/src/library/base/R/summary.R.old /home/sds/src/R-3.0.1/src/library/base/R/summary.R --- /home/sds/src/R-3.0.1/src/library/base/R/summary.R.old 2013-03-05 18:02:33.000000000 -0500 +++ /home/sds/src/R-3.0.1/src/library/base/R/summary.R 2013-09-10 10:19:02.682946339
2009 Feb 12
0
Error Message: Error in dim(data) <- dim : attempt to set an attribute on NULL
I have the following code, from which I get the following error message: Error in dim(data) <- dim : attempt to set an attribute on NULL I think the error is coming from the part of my code in BOLD RED. The script works fine until then. #Load libraries source("http://bioconductor.org/biocLite.R") biocLite() library(limma) library(Biobase) #change directory to folder where
2009 Jan 23
1
plotting curve in xYplot -- using panel.curve
Hello, I am trying to plot a curve over points plotted with se's in xYplot (see example below). I can get Figure 1 below to plot the data with error. However, I keep getting a the error message "Error using packet 1 object "y" not found" Can anyone see what I am doing wrong? Thanks! John ------------------------------- a=0.002; b=31.7; c=0.51
2011 Mar 19
2
Output a table formatted with standard deviations below means
Is it in bad form to double post to StackOverflow and R-help? Apologies if so. Here's my task: I've got a matrix of means like so means<-matrix(1:10,nrow=2) colnames(means)<-c("a","b","c","d","e") and a matrix of standard deviations like so sds<-matrix(seq(0.1,1,by=0.1),nrow=2)
2005 Mar 09
4
How to get standard deviation of rows in a matrix
Hi all, I am trying to find sd of my rows in a matrix and i get column sd inspite of extracting rows. I tried to do the sqrt(var(x)) but that did'nt work as well, Here is my data genes 15 24 63 40 25 42 46 35 23 53 37 45 30 37 50 55 40 51 30 48 x<-sd(genes[1:5,]) y<-sqrt(var(genes[1:5,])) I get 4 sds for the 4 columns instead of 5 sds for my 5 rows. Thanks you in advance.
2011 Jul 21
2
Latex Table Help on R
Hello everyone, Peter (see my earlier post) recommended the following script for finding the means and standard deviations and putting them in table form. However, I would like the standard deviations under the means in brackets. Can anyone check this code to see how this can be adjusted? library(xtable) dataset1 = matrix( c(1,2,3,4, 5, 6 ), 2 , 3) dataset2 = matrix( c(4,3,5,10, 1, 0), 2, 3)
2010 Oct 20
2
CI using ci.numeric
Hi, I am trying to calculate confidence intervals using ci.numeric from epicalc package. If I generate a normal set of data and find the 99% and 95% CI, they seem too narrow to me. Am I doing something wrong?? The IQR goes from -0.62 to 0.62, so I thought the CI limits should be more extreme than these values. x<- rnorm(200,0,1) ci.numeric(x=mean(x),n=200,sds=sd(x),alpha=0.05) n
2009 Jun 25
3
ANOVA with means and SDs as input
Dear R-community, I'm struggling with a paper that reports only fragmented results of a 2by2by3 experimental design. However, Means and SDs for all cells are given. Does anyone know a package/function that helps computing an ANOVA with only Means and SDs as input (resulting in some sort of effect size and significance test)? The reason why I'm interested is simple: I'm conducting a
2010 Jan 15
1
Remove part of string in colname and calculate mean for columns groups
Hi all, I have two question. First, I wonder how to remove a part of the column names in a matrix? I would like to remove the "_ACCX" or "_NAX" part below. Is there a method where the "_" as well as all characters after i can be removed? > dim(exprdata) [1] 88 512 > > colnames(exprdata[,c(1:20)]) [1] "Akita_ACC1" "Akita_ACC2"
2018 Apr 27
5
predict.glm returns different results for the same model
Hi all, Very surprising (to me!) and mystifying result from predict.glm(): the predictions vary depending on whether or not I use ns() or splines::ns(). Reprex follows: library(splines) set.seed(12345) dat <- data.frame(claim = rbinom(1000, 1, 0.5)) mns <- c(3.4, 3.6) sds <- c(0.24, 0.35) dat$wind <- exp(rnorm(nrow(dat), mean = mns[dat$claim + 1], sd = sds[dat$claim + 1])) dat <-
2012 Feb 10
2
the value of the last expression
Is there an analogue of common lisp "*" variable which contains the value of the last expression? E.g., in lisp: > (+ 1 2) 3 > * 3 I wish I could recover the value of the last expression without re-evaluating it. thanks -- Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X 11.0.11004000 http://www.childpsy.net/ http://camera.org http://ffii.org
2018 May 09
2
Some more questions
Ok, some more question as I'm still planning our SDS (but I'm prone to use LizardFS, gluster is too inflexible) Let's assume a replica 3: 1) currently, is not possbile to add a single server and rebalance like any order SDS (Ceph, Lizard, Moose, DRBD, ....), right ? In replica 3, I have to add 3 new servers 2) The same should be by add disks on spare slots on existing servers.
2007 Jul 23
1
replacing double for loops with apply's
Hi, I am doing double for loops to calculate SDs with some weights and wondering if I can get rid of the outer for loop as well. I made a simple examples which is essentially what I am doing. Thanks for your help! -Young #------------------------------------------------------ # wtd.var is Hmisc package # you can replace the 3 lines inside for loop as # sdx[i,] =
2012 Dec 04
3
list to matrix?
How do I convert a list to a matrix? --8<---------------cut here---------------start------------->8--- list(c(50000, 101), c(1e+05, 46), c(150000, 31), c(2e+05, 17), c(250000, 19), c(3e+05, 11), c(350000, 12), c(4e+05, 25), c(450000, 19), c(5e+05, 16)) as.matrix(a) [,1] [1,] Numeric,2 [2,] Numeric,2 [3,] Numeric,2 [4,] Numeric,2 [5,] Numeric,2 [6,] Numeric,2 [7,]
2013 Jan 04
4
non-consing count
Hi, to count vector elements with some property, the standard idiom seems to be length(which): --8<---------------cut here---------------start------------->8--- x <- c(1,1,0,0,0) count.0 <- length(which(x == 0)) --8<---------------cut here---------------end--------------->8--- however, this approach allocates and discards 2 vectors: a logical vector of length=length(x) and an