Displaying 20 results from an estimated 10000 matches similar to: "Source.R file from cmd line"
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 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
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 Feb 02
2
Help with one of "those" apply functions
Hello there,
I'm still struggling with the *apply commands. I have 5 people with id's
from 10 to 14. I have varying amounts (nrep) of repeated outcome (value)
measured on them.
nrep <- 1:5
id <- rep(c("p1", "p2", "p3", "p4", "p5"), nrep)
value <- rnorm(length(id))
I want to create a new vector that contains the sum of the
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)
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 Jan 21
2
Problems completely reading in a "large" sized data set
I have been through the help file archives a number of times, and still
cannot figure out what is wrong.
I have a tab-delimited text file. 76Mb, so while it's large.. it's not
-that- large. I'm running Win7 x64 w/4G RAM and R 2.10.1
When I open this data in Excel, i have 27 rows and 450932 rows, excluding
the first row containing variable names.
I am trying to get this into R as a
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
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.
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,]
2010 Apr 21
1
Cross-checking a custom function for separability indices
Hi list!
I have prepared a custom function (below) in order to calculate separability
indices (Divergence, Bhattacharyya, Jeffries-Matusita, Transformed divergene)
between two samples of (spectral land cover) classes.
I need help to cross-compare results to verify that it works as expected
(since I don't know of any other foss-tool that will give me quickly some
results).
Does anybody
2013 Apr 02
1
gdata selectively not working
I can use gdata to successfully read in the example Excel file, but not any
other excel files. Why might this be the case? It seems that the problem
has something to do with opening the database but no indication as to what
the problem is. So i'm at a loss of how to fix it.
> library(gdata)
gdata: read.xls support for 'XLS' (Excel 97-2004) files ENABLED.
gdata: read.xls support
2008 Jan 26
1
Read stata file from internet?
Dear R-helpers,
I would like to have my students read into R an online Stata dataset: 'http://www.stat.ucla.edu/projects/datasets/risk_project.dta'
I was able to read it into R after downloading it and converting it
with StatTransfer (http://www.stattransfer.com/).
Here is what happens when I use read.dta() as I would use read.table():
> require(foreign)
> risk2 <-
2005 Feb 28
1
Unable to install packages
> Dear Sirs ,
> Today I've downloaded the last release of the R-Program (I an a novel user). I am interested on performing time series analysys (regression,ARIMA,ARCH) to some data-sets, therefore I would like to use some of the packages of R-Contributors (like the tseries one).When I try to install or update packages from CRAN the following text always appear:
>
> local({a <-
2002 Oct 06
1
R-1.6.0
I have build R-1.6.0 on Jaguar (actually on 10.2.2), using gcc 3.1
from Apple, g77 3.1 from fink, ATLAS from fink. It passes all
checks OK.
I also re-compiled the 233 packages listed below
with the same setup. I have NOT tested all these
packages in any detail. A tar.gz file with the whole /usr/local/lib/R
will be on ftp://gifi.stat.ucla.edu on Tuesday. It will NOT include
anything from fink
2003 Aug 17
2
R-devel problem
With the current version from rsync (8/16, 19:00) I get
make[3]: *** No rule to make target `helpsearch.c', needed by
`Makefile'. Stop.
make[2]: *** [R] Error 1
make[1]: *** [R] Error 1
make: *** [R] Error 1
===
Jan de Leeuw; Professor and Chair, UCLA Department of Statistics;
Editor: Journal of Multivariate Analysis, Journal of Statistical
Software
US mail: 9432 Boelter Hall, Box
2002 Jun 19
3
R-1.5.1 for Darwin/X11
The file
ftp://gifi.stat.ucla.edu/pub/R-1.5.1.dmg
has grown to 60 MB. It consists of a meta-package and its packages and
it will allow you to install binaries for R-1.5.1 and about 300
packages, just by
clicking the R-1.5.1.mpkg file. It also install quite a few dylibs in
/sw, but not
the ones for X11R6 and gnome yet. You can choose which of the packages
to install,
of course.
The same