Displaying 20 results from an estimated 2000 matches similar to: "How to do it through 1 step?"
2006 Sep 22
2
Merge problem
Hello all,
I have read as many merge issues as I possibly could tonight and
although I presume this is a small error, I have not found the
solution to my problem.
I'm trying to merge two data sets: dat0 and TransTable. As you can
see below, dat0 has 8000 rows, whereas TransTable has 47296 rows. I
would expect when I merge the two data sets, with all.x=F, and
all.y=F, that the
2011 Jun 23
2
Merging multiple data sets
Hi,
I am trying to merge data similar to the example data below
> dat0
id var1 var2 var3
2 1 0 1
3 1 0 1
4 0 1 1
5 0 1 1
> dat1
id var4 var5 var6
2 1 0 1
3 1 0 1
6 0 1 1
7 0 1 1
> dat2
id
2013 Mar 21
2
Displaying median value over the horizontal(median)line in the boxplot
Hi,
set.seed(45)
test1<-data.frame(columnA=rnorm(7,45),columnB=rnorm(7,10)) #used an example probably similar to your actual data
apply(test1,2,function(x) sprintf("%.1f",median(x)))
#columnA columnB
# "44.5"? "10.2"
par(mfrow=c(1,2))
lapply(test1,function(x) {b<-
2013 Feb 23
5
Selecting First Incidence from Longitudinal Data
I have a longitudinal competing risk data of the form:
ID COMPL SEX HEREDITY
1 0 1 2
1 0 1 2
1 3 1 2
2 0 0 1
2 1 0 1
2 2 0 1
2 2 0 1
3 0 0 1
3 0 0 1
3 0 0 1
3 0 0 1
3 2 0 1
4 0 1 2
4 0 1
2011 Mar 30
6
Quick recode of -999 to NA in R
Hi,
I am trying to write a loop to recode my data from -999 to NA in R. What's
the most efficient way to do this? Below is what I'm presently doing, which
is inefficient. Thanks,
Chris
dat0 <- read.table("time1.dat")
colnames(dat0) <- c("e1dq", "e1arcp", "e1dev", "s1prcp", "s1nrcp", "s1ints",
2012 Jul 13
3
Column create and Update using function
Hi,
here i have a Max and Min values
Min <-3
Max <-6
and also a matrix like this,
ABC XYZ PQR
------ ------- -------
2 4 3
5 4 8
7 1 3
In this i need to check each particular column values are between Max and
Min value.
If the coulmn value not coming between Max and
2011 Mar 12
2
Identifying unique pairs
Dear R helpers
Suppose I have a data frame as given below
mydat = data.frame(x = c(1,1,1, 2, 2, 2, 2, 2, 5, 5, 6), y = c(10, 10, 10, 8, 8, 8, 7, 7, 2, 2, 4))
mydat
x y
1 1 10
2 1 10
3 1 10
4 2 8
5 2 8
6 2 8
7 2 7
8 2 7
9 5 2
10 5 2
11 6 4
unique(mydat$x) will give me 1,
2016 Jul 09
2
Red Neuronal complicada categorías
Hola,
Esta es una forma de hacerlo...
Mira que lo primero que he modificado es el fichero "x.csv" para sustituir
los espacios en los nombres por "_". Y también he quitado los acentos y las
eñes...
He utilizado el paquete RNNS y la función "mlp()" para ajustar la red.
#-------------------------------------------
> x <- read.csv("x.csv",
2006 Oct 18
1
MARS help?
I'm trying to use mars{mda} to model functions that look fairly
close to a sequence of straight line segments. Unfortunately, 'mars'
seems to totally miss the obvious places for the knots in the apparent
first order spline model, and I wonder if someone can suggest a better
way to do this. The following example consists of a slight downward
trend followed by a jump up after
2012 May 10
1
stop calculation in a function
Hi dear R-users,
I have a question about a function I'm trying to improve.
How can I stop the function calculation at the last numeric value of my
data?
The problem is that the end of my data contains missing values (NAs). And
the aim of my function is to compare the first numeric value with the next
one (till the end). For the moment, It works well when my data doesn't
contains any NAs
2010 Apr 22
1
Convert character string to top levels + NAN
Dear all,
I have several character strings with a high number of different levels.
unique(x) gives me values in the range of 100-200.
This creates problems as I would like to use them as predictors in a coxph
model.
I therefore would like to convert each of these strings to a new string
(x_new).
x_new should be equal to x for the top n categories (i.e. the top n levels
with the highest
2010 Aug 07
3
plot the dependent variable against one of the predictors with other predictors as constant
Hi, folks,
Happy work in weekends >_<
My question is how to plot the dependent variable against one of the
predictors with other predictors as constant. Not for the original data, but
after prediction. It means y is the predicted value of the dependent
variables. The constane value of the other predictors may be the average or
some fixed value.
#######
y=1:10
x=10:1
z=2:11
2009 Aug 12
3
Obtaining the value of x at a given value of y in a smooth.spline object
I have some data fit to a smooth.spline object as follows: (x=vector of data
for the predictor variable, y=vector of data for the response variable)
fit <- smooth.spline(x,y)
Now, given a spline fit point y_new, I want to be able to find out what
value of x_new yielded this fit value. How to do so?
(This problem is the inverse of the predict.smooth.spline function, which
takes x_new as input
2012 Apr 11
1
inference for customized regression in R?
Hi all,
Are there functions in R that could help me do the following?
We have a special type of regression which is called Geometric Mean
Regression.
We have done some search and found the following:
https://stat.ethz.ch/pipermail/r-help/2011-July/285022.html
The question is: how to do the statistical inference on GMR results?
More specifically, we are looking for the prediction interval:
2012 Dec 18
2
Set a zero at minimum row by group
Dear R Helpers,
I'm struggling with a data preparation problem. I feel that it is a quite
easy task but I don't get it done. I hope you can help me with that.
I have a data frame looking like this:
ID <- c(1,1,1,2,2,3,3,3,3)
T <- c(1,2,3,1,4,3,5,6,8)
x <- rep(1,9)
df <- data.frame(ID,T,x)
>df
ID T x
1 1 1
1 2 1
1 3 1
2 1 1
2 4 1
3 3 1
3 5 1
3 6 1
3 8 1
I want to
2012 Aug 29
4
Sorting of columns of a matrix
Dear all,
Please suggest me how can I do it.
I have a matrix which look like following:
x1 x2 x3 t1 .01 0.3 0 t2 0 0.1 0.01 t3 0 .01 .01 t4 0 0 t5 5 0 0 t6
0 0 0 t7 0 0 0 t8 0 0 0 t9 0.6 0 0 t10 0 0 0.66 t11 0 0.6 0.11 t12 0
0.4 0
I want to sort decreasing order in each column based on rows. and then to
display only those rows which has a value. The expected out put matrix will
2013 Feb 25
1
quesion about SS of ANOVA
Hi all:
I have a quesion about ANOVA: Is SS(Sum of Square) of a specific factor constant with the number of factors changing?
dat1 includes one factor g1,and g1's SS is called SS_g1_dat1.
dat2 includes two factors g1,g2,and g1's SS is called SS_g1_dat2.
My quesion is: Is SS_g1_dat1 equals to SS_g1_dat2?
I have both "yes" and "no" reasons for the quesion,but
2012 Jun 09
2
Reshaping columns
Dear all,
I have a data frame with 2 columns and 102500 rows. The data looks like
below
V1 V2
8098 110000.......
9099 001100.......
0023 110011.......
6545 111111.......
. .
. .
. .
. .
. .
I want to split the colums like this ;
V1 V2 V3 V4 V5 V6 v7
8098 1 1 0 0 0 0 ......
9099
2012 Oct 22
6
How to use tapply with more than one variables grouped
I'm studying alone the R language for data preparation. I found a course at
MIT for data preparation that uses python but I'm using R to learning. The
first exercise is the preparation of data from a database that shows the
contributions made to candidates for U.S. president. The database is
described in FORMART
2018 May 11
0
add one variable to a data frame
Sarah's solutions are good, and here's another, even more basic:
tmp1 <- unique(dat1$B)
tmp2 <- seq_along(tmp1)
dat1$C <- tmp2[ match( dat1$B, tmp1) ]
> dat1
N B C
1 1 29_log 1
2 2 29_log 1
3 3 29_log 1
4 4 27_cat 2
5 5 27_cat 2
6 6 1_log 3
7 7 1_log 3
8 8 1_log 3
9 9 1_log 3
10 10 1_log 3
11 11 3_cat 4
12 12 3_cat 4
As a single line