Displaying 20 results from an estimated 2000 matches similar to: "repeating values in levels()"
2008 May 28
1
manipulating multiply imputed data sets
Hi folks,
I have five imputed data sets and would like to apply the same
recoding routines to each. I could do this sort of thing pretty
easily in Stata using MIM, but I've decided to go cold turkey on other
stats packages as a incentive for learning more about R. Most of the
recoding is for nominal variables, like race, religion, urbanicity,
and the like. So, for example, to recode race
2010 Oct 26
3
stripping #s in a text file prior to reading into table or dataframe
I'm importing a lot of text tables of data (from Latent Gold) that includes
hashes in some of the column names ("Cluster#1", "Cluster#2", etc.). Is
there an easy way to strip the offending hashes out before pushing the text
into a table or data frame? I thought I'd use gsub, e.g., but can't figure
out how to read in a text file without reading it into a table or
2007 Oct 01
4
Disentagling formulas
I am writing a program in which I would like to take in a formula, change the response (Y) variable into something else, and then pass the formula, with the new Y variable to another function. That is, I am starting with
formula <- Y~X1+X2+X3
and I'd like to do something like
Y <- formula$Y
newY <- f(Y)
lm(newY~X1+X2+X3)
So far, it seems that my
2009 Mar 21
2
limiting simulated animal movement
Hi,
I am trying to simulate animal movement in a gridded landscape made up of
cells. At each time step (iteration), the animal moves from one cell to
another in a random fashion.
This is how I am simulating movement, where a and b are the x,y co-ordinates
of the animal at the previous time step:
for (i in 1:no.of.steps){
direction <- sample(1:8, 1)
if(direction == 1){
a <- a
b <- b -
2009 Jul 03
2
mapping states with colors
Hi folks,
I'm just learning how to use maps. As an initial foray, I'm mapping the
states that have "duty to retreat" (blue) and "stand your ground" (red)
self-defense standards. Here is my extremely naive script:
dtr <- c('alabama', 'arizona', 'conneticut', 'delaware', 'dist of columbia'
, 'hawaii',
2008 Jan 04
1
Plotting labeled impulses: label collision
Dear all,
As you can see from the attachment I'm using R to automatically annotate
peptide fragmentation mass spectra, which are represented by impulse plots.
I'd like to poll you on approaches of how to deal as generally as possible
with the two biggest annotation issues I run into:
1) very close annotated masses (impulses) with similar y-axis dimensions -
resulting in overlapping labels
2006 Jul 29
1
fancier plotting
Hi
thank you for talking the time to help me with this.
I have a sequence of numbers in a file and an equal sequence of various character, say(a b c d) each occurs more than once. I need to plot the numbers so that numbers corresponding to a in the other sequence would have green dots, those corresponding to b a red dot, nothing on c and blue square for d. i.e
2 a show a green dot
4 b show a
2004 Oct 25
1
Ref: Variable scope or function behaviour or array reassign
Dear R- helpers
Following a draft structure of the R script for which I am facing problem
Step 1
x <- of type array with original values
y <- of type array with original values
Step 2
for (ctr in 1:10) {
# my problem here the both x and y still show the original values from step 1
# in spite of making changes to the old values of the arrays x and y in the function
function
2006 Sep 22
4
Creating Movies with R
Dear All,
I'd like to know if it is possible to create animations with R.
To be specific, I attach a code I am using for my research to plot
some analytical results in 3D using the lattice package. It is not
necessary to go through the code.
Simply, it plots some 3D density profiles at two different times
selected by the user.
I wonder if it is possible to use the data generated for different
2009 Aug 26
2
simple graph question: manipulating variable names
This is a simple problem that has stumped me: I'm trying to loop through a
few dozen variable names in graphs. I've tried various approaches like
this:
attach(mydata)
ivs <- c("oneiv", "anotheriv", "yetanotheriv")
dvs <- c("onedv", "anotherdv", "yetanotherdv")
for (iv in ivs) {
for (dv in dvs) {
graphname <- paste(iv,
2010 Aug 13
2
Unable to retrieve residual sum of squares from nls output
Colleagues,
I am using "nls" successfully (2.11.1, OS X) but I am having difficulties retrieving part of the output - residual sum of squares. I have assigned the output to FIT:
> > FIT
> Nonlinear regression model
> model: NEWY ~ PMESOR + PAMPLITUDE * cos(2 * pi * (NEWX - POFFSET)/PERIOD)
> data: parent.frame()
> PMESOR PAMPLITUDE POFFSET
>
2007 Oct 03
2
Shading area under density curves
Hello,
I have a question regarding shading regions under curves to display
95% confidence intervals. I generated bootstrap results for the slope
and intercept of a simple linear regression model using the following
code (borrowed from JJ Faraway 2005):
> attach(allposs.nine.d)
> x<-model.matrix(~log(d.dist,10))[,-1]
> bcoef<-matrix(0,1000,2)
> for(i in 1:1000){
+
2007 Oct 12
1
Addition operation based on specific columns and rows of two data frames
#Hello,
# I have a question about the addition of values in specific columns and
rows of a Data frame.
# Below I have created two data frames, X.df and "Y.df".
## creation of X.df data frame
X<- matrix(0,16,3)
X.df<-data.frame(X)
X.df[,1] <- c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4)
X.df[,2] <- c(1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4)
names(X.df)[1]<-"L(A)a(i)"
2010 Aug 19
2
Can't read/write to _nonfi
Good afternoon,
Hope you all have a wonderful day. I am glad to be here. Hope you could
help me with the following errors that i have been trying to figure it all
out since last week.
I am using Splus from Insightful, and as i read, R and Splus are very
similar. So hope you could help me.
I have been continously received these error messages after i ran my small
program for couple of
2011 Oct 05
4
SPlus to R
I'm trying to convert an S-Plus program to R. Since I'm a SAS programmer I'm not facile is either S-Plus or R, so I need some help. All I did was convert the underscores in S-Plus to the assignment operator <-. Here are the first few lines of the S-Plus file:
sshc _ function(rc, nc, d, method, alpha=0.05, power=0.8,
tol=0.01, tol1=.0001, tol2=.005, cc=c(.1,2),
2003 Jan 29
3
multinomial conditional logit models
A multinomial logit model can be specified as a conditional logit
model after restructuring the data. Doing so gives flexibility in
imposing restrictions on the dependent variable. One application is
to specify a loglinear model for square tables, e.g. quasi-symmetry
or quasi-independence, as a multinomial logit model with covariates.
Further details on this technique and examples with several
2010 Apr 07
3
PSTN issues
Hope some can help me.
I have a PSTN coming into TDM400 into Asterisk. We also have direct
telephones connected to the PSTN bypassing the Asterisk. When a call comes
in on the PSTN the direct connected phones ring first and if no one picks up
, Asterisk picks and get routed to internal sip phones. I am not able to
find what I should tune to make the calls always go through asterisk without
the
2010 Jul 24
1
latent class analysis with mixed variable types
As an alternative to Latent GOLD, I'm wondering if anyone knows of and R
package that can manage Latent Class Analysis with mixed variable types
(continuous, ordinal, and nominal/binary).
[[alternative HTML version deleted]]
2013 Nov 14
1
issues with calling predict.coxph.penal (survival) inside a function
Thanks for the reproducable example. I can confirm that it fails on my machine using
survival 2-37.5, the next soon-to-be-released version,
The issue is with NextMethod, and my assumption that the called routine inherited
everything from the parent, including the environment chain. A simple test this AM showed
me that the assumption is false. It might have been true for Splus. Working this
2007 Jan 21
2
efficient code. how to reduce running time?
Hi,
I am new to R.
and even though I've made my code to run and do what it needs to .
It is taking forever and I can't use it like this.
I was wondering if you could help me find ways to fix the code to run
faster.
Here are my codes..
the data set is a bunch of 0s and 1s in a data.frame.
What I am doing is this.
I pick a column and make up a new column Y with values associated with that