Displaying 20 results from an estimated 30000 matches similar to: "create a function given a string"
2003 Jul 17
3
how to divide a string into characters? - for comparing strings that is
Hi
I am searching for a way to do something like "ABC" -> c("A","B","C"). How can this be accomplished?
I tried cut() and split(), but they do something else, it seems.
The purpose for doing this is to find the number of common (and uncommon) characters, i.e. ultimately I want something like this:
> foo("ABD","ADE")
c(2,1) # 2
2007 Feb 06
4
Mongrel service will not start on win32 w/ --prefix option
All, I am in need of some help. I''ve run into a problem that I am not able
to fix or even troubleshoot. I am trying to run Mongrel as a service on
Win32.
Basically, my problem is that running Mongrel as a service works fine. Fine
until I change the configuration (using service::remove and
service::install) to use --prefix. I must have this as I am running multiple
webapps and app
2002 Dec 09
2
Sth better than cycle?
Hi,
I want to calculate expected likelihood over a 2D discrete
distribution, something like
\sum_k \sum_l p_{kl} L(v_k, v_l)
It is trivial to write a cycle like
for(k in 1:K)
for(l in 1:L)
sum <- sum + p[k,l]*L(v[k], v[l])
But is there a more clever way for R?
Best wishes,
Ott
2003 Nov 11
4
A co-occurrence matrix
Dear R experts,
I have a matrix (from some sort of
classification) like this:
object group
[1,] 1 1
[2,] 2 2
[3,] 3 1
[4,] 4 1
[5,] 5 3
And I need something like this:
[,1] [,2] [,3] [,4] [,5]
[1,] 1 0 1 1 0
[2,] 0 1 0 0 0
[3,] 1 0 1 1 0
[4,] 1 0 1 1 0
[5,] 0 0 0 0 1
where all
2002 Sep 23
4
Overall Title in par(mfrow)
Hi,
Say I did something like:
par(mfrow = c(1, 2))
plot(1:10)
plot(1:10)
and I'd like to have an overall title, i.e. a title that would appear,
centered, on the top of both plots, rather than the top of the last plot.
I tried:
title("FOO", outer = T)
but it doesn't appear right. Half of the FOO is outside the figure region
and can't be seen...
Is there another
2007 Apr 09
3
sem vs. LISREL: sem fails
I am new to R.
I just tried to recreate in R (using sem package and the identical input data) a solution for a simple measurment model I have found before in LISREL. LISREL had no problems and converged in just 3 iterations.
In sem, I got no solution, just the warning message:
"Could not compute QR decomposition of Hessian.
Optimization probably did not converge.
in: sem.default(ram =
2001 Oct 05
2
Reading in data in a triangle
I have plain-text data in lower triangular form that I want to read in. Does
anyone know of an easy way to do this?
______________________________________________________________________
Stuart Luppescu -=-=- University of Chicago
$(B:MJ8$HCRF`H~$NIc(B -=-=- s-luppescu at uchicago.edu
http://www.consortium-chicago.org/people/sl.html
http://musuko.uchicago.edu/pubkey.asc for PGP
2006 Nov 15
3
how to create this design matrix?
Hi all,
I have a multiple-linear regression problem.
There are 13 columns of data, the whole data matrix is: n x 13, where n is
the number of samples.
Now I want to regress EACH of the first 12 columns onto the 13th column,
with 2-parameter linear model y_i = b0 + b1 * x_i, where i goes from 1 to
n, and b0 is the intercept.
How do I create a design matrix to do the 12-column regression
2002 Jun 14
2
combination of different vector values
Hi,
Thanks in advance for the help.
I have a few vectors and I need to get all the combinations of the vector
values.
Normally I would use a few for-loops to do that.
e.g x1_c(1,3,5)
x2_c(2,5,6)
for (i in x1) {
for (j in x2) {
...
}}
My problem is that I don't know how many vectors there are ahead of time,
so
I don't know how many for-loops I need. Any
2002 May 28
4
Indexing Elements of a Dataframe
Hello List-Members,
Let's say that I have the following code:
for (i in c(10, 20, 30)) {
for (j in c(200, 400, 600)) {
...
...
x <- "something"
* (code here)
}
}
* Now, x is some result that I want to put into a results "matrix" that
looks like this:
200 400 600
10
20
30
I came up with an ad-hoc solution adding some counters (called
2002 Oct 02
4
Introduction of NA:s
Hello,
I wonder if someone could help me with the following: I have generated 10 000 values from rnorm and now I want to randomly replace 500 of those with NA. The problem is that values indexed between 6-10,16-20,26-30.... only should be considered for replacement. Any suggestions?
Patrik Waldmann
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing
2004 Feb 07
1
display functions in groupedData and lme
I'm trying to set up a mixed model to solve using lme. It will have 3
fixed effects, two random effects and two interaction terms.
I've been reading Pinheiro's and Bates's book on the nmle library, but
find the part about display functions to be unclear. When creating a
groupedData object from a data.frame, you need to enter a function of the
form: response ~primary|grouping
2000 Oct 03
0
FW: Parse Errors
Earlier I posted the message below to R-announce. Please, let me appologize
for this mistake, it was not intended. The solution was provided by Duncan
Murdoch who passed on a message he recieved from Brian Ripley which informed
me that settimg R_Interactive to 1 changes the default behavor of aborting
on an error.
Thankyou, Don Wingate.
-----Original Message-----
From: Don Wingate
2003 Apr 14
2
cannot create postscript files with trellis graphics inside a function
Dear People,
If I define
foo <-function()
{
x <- rnorm(500)
trellis.device(postscript, file="plot.ps")
densityplot(~x)
dev.off()
}
and call foo() then plot.ps is just a blank plot. However, if I extract
the lines inside foo and run them, ie.
x <- rnorm(500)
trellis.device(postscript, file="plot.ps")
densityplot(~x)
dev.off()
then plot.ps is created
2003 Nov 07
3
Q. About String indexing
Hi all - this is a very basic question: how does one index substrings of a character string, for example get the 2nd through 5th characters of the string "testing", in the R language? Indexing with square brackets seems only to work for vectors, lists, etc., and although I've found plenty of functions for concatenating strings, running substitutions with regexps and the like, I seem
2003 Mar 06
6
type III Sum Sq in ANOVA table - Howto?
Hello,
as far as I see, R reports type I sums of squares. I'd like to get R to
print out type III sums of squares.
e.g. I have the following model:
vardep~factor1*factor2
to get the type III sum of squares for factor1 I've tried
anova(lm(vardep~factor2+factor1:factor2),lm(vardep~factor1*factor2))
but that didn't yield the desired result.
Could anyone give me a hint how to proceed?
2018 Apr 27
2
Package 'data.table' in version R-3.5.0 not successfully being installed
Dear Akhilesh,
I hope that it's clear that the Windows binary I provided for the data.table package is a temporary solution, and that the maintainer should fix the package so that it passes its own tests. You should be careful using the package in its current state.
Best,
John
> -----Original Message-----
> From: Akhilesh Singh [mailto:akhileshsingh.igkv at gmail.com]
> Sent:
2001 Apr 28
9
two new packages
I've prepared preliminary versions of two packages that I plan eventually
to contribute to CRAN:
car (for "Companion to Applied Regression") is a package that provides a
variety of functions in support of linear and generalized linear models,
including regression diagnostics (e.g., studentized residuals, hat-values,
Cook's distances, dfbeta, dfbetas, added-variable plots,
2001 Apr 28
9
two new packages
I've prepared preliminary versions of two packages that I plan eventually
to contribute to CRAN:
car (for "Companion to Applied Regression") is a package that provides a
variety of functions in support of linear and generalized linear models,
including regression diagnostics (e.g., studentized residuals, hat-values,
Cook's distances, dfbeta, dfbetas, added-variable plots,
2001 Apr 28
9
two new packages
I've prepared preliminary versions of two packages that I plan eventually
to contribute to CRAN:
car (for "Companion to Applied Regression") is a package that provides a
variety of functions in support of linear and generalized linear models,
including regression diagnostics (e.g., studentized residuals, hat-values,
Cook's distances, dfbeta, dfbetas, added-variable plots,