Displaying 20 results from an estimated 9000 matches similar to: "how to change automatically 0=no and 1=yes"
2013 May 29
3
bootstrap
Hi,
You might need to check library(boot).? I have never used that before.? So, I can't comment much.? It is better to post on R-help list.? I had seen your postings on Nabble in the past.? Unfortunately those postings were not accepted in R-help.? You have to directly post at ? r-help at r-project.org after registering at:
https://stat.ethz.ch/mailman/listinfo/r-help
?
2008 Dec 22
1
sem package fails when no of factors increase from 3 to 4
#### I checked through every 3 factor * 3 loading case.
#### While, 4 factor * 3 loading failed.
#### the data is 6 factor * 3 loading
require(sem);
cor18<-read.moments();
1
.68 1
.60 .58 1
.01 .10 .07 1
.12 .04 .06 .29 1
.06 .06 .01 .35 .24 1
.09 .13 .10 .05 .03 .07 1
.04 .08 .16 .10 .12 .06 .25 1
.06 .09 .02 .02 .09 .16 .29 .36 1
.23 .26 .19 .05 .04 .04 .08 .09 .09 1
.11 .13 .12 .03 .05 .03
2005 Jun 29
2
quick way to construct formula
Dear R users,
I have a data with 1000 variables named "x1", "x2", ..., "x1000", and
I want to construct a formula like this format:
~x1+x2+...+x1000+x1:x2+x1:x3+x999:x1000+log(x1)+...+log(x1000)
That is: the base variables followed by all interaction terms and all
base feature log-transformations. I know I can use several paste
functions to construct it. But is
2010 Apr 19
2
How to pass a list of parameters into a function
Does anyone know how to pass a list of parameters into a function?
for example:
somefun=function(x1,x2,x3,x4,x5,x6,x7,x8,x9){
ans=x1+x2+x3+x4+x5+x6+x7+x8+x9
return(ans)
}
somefun(1,2,3,4,5,6,7,8,9)
# I would like this to work:
temp=c(x3=3,x4=4,x5=5,x6=6,x7=7,x8=8,x9=9)
somefun(x1=1,x2=2,temp)
# OR I would like this to work:
temp=list(x3=3,x4=4,x5=5,x6=6,x7=7,x8=8,x9=9)
2005 Oct 05
8
R crashes for large formulas in lm() (PR#8180)
Full_Name: Hallgeir Grinde
Version: 2.1.1
OS: Windows XP
Submission from: (NULL) (144.127.1.1)
While using lm(y~(x*z*c*...*v)^2) R crashes/closes if the numbers of variables
are at least 8.
2013 Apr 13
1
how to add a row vector in a dataframe
Hi,
Using S=1000
and
simdata <- replicate(S, generate(3000))
#If you want both "m1" and "m0" #here the missing values are 0
res1<-sapply(seq_len(ncol(simdata.psm1)),function(i) {x1<-merge(simdata.psm0[,i],simdata.psm1[,i],all=TRUE); x1[is.na(x1)]<-0; x1})
res1[,997:1000]
#????? [,1]???????? [,2]???????? [,3]???????? [,4]???????
#x1??? Numeric,3000 Numeric,3000
2012 Feb 17
5
How to change the order of columns in a data frame?
Dear all,
I have a data frame in which the columns need to be ordered. The first column X is at the right position, but the remaining columns X1-Xn should be ordered like this: X1, X2, X3 etc instead of like below.
> colnames(pos1)
[1] "X" "X1" "X10" "X11" "X12" "X13" "X14" "X15" "X16"
2011 Dec 19
2
Summing x1 to x6
Suppose I have the following:
x1<-as.vector(rnorm(10))
x2<-as.vector(rnorm(10))
x3<-as.vector(rnorm(10))
x4<-as.vector(rnorm(10))
x5<-as.vector(rnorm(10))
x6<-as.vector(rnorm(10))
x7<-as.vector(rnorm(10))
x8<-as.vector(rnorm(10))
x9<-as.vector(rnorm(10))
x10<-as.vector(rnorm(10))
I would like the mean of x1 to x6 for each vector position. I would do
something else
2011 Jun 01
3
error in model specification for cfa with lavaan-package
Dear R-List,
(I am not sure whether this list is the right place for my question...)
I have a dataframe df.cfa
2011 Jun 08
2
Results of CFA with Lavaan
I've just found the lavaan package, and I really appreciate it, as it
seems to succeed with models that were failing in sem::sem. I need
some clarification, however, in the output, and I was hoping the list
could help me.
I'll go with the standard example from the help documentation, as my
problem is much larger but no more complicated than that.
My question is, why is there one latent
2007 May 16
1
partial least regression
hello r-helpers:
there is a .txt file:
x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 y1
17 5 77 18 19 24 7 24 24 72 52 100
2 6 72 18 17 15 4 12 18 35 42 97.2
17 2 58 10 5 3 4 3 3 40 28 98
17 2 69 14 13 12 4 6 6 50 37 93
2 3 75 20 38 18 6 12 18 73 67 99
14 4 59 16 18 9 4 3 15 47 40 99.95
17 4 87 18 17 12 4 15 12 69 46 100
14 3 74 15 9 12 1 15 12 44 35 98
17 6 76 15 33 21 15 9 18 46 41 100
17 5 76 17 22 18 1
2013 Apr 18
1
select and do some calculations/manipulations on certain rows based on conditions in R
Hi,
May be this helps (Assuming that there are only '0's and '1's in the dataset)
dat1<-read.table(text="
??????? ID X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
1?? 5184??? 0??? 0??? 0??? 0??? 0?? 0?? 0??? 0??? 0??? 1???? 0????? 0????? 0????? 0????? 0????? 0
2?? 6884??? 0??? 0??? 1??? 0??? 0?? 1?? 0??? 0??? 0??? 0???? 0????? 0????? 0????? 0????? 0????? 0
3?
2008 Oct 09
2
Singular information matrix in lrm.fit
Hi R helpers,
I'm fitting large number of single factor logistic regression models
as a way to immediatly discard factor which are insignificant.
Everything works fine expect that for some factors I get error message
"Singular information matrix in lrm.fit" which breaks whole execution
loop... how to make LRM not to throw this error and simply skip
factors with singularity
2018 Feb 20
5
Take the maximum of every 12 columns
Dear all,
I have monthly data in wide format, I am only providing data (at the bottom
of the email) for the first 24 columns but I have 2880 columns in total.
I would like to take max of every 12 columns. I have taken the mean of
every 12 columns with the following code:
byapply <- function(x, by, fun, ...)
{
# Create index list
if (length(by) == 1)
{
nc <- ncol(x)
2012 Aug 09
4
debug vs regular mode
Dear all,
I had a R segmentation fault, and then invoked debug mode and ran step
by step.
When I reached "terms(Y~X1*X2*...*X16)", I would then have
"segmentation" fault. However, if I just ran this under regular "R
interactive" mode, it would be fine though taking long time.
My questions are:
1. Is there a known limit of terms for a formula?
2. Why does the
2012 Aug 09
4
debug vs regular mode
Dear all,
I had a R segmentation fault, and then invoked debug mode and ran step
by step.
When I reached "terms(Y~X1*X2*...*X16)", I would then have
"segmentation" fault. However, if I just ran this under regular "R
interactive" mode, it would be fine though taking long time.
My questions are:
1. Is there a known limit of terms for a formula?
2. Why does the
2006 Nov 17
2
Data table in C
After getting one list done, I am now struggling to form a data frame in C.
I tried to do a list of lists which gives me :
$<NA>
$<NA>[[1]]
[1] "BID"
$<NA>[[2]]
[1] 0.6718
$<NA>[[3]]
[1] 3e+06
$<NA>
$<NA>[[1]]
[1] "BID"
$<NA>[[2]]
[1] 0.6717
$<NA>[[3]]
[1] 5e+06
$<NA>
$<NA>[[1]]
[1] "BID"
2011 Apr 09
2
Orthoblique rotation on eigenvectors (SAS VARCLUS)
Hi All,
I'd like to build a package for the community that replicates the output
produced by SAS "proc varclus". According to the SAS documentation, the
first few steps are:
1. Find the first two principal components.
2. Perform an orthoblique rotation (quartimax rotation) on eigenvectors.
3. Assign each variable to the rotated component with which it has the
higher
squared
2005 Mar 02
2
Suppressing observation numbers
Dear R gurus,
Below is a part of the R output. Please consider the two lines:
> data
> model.matrix(m1)
Is there a way of suppressing the observation numbers 1, 2, ...27 in the
output (I don't want these number to appear in the output)?
Regards,
NKN
> # Orthogonal blocking
> data=read.table("cut.txt",header=T)
> attach(data)
> data
b x1 x2 x3
1 1 -1 -1 0
2
2007 Aug 02
1
Multivariable correlation
Given a square matrix of variables X, is there any way to compute a multivariable correlation among all the variables in the array? It is possible to calculate the correlation of all pairs of variables in the array, but I want to know the correlation of all the variables taken together, i.e. for the matrix
X=x1 x2 x3
x4 x5 x6
x7 x8 x9
I don't want the pair-wise correlations