Displaying 20 results from an estimated 3000 matches similar to: "Help with one of "those" apply functions"
2010 Oct 10
2
GC verbose=false still showing report
I must be reading the help file for gc() wrong. I thought it said that
gc(verbose=FALSE) will run the garbage collection without printing the
Ncells/Vcells summary. However, this is what I get:
gc(verbose = FALSE)
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 267097 14.3 531268 28.4 531268 28.4
Vcells 429302 3.3 20829406 159.0 55923977 426.7
I'm embedding this in an
2012 Aug 15
3
Subsetting with missing data
Simply put, I want to subset the data frame 'a' where 'y=0'.
> a <- as.data.frame(cbind(x=1:10, y=c(1,0,NA,1,0,NA,NA,1,1,0)))
> a
x y
1 1 1
2 2 0
3 3 NA
4 4 1
5 5 0
6 6 NA
7 7 NA
8 8 1
9 9 1
10 10 0
> names(a)
[1] "x" "y"
> table(a$y)
0 1
3 4
> table(a$y, useNA="always")
0 1 <NA>
3 4
2011 Jan 19
1
Printing "pretty' vectors in Sweave
I am trying to print a nice looking vector in Sweave.
c <- 1:4
I want to see (1, 2, 3, 4) in TeX. .
If I use
paste(c, ",", sep="")
I get
"1," "2," "3," "4,"
If use cat(c, sep=",")
I can't seem to assign it to an object,
1,2,3,4> myvec <- cat(c, sep=",")
1,2,3,4> myvec
NULL
and if I bypass the
2011 Jun 09
3
Resources for utilizing multiple processors
Hello,
I know of some various methods out there to utilize multiple processors but
am not sure what the best solution would be. First some things to note:
I'm running dependent simulations, so direct parallel coding is out
(multicore, doSnow, etc).
I'm on Windows, and don't know C. I don't plan on learning C or any of the
*nix languages.
My main concern deals with Multiple
2010 Nov 07
2
How is MissInfo calculated? (mitools)
What does missInfo compute and how is it computed?
There is only 1 observation missing the ethnic3 variable. There is no other
missing data.
N=1409
> summary(MIcombine(mod1))
Multiple imputation results:
with(rt.imp, glm(G1 ~ stdage + female + as.factor(ethnic3) + u,
family = binomial()))
MIcombine.default(mod1)
results se
(lower upper)
2010 May 26
3
Counting indexes
Hallo!
I have a vector of ID's like so,
id <- c(1,2,2,3,3,3,4,5,5)
I would like to create a [start,stop] pair of vectors that index the first
and last observation per ID.
For the ID list above, it would look like
1 1
2 3
4 6
7 7
8 9
I haven't worked with indexes/data manipulation much in R, so any pointers
would be helpful.
Many thanks!
~~~~~~~~~~~~~~~~~~~
-Robin Jeffries
Dr.P.H.
2010 Apr 25
1
Obvious reason for not looping twice?
Is there an obvious reason why this won't loop to i=2 and beyond?
There are many combinations of *st* & *vc* that don't exist in svc. For
example, when s=1 there's only an entry at v=1. That's fine, the entry can
stay 0.
lookup.svc <- array(0,dim=c(length(unique(svc$st)),length(unique(svc$vc))),
dimnames=list(unique(svc$st), unique(svc$vc)))
for (i in
2010 May 08
1
Source.R file from cmd line
I want to set up a windows system task that will run a .R script at
pre-specified times.
Can someone please help with the command line syntax that I would assign to
the task?
I know that i can open a command prompt, type R, and then source the file,
but I don't know how to pass multiple line arguments to the command line in
a system task.
Thanks,
~~~~~~~~~~~~~~~~~~~
-Robin Jeffries
Dr.P.H.
2009 Jul 22
1
R extract vertices for polygon
Dear R users,
I'm trying to extract from a given matrix (GROUP) the coordinates of the vertices of the different groups (i.e. 3, 7, 1 . . .) to plot the polygons to delineate the area in which each group "wins" and colour it diferentially. I can make a simple point plot, but I would like to add polygons with full colored area. The example is with a 5x5 matrix, but I'm working
2010 May 24
1
sparse matrices in lme4
I read somewhere (help list, documentation) that the random effects in lme4
uses sparse matrix "technology".
I'd like to confirm with others that I can't use a sparse matrix as a fixed
effect? I'm getting an "Invalid type (S4) " error.
Thanks.
~~~~~~~~~~~~~~~~~~~
-Robin Jeffries
Dr.P.H. Candidate in Biostatistics
UCLA School of Public Health
rjeffries@ucla.edu
2011 Mar 03
3
Probabilities greather than 1 in HIST
Dear all,
I am a newbie in R and could not find help on this problem. I am trying to
plot an histogram with probabilities in the y axis. This is the code I am
using:
#TLC uniform
n=30
mi=1; mx=6
nrep=1000
xbar=rep(0,nrep)
for (i in 1:nrep) {xbar[i]=mean(runif(n,min=mi,max=mx))}
hist(xbar,prob=TRUE,breaks="Sturges",xlim=c(1,6),main=paste("n =",n),
xlab="Média",
2010 Jul 11
2
simple apply syntax
I know this is a simple question, but I have yet to master the apply
statements. Any help would be appreciated.
I have a column of probabilities and sample sizes, I would like to create a
column of binomial random variables using those corresponding probabilities.
Eg.
mat = as.matrix(cbind(p=runif(10,0,1), n=rep(1:5)))
p n
[1,] 0.5093493 1
[2,] 0.4947375 2
[3,]
2006 Nov 23
1
statistics help
hi
im a bioinformatics student as i have never had any previous programming
experience
i need help
this is the question i need to answer:
Random walk model
we want to model a random walk where you take a step to the left with
probability p
and one to the right with probability 1-p. Now assume that there is a line
of 11 squares.
once you are in square 0 or in square 10 the walk ends. The aim
2010 Aug 13
2
Lattice xyplots plots with multiple lines per cell
Hello,
I need to plot the means of some outcome for two groups (control vs
intervention) over time (discrete) on the same plot, for various subsets
such as gender and grade level. What I have been doing is creating all
possible subsets first, using the aggregate function to create the means
over time, then plotting the means over time (as a simple line plot with
both control & intervention
2018 Feb 15
2
package MonteCarlo error: object 'packages' not found
R-users,
I can't tell what's causing the following error. The vignette does not
make a reference to a "packages" option or parameter.
> library(MonteCarlo)
Loading required package: abind
Loading required package: codetools
Loading required package: rlecuyer
Loading required package: snow
Loading required package: snowfall
> infest_kud_fun<-function(x,A,B){
+??
2006 Jun 18
1
bug with boot.sw98 function (PR#8999)
Full_Name: Nuno Monteiro
Version: 2.3.1
OS: Windows XP HE
Submission from: (NULL) (84.9.38.207)
I'm using the FEAR library to perform Data Envelopment analysis with a 36,000
obs dataset.
The function dea is working fine but then when I try to use the boot.sw98 to
come up with some sensitivity analysis I get the following error:
2010 May 22
2
Regression with sparse matricies
I would like to run a logistic regression on some factor variables (main
effects and eventually an interaction) that are very sparse. I have a
moderately large dataset, ~100k observations with 1500 factor levels for one
variable (x1) and 600 for another (X2), creating ~19000 levels for the
interaction (X1:X2).
I would like to take advantage of the sparseness in these factors to avoid
using GLM.
2006 Jan 12
1
"infinite recursion" in do.call when lme4 loaded only
A larg program which worked with lme4/R about a year ago failed when I
re-run it today. I reproduced the problem with the program below.
-- When lme4 is not loaded, the program runs ok and fast enough
-- When lme4 is loaded (but never used), the do.call fails
with infinite recursion after 60 seconds. Memory used increases
beyond bonds in task manager.
-- I tested a few S3 based packages
2006 Jan 12
1
"infinite recursion" in do.call when lme4 loaded only
A larg program which worked with lme4/R about a year ago failed when I
re-run it today. I reproduced the problem with the program below.
-- When lme4 is not loaded, the program runs ok and fast enough
-- When lme4 is loaded (but never used), the do.call fails
with infinite recursion after 60 seconds. Memory used increases
beyond bonds in task manager.
-- I tested a few S3 based packages
2018 Feb 15
0
package MonteCarlo error: object 'packages' not found
This looks like the sort of thing that you should ask the package
maintainer (?maintainer).
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Thu, Feb 15, 2018 at 11:39 AM, john polo <jpolo at mail.usf.edu> wrote:
>