Displaying 20 results from an estimated 2000 matches similar to: "Calculate Mean from List"
2010 Jul 20
3
Sequence from 2 Vectors
I would like to create a vector that is a sequence from 2 vectors. Could
anyone provide suggestion on this?
For example
> a<-c(1,2,3)
> b<-a+2
> b
[1] 3 4 5
I would like to have a vector that is a sequence which starting from a
and ending at b
c = c(1:3,2:4,3:5)
c = c(1,2,3,2,3,4,3,4,5)
Thank you
Best Regards,
Suphajak Ngamlak
Equity and Derivatives Trading
Phatra Securities
2010 Sep 15
2
Get File Names in Folder, Read Files, Update, and Write
Dear All,
Could you please recommend how I can do this?
I have several text files in one folder. Let's name them A0801.RSK,
A0802.RSK, ....
I would like R to
1) Know all file names in this folder
2) Update value in one column of these files
3) Write results in another text file with _xval in the file names
Below is R code for read, update, and write one file
2010 Aug 04
1
SQLDF from Variable Matrix
Dear all,
I would like to do sample statistics, e.g. mean, median from very large
dataset. This is part of commands I use routinely with several dataset
so I would like to make it into function. The simplified examples are
Test<-data.frame(A=c('a','b','c','a','b','c'),B=c(1,2,3,4,5,6))
#Create function (This one work)
2011 Sep 07
1
Weight in Function RM
Dear all,
I am trying to do weighted regression using lm function in R. However, I have a question why the results from
1) lm(formula = Y~aX, weight = w)
2) lm(formula = wY~waX)
are different. Aren't they supposed to have the exactly same result?
Below are the R code to see difference in regression results
MatY <- c(0.15,0.42,0.31,0.22)
MatX <-
2010 Nov 25
1
Execute SQL Stored Procedure in R
Dear all,
I would like R to retrieve a table resulting from execute sql stored procedures. What function can I use? Can RODBC do it.
I tried
channel1 <- odbcConnect("ptsecmstqa01-alpha")
query <- paste("execute DB.dbo.usp_test")
Data<- sqlQuery(channel1, query)
However, it returned blank.
Best Regards,
Suphajak Ngamlak
Equity and Derivatives Trading
Phatra
2008 Jan 16
1
Quota 1.1 problem
Helo all,
I'm trying to use Dovecot v1.1.beta13 lda with ldap. I made a tons of
change in configurations but still can't set quota from ldap. See below:
Log:
Jan 16 17:37:09 mailserver-03 dovecot: auth(default):
userdb(teste at xxx.com.br,127.0.0.1): Invalid GID value '*:bytes=1033'
dovecot-ldap.conf:
user_attrs =
2007 Aug 14
2
State Space Modelling
Hey all,
I am trying to work under a State Space form, but I didn't get the help
exactly.
Have anyone eles used this functions?
I was used to work with S-PLUS, but I have some codes I need to adpt.
Thanks alot,
Bernardo
[[alternative HTML version deleted]]
2011 Oct 31
2
Linear Regression with Linear Equality Constraint
Please advice on the package I should use to run a linear regression model
(weighted least squared) with linear equality constraint. I initially tried
"constrOptim" but it turned out that it only supported inequality linear
constraint. Thank you very much in advance.
Cheers,
Jon
--
View this message in context:
2006 Nov 07
1
gamm(): nested tensor product smooths
I'd like to compare tests based on the mixed model representation of additive models, testing among others
y=f(x1)+f(x2) vs y=f(x1)+f(x2)+f(x1,x2)
(testing for additivity)
In mixed model representation, where X represents the unpenalized part of the spline functions and Z the "wiggly" parts, this would be:
y=X%*%beta+ Z_1%*%b_1+ Z_2%*%b_2
vs
y=X%*%beta+ Z_1%*%b_1+ Z_2%*%b_2 + Z_12
2008 May 21
2
Problem in converting natural numbers to bits and others
Hi,
I just started using R for about one week and I have few problems.
i)I have a problem in finding right function to convert a table of natural
numbers to bitwise. For a simple example;
I have the below table:-
Column Col1 Col2 Col3
Sample1 5 7 10
Sample2 0 2 1
Sample3 4 0 0
Supposedly i wanted to convert to :-
Column Col1 Col2 Col3
2011 Dec 21
2
unique combinations
Hi there,
I have a vector and would like to create a data frame, which contains
all unique combination of two elements, regardless of order.
myVec <- c(1,2,3)
what expand.grid does:
1,1
1,2
1,3
2,1
2,2
2,3
3,1
3,2
3,3
what I would like to have
1,1
1,2
1,3
2,2
2,3
3,3
Can anybody help?
2011 Feb 27
1
Plotting two lines on a graph when using par(mfrow=)
Basic question but still learning ....
How do I plot two lines (f$equity and f$bh.equity) on one of the three
graphs under mfrow ? I tried putting brackets around the first plot and
lines command but that didn't work.
par(mfrow=c(3,1))
{plot(f$Date,f$equity, col="blue", type="l", main="equity")
lines(f$bh.equity, col="gray")}
plot(f$Date,f$indicator,
2012 Aug 17
5
specific matrix element tranformation
Hi guys,
I am trying to write a function that allows me to perform specific
transformations to each element of
a 2 by 2 matrix to generate a 3 by 3 matrix.
Input into function-2 by 2 matrix
Output from function -3 by 3 matrix
For example:
# a is my original 2 by 2 matrix
#b is my new 3 by 3 matrix
set.seed(2)
a=matrix(rnorm(4),ncol=2)
#let's say these are the transformations i wish to
2005 Feb 22
2
Custom Menu Not Working
Greetings *`s,
I am having what appears to be a small problem, but the frustration is
erally getting to me, what am I doing wrong here ?
I used AMP to set up a custom menu, so if caller presses 1 it goes to
ext200, if caller presses 2 it goes to ext201 etc etc...
Now I have created a third option that when the caller presses 3 it must
play a sound and hang up.
No rocket science yet.
When
2012 Oct 14
6
transforming a .csv file column names as per a particular column rows using R code
Hello all,
I have a .csv file like below.
Tool,Step_Number,Data1,Data2... etc up to 100 columns.
A,1,0,1
A,2,3,1
A,3,2,1
.
.
B,1,3,2
B,2,1,2
B,3,3,2
.
.
...... so on upto 50 rows
where the column "*Tool*" has distinct steps in second column
"*Step_Number*",but both have same entries in Step_Number column.
I want the output like below.
2010 Apr 16
3
VERY SIMPLE QUESTION
Dear R users,
I am looking for more efficient way to compute the followings
--------------------------------------------------------------------------
a <- matrix(c(1,1,1,1,2,2,2,2),4,2)
b <- matrix(c(1,2,3,4),4,1)
Eventually, I want to get this matrix, `c`.
c <- matrix(c(1/1,1/2,1/3,1/4,2/1,2/2,2/3,2/4),4,2)
--------------------------------------------------------------------------
2004 Jun 16
5
Failed to authenticate on INVITE
Hi,
I upgraded my two asterisk boxes today to the latest cvs (up from 5/3/04).
These two boxes talk to eachother via sip, not iax. Since the upgrade, I
get the error "Failed to authenticate on INVITE" trying to make calls to/from
either box. Removing the secret from each box's sip config seems to work but
is utterly braindead.
Has anyone seen this?
- Eric
2004 Jul 23
4
hang up when going to voicemail
I have a little menu set up where hitting 1, 2, or 3 places the call through
to a cellular phone over IAX. That works. However, if caller hits 4 to go
into voicemail, the system hangs up. Am I doing something wrong in the dial
plan, or is this a CVS change? I had no trouble with this until I upgraded
to about 07/21 CVS, and I'm on 07/23 [latest] now with same results.
My dial plan:
2007 Aug 18
1
Restricted VAR parameter estimation
I have a VAR model with five macro-economic variables, y[1], y[2], y[3], y[4], y[5]. They are related to each other in following manner.
y[1,t] = alpha[1,0] + beta[1,1, 1]*y[1,t-1]+............+beta[1,1, 12]*y[1,t-12] + beta[1,2, 1]*y[2,t-1]+............+beta[1,2, 12]*y[2,t-12] + e[1,t]
y[2,t] = alpha[2,0] + beta[2,2, 1]*y[2,t-1]+............+beta[2,2, 12]*y[2,t-12] + e[2,t]
y[3,t] = alpha[3,0]
2012 Jul 03
1
Wrapper function for multivariate arrays for ode
I am trying to to write a wrapper function for the ode solver (under
the package desolve) to enable it to take multivariate arrays. I know
how to do it for 1 dimension arrays but my code breaks down when I try
to do it for 2 dimensional arrays. Here is my code
diffwrap<-function(t,y,mu)vdpol(t=t,A[1:3,1:4]<-y[1:12],B[1:12]<-y[13:24],mu=mu)
vdpol<-function(t,A,B,mu)
{
list(c(mu,