Displaying 20 results from an estimated 600 matches similar to: "Writing a function"
2003 Apr 25
3
Code bug unresolved involving if condition
Hi R lovers!
I am a beginner in coding with R so my question may be very easily solved
but I don't know how.
I have written the following function in a .txt file
ClearDelta <- function(Matrix)
{
ncol<-ncol(Matrix);nrow<-nrow(Matrix);
for (i in 1:nrow) {
for (j in 1:(ncol-1))
{if (Matrix[i,j]==NA) (NA->Matrix[i,j+1])}
}
2003 Apr 28
0
Re: [R Thanks for help Writing a function
Thank you very much
It works perfectly well
Have a wonderful day
|---------+---------------------------->
| | ripley at stats.ox.a|
| | c.uk |
| | |
| | 04/28/03 12:58 PM|
| | |
|---------+---------------------------->
2003 Jun 06
3
writing comments within a function
Hi R lovers!
I would like to know how you can write comments inside the code of a
function
is it latex style
% ?
or any other language style?
thanks a lot
*************************************************************************
Ce message et toutes les pieces jointes (ci-apres le "message") sont
confidentiels et etablis a l'intention exclusive de ses destinataires.
Toute
2003 Jun 24
2
R and Latex's tables
Hi R lovers!
I have discovered recently that graph can be exported from R in a Latex
compatible file
thanks to the pictex command
I would like to know if there is the equivalent while exporting datas.
Let's say I have a matrix, a data.frame or a list that I would like to
export as a flat text file that is immediatly transcripted into a table
into latex
Is there a macro or package that could
2003 Apr 24
3
Missing Value And cor() function
Hi r lovers!
I 'd like to apply the cor() function to a matrix which have some missing values
As a matter of fact and quite logically indeed it doesn't work
Is there a trick to replace the missing value by the mean of each variable or by any other relevant figures ?
Or should I apply a special derivate of the cor() function, (I don't have any idea if it exists and have some trouble to
2003 Jun 05
4
counting missing values
Hello R lovers
I have written a little cute function to count the number of missing value
per row in a matrix and return the percentage of missing value
it takes a lot of time to run with a 1000 rows matrix
I'd like to know if there is a function already implemented to count the
number of occurence of a given values in a vector
For information,
here is the function
count<-0
for (i in
2003 Jun 02
1
authorized characters and symbols
Hi R lovers
Obviously I cannot use the underscore "_ " character to name an object in R
Is there a special reason for that ?
I want to use it to rename a function
maybe the problem is due to the nature of the object I work on
thanks for any comments on that very little and not very bothering trouble
*************************************************************************
Ce
2003 Nov 24
2
merging variable and character
Hi R lovers! I'd like to know the trick to get a plot with a title
associating variable and text
I'd like to plot something like
for (i in 1:10) plot(x[,i],ylab="Serie" & i)
to get Serie 1 Serie 2 so on and so forth... of course it doesn't work.
If somebody could give me an idea, it would be very nice
thank you very much and long life to R
Vincent
2003 Nov 06
3
import data troubles
HI R lovers,
I have been facing a petty trouble with datas' import :
I have a plain txt file (see attached file or the copy below) that I cannot
read either with scan or read.table
> scan(file="F:/Alt/HDG/Stoliaroff/Data/test.txt")
Error in scan(file = "F:/Alt/HDG/Stoliaroff/Data/test.txt") :
"scan" expected a real, got "??6"
>
2003 Dec 08
2
test for arima coef's significancy
Dear sirs,
I would like to know if there is a function to compute the pvalue for the
significancy of arima coef in an arima object created by
the arima function.
I have written this one:
pvalueArima<-function(x,arima)
{
t<-(arima$coef)/(diag(arima$var.coef)^0.5)
df<-length(x)-length(arima$coef)
1-pt(t,df)
}
Has somebody already implemented something equivalent ?
thank you for your
2003 Jul 15
3
clearing some part of a graph
Hi R lovers
2 questions:
1) I'd like to know how to clean the title, the sub title or the labels of
a graph. I know how to redefine it with the function title() but it
overwrites the previous title and do not replace it
2) How could I clear a whole plot (for example in a multiple figure
environment)
thanks for your help
vincent
2003 Jul 25
5
named list 'start' in fitdistr
Hi R lovers!
I'd like to know how to use the parameter 'start' in the function
fitdistr()
obviously I have to provide the initial value of the parameter to optimize
except in the case of a certain set of given distribution
Indeed according to the help file for fitdistr
" For the following named distributions, reasonable starting values
will be computed if `start'
2003 Nov 24
0
link between arima and arma fit
Hi dear sirs,
I am wondering why the fit of the time serie x with an arima and the fit of
diff(x) with an arma (same coeff p & d) differ one from another
here are the output of R:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> modelarma<-arma(diff(x),c(7,5))
> modelarma
Call:
arma(x = diff(x), order = c(7, 5))
Coefficient(s):
ar1 ar2 ar3 ar4 ar5 ar6 ar7 ma1 ma2
0.06078
2000 Feb 29
0
Smab Installation
Hi,
I have installed samba on one of my Unix server( SUN) and I am trying to access the share directory from a NT workstation. Earlier If I had used a guest account and I was able to connect to the share created on the Unix server. Now I want to access with users / groups through NT domain server which I received the following error :
The account is not authorized to login from this
2004 Feb 06
1
nnet problem
Hello everybody,
I want to use the nnet library and my problem is that the algorithm seems
to accept only class as target when the neural is fiiting. So the output
when I use predict.nnet is also a class. Is it possible to have numeric
variable as target ? If yes, what is the syntax ?
Thank you.
Cordialement,
R?gis CHARIGNON
2003 Nov 17
1
CLARA
I need informations about the clara routine. The on-line doc say that the
argument stand is a logical, indicating if the measurements in x are
standardized before calculating the dissimilarities. Measurements are
standardized for each variable (column), by subtracting the variable's mean
value and dividing by the variable's mean absolute deviation. If we note
STAND = TRUE, I suppose that
2012 Oct 22
0
"Vars" package: impulse response function
Hello,
I'm using VAR models in R in order to obtain impulse responses of stock
market shock on US economy.
I have series of quarterly changes in real gdp, S&P 500 and quarterly level
of unemployment for 1985 - 2012 period.
My series are stationary. So I did all the steps below. However I don't
understand what do irf function results mean. These are the cumulative
orthogonal responses
2004 Oct 07
2
title in bold - simple question in R 1.9.0
Hi,
how can i write this simple sentence : "Hello world" with "Hello" only
in bold ?
I try
> plot(1:5)
> title(main=paste(expression(bold("Hello")),"world",sep=" "))
but the result is wrong.
thanks,
Bruno
Si vous n'etes pas destinataires de ce message, merci d'avertir l'expediteur de l'erreur de distribution et de le
2005 Nov 09
3
dataframe without repetition
Hello,
with a data.frame like this :
> toto <-
data.frame(id=c("id1","id1","id2","id3","id3","id3"),dpt=c("13","13","34","30","30","30"))
> toto
id dpt
1 id1 13
2 id1 13
3 id2 34
4 id3 30
5 id3 30
6 id3 30
what is the most efficient ways to obtain :
id
2004 Jul 29
3
2 questions : format and hh:mm
Dear R-users,
i have two questions :
1- first of all, i wish to know the way to obtain a serie with a format
like "00" : ( "01","02","03","04"....) or like postal code
("01100","02222").
for instance, i do :
> format(strptime(as.character(c(1:4)),"%H"),"%H")
but it sounds complicate and not really