Displaying 20 results from an estimated 1000 matches similar to: "S4 class extending data.frame?"
2006 Jul 08
2
String mathematical function to R-function
hello
I make a subroutine that give-me a (mathematical)
function in string format.
I would like transform this string into function ( R
function ).
thanks for any tips.
cleber
#e.g.
fun_String = "-100*x1 + 0*x2 + 100*x3"
fun <- function(x1,x2,x3){
return(
############
evaluation( fun_String )
############
)
True String mathematical function :-( :-(
> nomes
[1]
2009 Nov 09
3
How to transform the Matrix into the way I want it ???
Hi, R users,
I'm trying to transform a matrix A into B (see below). Anyone knows how to
do it in R? Thanks.
Matrix A (zone to zone travel time)
zone z1 z2 z3 z1 0 2.9 4.3 z2 2.9 0 2.5 z3 4.3 2.5 0
B:
from to time z1 z1 0 z1 z2 2.9 z1 z3 4.3 z2 z1 2.9 z2 z2 0 z2 z3 2.5 z3 z1
4.3 z3 z2 2.5 z3 z3 0
The real matrix I have is much larger, with more than 2000 zones. But I
think it should
2012 Aug 08
3
help, please! matrix operations inside 3 nested loops
hello, this is my script:
#1) read in data:
daten<-read.table('K:/Analysen/STRUCTURE/input_STRUCTURE_tab_excl_5_282_559.txt',
header=TRUE, sep="\t")
daten<-as.matrix(daten)
#2) create empty matrix:
indxind<-matrix(nrow=617, ncol=617)
indxind[1:20,1:19]
#3) compare cells to each other, score:
for (s in 3:34) { #walks though the matrix colum by colum, starting at
2011 Mar 29
5
Integration with variable bounds
If this is posted elsewhere I cannot find it. I need to perform multiple
integration where some of the variables are in the bounds of the other
variables. I was trying to use R2Cuba function but cannot set the upper and
lower bounds. My code so far is :
int <- function(y){
u2 = y[1]
z2 = y[2]
u1 =y[3]
z1 = y[4]
ff <- u1*(z1-u1)*u2*(z2-u2)*exp(-0.027*(12-z2))
return(ff)
}
2006 Jun 15
3
matrix selection return types
Dear Rusers,
I would like some comments about the following results
(under R-2.2.0)
> m = matrix(1:6 , 2 , 3)
> m
[,1] [,2] [,3]
[1,] 1 3 5
[2,] 2 4 6
> z1 = m[(m[,1]==2),]
> z1
[1] 2 4 6
> is.matrix(z1)
[1] FALSE
> z2 = m[(m[,1]==0),]
> z2
[,1] [,2] [,3]
> is.matrix(z2)
[1] TRUE
Considered together, I'm a bit surprised about
2002 Mar 27
2
Error with nls
Dear R-group members,
I use:
platform i386-pc-mingw32
arch x86
os Win32
system x86, Win32
status
major 1
minor 4.1
year 2002
month 01
day 30
language R
I try to fit a 2 compartment model. The compartments are open, connected
to each other and
2017 Jul 28
3
problem with "unique" function
I have the joint distribution of three discrete random variables z1, z2 and
z3 which is captured by "z"
and "prob" as described below.
For example, the probability for z1=0.46667, z2=-1 and z3=-1 is 2.752e-13.
Also, the probability adds up to 1.
> head(z) z1 z2 z3
[1,] -0.46667 -1.0000 -1.0000
[2,] -0.33333 -0.9333 -0.9333
[3,] -0.20000 -0.8667 -0.8667
2008 Oct 04
3
How to plot countours with fixted densities?
Hello,
I used the following codes to generate bivariate normal dependence structure with unit Frechet margins.
Sigma <- matrix(c(1,.5*sqrt(1),.5*sqrt(1),1),2,2) # generate
y <- mvrnorm(Nsam, c(0,0), Sigma) # random
v <- cbind(pnorm(y[,1],mean = 0, sd = 1), pnorm(y[,2],mean = 0, sd = 1))
z <- cbind(-1/log(v[,1]),-1/log(v[,2]))
z1 <- z[,1]
z2 <- z[,2]
And to
2008 Jul 11
1
Comparing complex numbers
Is there an easy way to compare complex numbers?
Here is a small example:
> (z1=polyroot(c(1,-.4,-.45)))
[1] 1.111111-0i -2.000000+0i
> (z2=polyroot(c(1,1,.25)))
[1] -2+0i -2+0i
> x=0
> if(any(identical(z1,z2))) x=99
> x
[1] 0
# real and imaginary parts:
> Re(z1); Im(z1)
[1] 1.111111 -2.000000
[1] -8.4968e-21 8.4968e-21
> Re(z2); Im(z2)
[1] -2
2013 Oct 18
1
crr question in library(cmprsk)
Hi all
I do not understand why I am getting the following error message. Can
anybody help me with this? Thanks in advance.
install.packages("cmprsk")
library(cmprsk)
result1 <-crr(ftime, fstatus, cov1, failcode=1, cencode=0 )
one.pout1 = predict(result1,cov1,X=cbind(1,one.z1,one.z2))
predict.crr(result1,cov1,X=cbind(1,one.z1,one.z2))
Error: could not find function
2006 Jan 27
1
about lm restrictions...
Hello all R-users
_question 1_
I need to make a statistical model and respective ANOVA table
but I get distinct results for
the T-test (in summary(lm.object) function) and
the F-test (in anova(lm.object) )
shouldn't this two approach give me the same result, i.e
to indicate the same significants terms in both tests???????
obs.
The system has two restrictions:
1) sum( x_i ) = 1
2) sum(
2010 Jan 29
1
use zoo package with multiple column data sets
Readers,
I am trying to use the zoo package with an array of data:
file1:
hh:mm:ss 1
hh:mm:ss 2
hh:mm:ss 3
hh:mm:ss 4
file2:
hh:mm:ss 11 55
hh:mm:ss 22 66
hh:mm:ss 33 77
hh:mm:ss 44 88
I wanted to merge these data set so I tried the following commands:
library(chron)
library(zoo)
z1<-read.zoo("path/to/file1.csv",header=TRUE,sep=",",FUN=times)
2006 Jun 14
3
A question about stepwise procedures: step function
Dear all,
I tried to use "step" function to do model selection, but I got an error massage. What I don't understand is that data as data.frame worked well for my other programs, how come I cannot make it run this time. Could you please tell me how I can fix it?
***************************************************************************************************
2009 Nov 24
1
Titles in plots overlap
Hi,
I use fCopulae package to draw different graphs of univariate and bivariate skew t. But the plots titles overlap. I tried using cex.main, font.main to adjust the size but they still overlaps. Here is my code:
par(mfrow = c(3, 1))
mu = 0
Omega = 1
alpha1 = 0
alpha2 = 1.5
alpha3 = 2
alpha4 = 0.5
Z1 = matrix(dmvst(x, 1, mu, Omega, alpha1, df = Inf), length(x))
Z2 = matrix(dmvst(x, 1, mu,
2009 Mar 19
1
two plots side-by-side with persp3d(rgl)
Dear R-users,
I would like to place two 3D plots side-by-side in a rgl-setting. It would nice to have something like "par(mfrow=c(1,2))" for basic plots, or an array framework for wireframe(lattice) (see example below). I only managed to overlap two persp3d plots.
My final idea would be to animate both surfaces using play3d(rgl).
Thanks in advance for any help.
Best,
Carlo Giovanni
2008 Apr 03
3
summary(object, test=c("Roy", "Wilks", "Pillai", ....) AND ellipse(object, center=....)
Dear All,
I would be very appreciative of your help with the following
1). I am running multivariate multiple regression through the manova() function (kindly suggested by Professor Venables) and getting two different answers for test=c("Wilks","Roy","Pillai") and tests=c("Wilks","Roy",'"Pillai") as shown below. In the
2004 Feb 27
4
question
Hi everybody.
The question:
I get two vectors 'iFalseFalse' and 'i2'.
I think they should be the same but they are not.
Is it because
R does not handle complicated logical expressions in such cases
or I do something wrong?
> z1 = c(NA, "", 3, NA, "", 3)
> z2 = c("", "", 3, NA, 3, NA)
> cV = (as.character(z1)==as.character(z2))
2004 Mar 10
1
Shorewall2 - Action commands
Dear All,
I have read all the documentation I can find but I still have not understood how, in what context and where to use the action commands enumerated in /usr/share/shorewall/actions.std.
Illustrating with SMB traffic for instance, how can one use AllowSMB, DropSMB and RejectSMB to control SMB traffic instead of the classic
ACCEPT z1 z2 udp 135,445
ACCEPT z1
2017 Jul 28
0
problem with "unique" function
Most likely, previous computations have ended up giving slightly different values of say 0.13333. A pragmatic way out is to round to, say, 5 digits before applying unique. In this particular case, it seems like all numbers are multiples of 1/30, so another idea could be to multiply by 30, round, and divide by 30.
-pd
> On 28 Jul 2017, at 17:17 , li li <hannah.hlx at gmail.com> wrote:
2009 Jul 02
1
lpSolve: how to allow variables to become negative
Dear all,
I am interested in solving a MIP problem with binary outcomes and
continuous variables, which ARE NOT RESTRICTED TO BE NEGATIVE. In
particular,
Max {z1,z2,z3,b1} z1 + z2 + z3
(s.t.)
# 7 z1 + 0 z2 + 0 z3 + b1 <= 5
# 0 z1 + 8 z2 + 0 z3 - b1 <= 5
# 0 z1 + 0 z2 + 6 z3 + b1 <= 7
# z1, z2, z3 BINARY {0,1}
# -5<= b1 <=5 (i.e. b1 <= 5; -b1 <= 5 )
Using