Displaying 20 results from an estimated 5000 matches similar to: "Selecting subset of a given vector"
2011 Dec 27
1
differences between 1.7 and 1.7.1 glmnet versions
Dear All,
?
I have found differences between glmnet versions 1.7 and 1.7.1 which, in
my opinion, are not cosmetic and do not appear in the ChangeLog. If I am
not mistaken, glmnet appears to return different number of selected
input variables, i.e. nonzeroCoef(fit$beta[[1]]) differes between
versions. The code below is the same for 1.7.1 and 1.7, but you can see
that outputs differ. I would
2009 Jun 22
2
Help on creating a sequence of vectors
I want to create a number of vectors like :
vec1 <- rnorm(1)
vec2 <- rnorm(2)
vec3 <- rnorm(3)
and so on...........
Here I tried following :
for (i in 1:10) paste("vec", i, sep="") <- rnorm(i)
However obviously that is not working. Here vectors I need to be seperated
i.e I do not want to create a "list". How to modify above code?
--
View this
2011 Feb 10
3
Finding length of unique numbers in a vector
Hello there, would you please look into my codes? Here I have following:
> set.seed(100)
> samp <- sample(c(1,-1,0), 20, replace=T); samp
[1] 1 1 -1 1 -1 -1 0 -1 -1 1 -1 0 1 -1 0 0 1 -1 -1 0
Here I want to calculate the length of each unique number for above vector.
How can I do that?
Thanks in advance
[[alternative HTML version deleted]]
2011 Jul 18
4
Understanding R's "Environment" concept
Hi all, I am trying to understand the R's "environment" concept
however the underlying help files look quite technical to me. Can
experts here provide me some more intuitive ideas behind this concept
like, why it is there, what exactly it is doing in R's architecture
etc.?
I mainly need some non-technical intuitive explanation.
Thanks,
2011 Jul 18
4
Understanding R's "Environment" concept
Hi all, I am trying to understand the R's "environment" concept
however the underlying help files look quite technical to me. Can
experts here provide me some more intuitive ideas behind this concept
like, why it is there, what exactly it is doing in R's architecture
etc.?
I mainly need some non-technical intuitive explanation.
Thanks,
2010 Aug 03
4
Need help on upper.tri()
HI, I am really messing up to make a symmetrical matrix using upper.tri() & lower.tri() function. Here is my code:
> set.seed(1)
> mat = matrix(rnorm(25), 5, 5)
> mat
[,1] [,2] [,3] [,4] [,5]
[1,] -0.6264538 -0.8204684 1.5117812 -0.04493361 0.91897737
[2,] 0.1836433 0.4874291 0.3898432 -0.01619026 0.78213630
[3,] -0.8356286 0.7383247
2011 Feb 19
2
Seeking help in Package development
Dear all, I am a new user of R and currently trying hard to develop my
own package. Here I am following this tutorial
'http://www.mathfinance.cn/how-to-create-an-R-package-in-windows/'
Here it says that (step 8): "open a ?command prompt? window, change
the directory to where your package is, type the command ?R CMD build
MonteCarloPi? to build the package, this will generate a file
2011 Mar 06
1
Writing Rd files
Hi all, I have created a package and now into writing it's help files.
However I am having problem on, how to put a 'new line' in any
statement of the help file? For example please consider following:
\title{
This is a new function and this function will calculate the mean.
}
However I want to write it is this way:
\title{
This is a new function & and,
this function will
2011 Jun 09
1
package.skeleton() does not create 'data' folder
Hi again, yesterday I mailed this query however I could not see this
on the mail list. Therefore, I am reposting it again.
I was using package.skeleton() function to create the
skeleton of my package in windows. Here is my attempt:
rm(list = ls())
setwd("F:/R_PackageBuild")
package.skeleton("trial1", namespace = TRUE, code_files =
"F:/R_PackageBuild/trial.r")
In
2011 Feb 09
2
A question on Duplicating
Hello I am struggling to accomplice an idea which is as follows:
I have a vector say: a <- c("a", "b", "c", "a") and another: b <- c("m",
"n", "o", "m"). Length of those 2 vectors are essentially be same. Here task
is to check the duplicates in the vector 'a' and then to check whether any
duplicates are
2010 Sep 03
2
Matrix to list
Dear all, suppose I have following matrix:
> mat <- matrix(rnorm(25), 5)
>
> mat
[,1] [,2] [,3] [,4] [,5]
[1,] 0.97056228 -1.3278509 -0.73511792 2.1650629 -0.4411997
[2,] 0.58613700 -0.2559899 -1.18334248 -1.4990907 1.8138846
[3,] -1.03333313 2.0227887 0.89622681 0.6483973 -1.5523283
[4,] 0.38968833 0.2490004 -0.02301061 -0.2705150
2011 Jun 10
1
How to add a welcome message in Package development?
Dear all, it is my first post in R-devel list, and hope that this is
the right place to ask question related to package development.
I have created my first package in Windows through the usual route.
Now I want to add some ***Welcome message*** as soon as user loads my
package into their R console, using library() function. However I
could not figure out where and how should I add this
2011 Jul 14
1
Creating package Vignette
Hi all, I was trying to create some vignette files for my newly
developed package, however wondering whether there could be any
simpler way to do so. In writing R extension it is advised to go
through Sweave route, however I have already got a big pdf file and
want to use this as package vignette.
So far I have manually created the inst/doc folder in the main package
skeleton, and put that file
2006 Oct 02
1
CCF and ACF
Dear all,
given two numeric vectors x and y, the ACF(x) at lag k is
cor(x(t),x(t+k)) while the CCF(x,y) at lag k is cor(x(t),y(t-k)). See
below for a simple example.
> set.seed(1)
> x <- rnorm(10)
> y <- rnorm(10)
> x
[1] -0.6264538 0.1836433 -0.8356286 1.5952808 0.3295078 -0.8204684
0.4874291 0.7383247 0.5757814 -0.3053884
> y
[1] 1.51178117 0.38984324
2011 Feb 02
0
How column names/row names are preserved in matrix calculation?
Can somebody tell me that, if I do some arithmetic calculation over 2
matrices then how the column names and row names are preserved? It seems
that, for multiplication, column names and row names of the 2nd matrix are
preserved and for additional, there seems not having any explicit rule:
> set.seed(1)
> dat1 <- matrix(rnorm(25), 5); colnames(dat1) = rownames(dat1) =
2007 May 28
1
where did the factor name go
> tmp <- data.frame(y=rnorm(12), a=factor(rep(letters[1:4],3)))
> tmp
y a
1 -0.60866099 a
2 0.55500538 b
3 0.12231693 c
4 -0.24613790 d
5 -0.09253593 a
6 -1.54652581 b
7 0.17204210 c
8 -1.22778942 d
9 1.22151194 a
10 -0.43982577 b
11 -1.25444287 c
12 -0.97251060 d
> tmp.aov <- aov(y ~ a, data=tmp)
> summary(tmp.aov)
Df Sum Sq Mean Sq F value
2011 Oct 13
3
Create order of numbers based on a given vector
Hello!
If I have a vector vec <- c(FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE
FALSE)
I can I create the following order of numbers based on vector vec:
1, 2, 2, 3, 3, 3, 4, 5
Whenever there is a FALSE I increase the number (starting with 1).
Whenever there is a TRUE I set the same number as the previous FALSE has
been assigned to.
I would be happy for any input
Cheers,
Syrvn
--
View
2004 May 26
5
Windows XP and domain logon
Hello,
I have installed samba 3.0.2a as PDC and BDC, I am able to add windows xp to domain and have added all the registry patches to windows xp, but when it comes to domain logon on windows xp client, the behaviour is very erratic, sometimes I am able to logon to domain and sometimes the domain logon fails, we need to restart the xp machine and keep trying to the domain logon. The error we
2003 Feb 11
3
Tcl/Tk support is not available on this system.
I am trying to get R to run on a Red Hat 8 system, I am running R version
1.6.2 with Tcl/Tk version 8.3.5 installed. When I try to test R from the
data_sets directory I get the error message;
Error in firstlib(which.lib.loc, package) :
Tcl/Tk support is not available on this system
Error in fileBrowser(textToShow = "Choose one CDF file" , nSelect = 1, :
tcl/tk library not available
2004 Dec 21
3
R code for var-cov matrix given variances and correlations
Dear list members,
Where can I find code for computing the p*p variance-covariance
matrix given a vector of p variances (ordered varA, varB, ...,
varp) and a vector of all possible correlations (ordered corAB,
corAC, ..., corp-1,p)?
I know that the covariance between 2 variables is equal to the
product of their correlation and their standard deviations:
corAB * varA^.5 * varB^.5
and so: