Displaying 20 results from an estimated 5000 matches similar to: "Optimization"
2012 Dec 18
7
Summarizing elements for a data.frame
Hello again, let say we have following data:
Dat1 <- structure(list(factor.sample.LETTERS.1.3...6..replace...T.. =
structure(c(1L,
3L, 2L, 1L, 3L, 3L), .Label = c("A", "B", "C"), class = "factor"),
factor.sample.letters.1.2...6..replace...T.. = structure(c(2L,
2L, 1L, 1L, 2L, 1L), .Label = c("a", "b"), class =
2009 Jun 23
2
Partitioning matrix
Let say, I have following matrix :
dat <- matrix(rnorm(40), 2, 20)
Now I want to partition this like this :
dat1 <- dat[1,]
dat2 <- dat[2,]
But point is that, dat1 and dat2 become vector object. How can I force them
to be matrix object with dimension (1x20) ?
Thanks,
--
View this message in context: http://www.nabble.com/Partitioning-matrix-tp24161021p24161021.html
Sent from the R
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
2012 Dec 14
5
A question on list and lapply
Dear all, let say I have following list:
Dat <- vector("list", length = 26)
names(Dat) <- LETTERS
My_Function <- function(x) return(rnorm(5))
Dat1 <- lapply(Dat, My_Function)
However I want to apply my function 'My_Function' for all elements of
'Dat' except the elements having 'names(Dat) == "P"'. Here I have
specified the name
2009 Sep 25
3
Problem on plotting TS using GGPLOT
Hi, I have following codes :
library(zoo); library(ggplot2); library(plyr)
dat <- rnorm(306); vv <- letters[1:6]; dat1 <- data.frame(dat, vv)
dat2 = zooreg(rnorm(51), as.yearmon(as.Date("2000-01-01")), frequency=12)
ggplot(dat1) +
geom_line(aes(y=dat, x=index(dat2), colour=vv), group=vv, size =
1.3)
However I got error while plotting them :
2012 Dec 06
1
Can somebody help me with following data manipulation?
Dear all, let say I have following data:
dat <- structure(list(V1 = structure(c(1L, 4L, 5L, 3L, 3L, 5L, 6L, 6L,
4L, 3L, 5L, 6L, 5L, 5L, 4L, 4L, 6L, 2L, 3L, 4L, 3L, 3L, 2L, 5L,
3L, 6L, 3L, 3L, 6L, 3L, 6L, 1L, 6L, 5L, 2L, 2L), .Label = c("C",
"G", "I", "O", "R", "T"), class = "factor"), V2 = c(0L, 0L, 0L,
1L, 1L, 1L, 1L, 0L,
2013 Feb 26
3
Merging value labels into indicator variable.
I have a vaiable named NAM having value : 1,2,3,4,5,6,7,8,9. I want to
make an indicator variable that will take value 1 if NAM=7 or NAM=8 or
NAM=9. How can I do that?
I usually do: Var001<- ifelse(NAM==7,1,0) for the simplest case.
[[alternative HTML version deleted]]
2013 Jan 15
2
Need some help on Text manipulation.
Dear all,
Let say I have following data-frame:
Dat <- structure(list(dat = c(-0.387795842956327, -0.23270882099043,
-0.89528973290562, 0.95857175595512, 1.61680582493783, -1.17738110289352,
0.210601060411423, -0.827369747447338, -0.36896112964414, 0.440288648776096,
1.28018410608809, -0.897113649961341, 0.342216546981718, -1.17288066266219,
-1.57994101992621, -0.913655547602414,
2017 Sep 15
7
require help
hello to all. I am working on macroeconomic data series of India, which in
a yearly basis. I am unable to convert my data frame into time series.
kindly help me.
also using zoo and xts packages. but they take only monthly observations.
'data.frame': 30 obs. of 4 variables:
$ year: int 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 ...
$ cnsm: num 174 175 175 172 173 ...
$ incm:
2019 Sep 12
1
Calling a LAPACK subroutine from R
Followup:
I have checked my package nleqslv which uses dgemv only from Fortran, on Kubuntu 18.04 with the development version of R.
No errors or problems.
Berend
> On 12 Sep 2019, at 08:57, Berend Hasselman <bhh at xs4all.nl> wrote:
>
>
> I have tried what I proposed in a virtual Kubuntu 18.04 which uses gfortran 7.4.
> I used the latest development version of R.
>
2017 Sep 16
2
require help
You can just use the same code that I provided before but now use your
dataset. Like this
df <- read.csv(file="data2.csv",header=TRUE)
dates <- as.Date(paste(df$year,"-01-01",sep=""))
myXts <- xts(df,order.by=dates)
head(myXts)
#The last command "head(myXts)" shows you the first few rows of the xts
object
year cnsm incm wlth
2017 May 10
3
registering Fortran routines in R packages
Thanks for your email.
I try to change the name in lowercase but it conflicts with a C implementation also named halton. So I rename the C function halton2() and sobol2() while the Fortran function are HALTON() and SOBOL() (I also try lower case in the Fortran code). Unfortunately, it does not help since I get
init.c:97:25: error: use of undeclared identifier 'halton_'; did you mean
2017 Sep 24
2
gsDesign Pocock & OBF boundary
Sorry for messed up text. Here it goes again:
I am learning to use the gsDesign package.
I have a question about Pocock and OBF boundary. As far as I can understand, these 2 boundaries require equal spacing between interim analyses (maybe this is not correct?). But looks like I can still use gsDesign to run an analysis based on unequal spacing:?
>
2012 Aug 31
3
fitting lognormal censored data
Hi ,
I am trying to get some estimator based on lognormal distribution when we have left,interval, and right censored data. Since, there is now avalible pakage in R can help me in this, I had to write my own code using Newton Raphson method which requires first and second derivative of log likelihood but my problem after runing the code is the estimators were too high. with this email ,I provide
2019 Sep 11
4
Fw: Calling a LAPACK subroutine from R
Berend,
I do not think this works with gfortran 7+. I am calling the BLAS
subroutine dgemv from Fortran code in my package eha, and the check
(with R-devel) gives:
gmlfun.f:223:1: warning: type of ?dgemv? does not match original
declaration [-Wlto-type-mismatch]
& score, ione)
^
/home/gobr0002/R/src/R-devel/include/R_ext/BLAS.h:107:1: note: type
mismatch in parameter 12
2019 Feb 06
2
nlminb with constraints failing on some platforms
> On 6 Feb 2019, at 10:58, Martin Maechler <maechler at stat.math.ethz.ch> wrote:
>
.....
> ---------------------------------------------------------------------------
>
> I summarize what has been reported till:
>
> Failure in these cases
> ========
> 1. Kasper K ("Scientific Linux", self compiled R, using Intel's MKL
> for BLAS/LAPACK)
2017 Dec 14
3
Errors in reading in txt files
On Thu, Dec 14, 2017 at 1:58 PM, Berend Hasselman <bhh at xs4all.nl> wrote:
>
>> On 14 Dec 2017, at 19:36, lily li <chocold12 at gmail.com> wrote:
>>
>> Hi R users,
>>
>> I have a question about reading from text files. The file has the structure
>> below:
>>
>> Time Column1 Column2
>>
2019 Sep 12
2
Fw: Calling a LAPACK subroutine from R
On 11/09/2019 21:38, Berend Hasselman wrote:
> The Lapack library is loaded automatically by R itself when it needs it for doing some calculation.
> You can force it to do that with a (dummy) solve for example.
> Put this at start of your script:
>
> <code>
> # dummy code to get LAPACK library loaded
> X1 <- diag(2,2)
> x1 <- rep(2,2)
> # X1;x1
> z <-
2010 Mar 10
4
write.fortran
Dear all,
I'm trying to write tabular data to a text file, these data will be
the input of a Fortran program. The format needs to be
"(i7,2x,7(e15.7,2x))". I have not been able to find a clean way of
producing this output with write.table. I searched for a
"write.fortran" function similar to read.fortran() in package utils
but I couldn't find any. Below is a small
2017 Feb 09
3
Ancient C /Fortran code linpack error
In my package 'glmmML' I'm using old C code and linpack in the
optimizing procedure. Specifically, one part of the code looks like this:
F77_CALL(dpoco)(*hessian, &bdim, &bdim, &rcond, work, info);
if (*info == 0){
F77_CALL(dpodi)(*hessian, &bdim, &bdim, det, &job);
........
This usually works OK, but with an ill-conditioned data