Displaying 20 results from an estimated 900 matches similar to: "nlminb--lower bound for parameters are dependent on each others"
2017 Jun 06
0
Force argument to have quotes
Harold:
As a general rule, if you are using eval(parse(...)) you are doing it
poorly in R; cf
library("fortunes")
fortune(106)
Why is something like this not suitable:
fun1 <- function(a1,a2,a3 = c("hi","by"))
{
   cat(a3,a1+a2,"\n")
}
> fun1 (1,2)
hi by 3
> fun1(1,2, a3 = "whoopee")
whoopee 3
... or, if you want to include the
2017 Jun 06
3
Force argument to have quotes
I am writing a program where non-technical R users will read in a config file and the config file will then parse the arguments found within the config and pass them to respective functions. I'm having trouble (efficiently) writing a piece of code to retain quotation marks around the argument which requires it as input, as found in the example function below, myFuncton1.
Below is a minimal,
2010 Jun 01
1
loop
Can any one help it will be very kind, loop statements
I have this table and some more records, I want to reshape it
V1 V2 V3 V4 V5 V6 V7 V8 V9 V10
TP53 Dis1 Dis2 Dis3 Dis4 Dis5 Dis6
DCI New1 New2 New3 New4
FDI Hi2 H3 H4
GHD I1 I3 I4 I5 I6 I7 I8
I want my new table or matrix to be some thing like this
V1 V2 V3
Tp53 Dis1 Dis2
Tp53 Dis1 Dis3
Tp53 Dis1 Dis4
Tp53 Dis1 Dis5
Tp53 Dis1 Dis6
Tp53 Dis2
2007 Oct 12
1
use 'lapply' to creat 2 new columns based on old ones in a data frame
There is a dataset 'm', which has 3 columns: 'index', 'old1' and 'old2';
I want to create 2 new columns: 'new1' and 'new2' on this condition: 
if 'index'==i, then 'new1'='old1'+add[i].
'add' is a vector of numbers to be added to old columns, e.g. add=c(10,20,30
...)
 
Like this:
index	    old1	    old2	    new1	   
2011 Sep 23
4
replace multiple string
Hi
I would like to use a bash script that searches files and
subdirectories name in a directory /var/ww/html/web
for a specific string, and when it finds the search string, replaces
the string (old1) with new string (new1), and so on
old2 with new2 ....oldn with newn.
replace_string.sh
#!/bin/bash
for db in $(find /var/www/html/web -name * -exec)
do
  sed -e "s/old1/new1/" \
  sed 
2009 Jul 01
4
mbox format and UIDVALIDITY
My base concern may be illustrated with the help of that simple telnet  
session:
	# telnet 127.0.0.1 imap
	Trying 127.0.0.1...
	Connected to localhost.
	Escape character is '^]'.
	* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE  
AUTH=PLAIN] Dovecot ready.
	a1 login testuser ******
	a1 OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID  
ENABLE SORT
2008 May 15
2
How to remove autocorrelation from a time series?
Dear R users,
someone knows how to remove auto-correlation from a frequencies time series?
I've tried by differencing (lag 1) the cumulative series (in order to have only positive numbers) , but I can't remove all auto-correlation.
If it's useful I can send my db.
x <-             # autocorrelated series
new1<-cumsum(x)
new2<-diff(new1,lag=1,differences = 1)
acf(new2)     #
2008 Jun 10
2
convert characters into integers in a matrix
Hello,
 
I will appreciate any suggestion for this simple problem. I have a matrix of
characters "A", "P", "M".
 
I want to convert those characters to integers 0,1, 1 respectively. I am
using the following R statements:
 
exprs.new<-gsub("P",1,exprs)
 exprs.new1 <- gsub("A",0,exprs.new)
 exprs.new2 <-
2007 Mar 14
0
cannot delete the last column of a dataframe using "[<-" (PR#9565)
Hi,
If df is a dataframe, its last column can't be deleted using "[<-", but
other columns can be deleted this way.
Example:
> (df <- df0 <- data.frame(x = 1:3, y = 4:6, z = 7:9))
  x y z
1 1 4 7
2 2 5 8
3 3 6 9
> df[, "z"] <- NULL
Error in x[[jj]] : subscript out of bounds
> df[, 3] <- NULL
Error in x[[jj]] : subscript out of bounds
>
2012 Feb 09
2
fill an array by rows
I've dug around but not been able to find anything, am probably missing 
something obvious.
How can I fill a three-dimensional (or higher dimension) array by rows 
instead of columns.
eg
new1 <- array(c(1:125), c(5,5,5))
works fine for me but fills it by columns and
new2 <- array(c(1:125), c(5,5,5), byrow=TRUE)
throws an error.
Am I missing something obvious?  I also tried
2012 Mar 03
1
Problem running stepAIC within a function.
Hi
I need to a function that automatically fits a regression to data, using the
stepAIC. I've ran the code manually and it works fine. However, when I run
the function on the same data, the following error occurs:
Problem in regimp(fullsim = simt, fullsim1 = simt1,..: Length of (weights)
(variable 4) is 4271 != length of others (4278) 
I got the function to output the length of the dataset
2011 Feb 05
1
Seeking help to define method for '+'
Dear all, I am trying to define "+" method for my newly defined s4 class
which is as follows:
 
setClass("Me", sealed=F,representation(x1 = "numeric", x2 = "character"))
new1 <- new("Me", x1=2, x2="comment1")
new2 <- new("Me", x1=3, x2="comment1")
 
setMethod("+", "Me",
2009 Apr 09
2
failed when merging two dataframes, why
Hi, R-listers,
Failed, when I tried to merge df1 and df2 by "codetot" in df1 and "codetoto"
in df2. I want to know the reason and how to merge them together. Data
frames and codes I have used were listed as followed. Thanks a lot in
advance.
df1:
popcode     codetot   p3need
BCPy01-01 BCPy01-01-1 100.0000
BCPy01-01 BCPy01-01-2 100.0000
BCPy01-01 BCPy01-01-3 100.0000
BCPy01-02
2009 Mar 19
1
object size of a matrix and a list
Hello,
My program calculates several variables at each iteration and some of them are
integers and the rest are numeric. When I save them into a matrix, all of them
are of numeric type, of course.
I'm trying to find a way to save time/memory of my program and I was thinking
that it might help to force some variables to be of integer type and the other
columns numeric type.
But when I
2008 Mar 30
1
norm_rand() in R-extension vs rnorm in R ---which is better?
I need to generate good quality of random numbers from univariate
normal distribution for further transformation. I tried rnorm in R but
it was not good sometimes. Someone said C++ standard library or
Fortran's built-in functions for that are good. I found that there is
double norm_rand() in R-extension.  Does this function, norm_rand()
use the same algorithm as rnorm in R or something similar
2008 May 05
1
Is there any way to find out how a certain functions are implemented in R?
Hello
I wrote a bootstrap program in C language that is called and run by R.
When I tried it, it is slow
and I'm trying to write and run the whole thing in C. But I cannot use
handy functions in R and
need to figure out how to write those functions by myself. Is there
any way that I can get the
actual codes that implement functions in R so that I can translate
them into other languages? For
2008 Mar 05
1
Question on "assign(paste.."
Hello,
I'm having trouble in using "assign(paste ..." command . I could create
several dataframes following trinomial distribution using it but it could
not be used to check their row means of the created dataframe.
For example, the following works:
probTrt=matrix(0,4,3);
probTrt;
#malf, death, normal
probTrt[1,]=c(0.064,0.119,0.817);#for Trt 1
probTrt[2,]=c(0.053,0.125,0.823);#for
2008 Apr 11
2
system.time gives error when "=" is used for assignment (R-2.6.0)
Hello list,
I found that system.time works correctly when I used "<-" to assign a
value to a variable but when I happened to use "=" instead of "<-", R
gave an error message:
"Error in system.time(your argument here...)". It happened with a few
functions I tried. Is this a bug or is there any circumstances that
"=" cannot be used for
2012 Jul 13
1
functions of vectors : loop or vectorization
I have a read a lot about the benefits of vectorization in R. I have a
program that takes "almost forever" to run. A good way to see if I have
learned something ... My problem can be summarized like this : I have a
nonlinear function of several variables that I want to optimize over one
letting the other describe a family of curves. In short, I wan't to optimize
f(x,a,b) for several
2008 May 04
1
help with segmentation fault
Hello all,
I'm trying to have C called by R. I wrote C codes that worked
perfectly fine with R-2.6.0 in
windows system ( using R tools).
I had to change to SuSE Linux (this system has 3.2 GHz  Intel
Xeon processors and 4 GB of RAM), the C codes were compiled okay but
when it was called to R-2.6.2, I got
error mesage :
***caught segfault***
address 0x1df5000, cause 'memory not