Re: [R] as.numeric looses precision

2015-07-02 Thread Kehl Dániel
Hi Roger, I think it does! Try multiplying with 100 or similar. It is just a matter of displaying your result. best d Feladó: R-help [r-help-boun...@r-project.org] ; meghatalmaz#243;: Bos, Roger [roger@rothschild.com] Küldve: 2015. július 2.

Re: [R] Problem with apply list to function: numerical expression has 4 elements: only the first used

2015-05-24 Thread Kehl Dániel
Dear Narua, Others might suggest other things but here are some of my points. In general it is not a good idea to call a function F as it is an abbreviation for FALSE. Also it might be a good idea to write your functions in a way that they check the length of the arguments and behave

Re: [R] Reading access file

2015-05-14 Thread Kehl Dániel
Hi Silvano, your attachment did not go through (only a couple of formats are supported). Please try to give your code next time and what error you get but first read this, it might help: http://www.statmethods.net/input/dbinterface.html best, daniel

Re: [R] Reading a tiff image

2015-05-14 Thread Kehl Dániel
Hello, please set your mailing program to plain text instead of HTML if you post to this list. If you google read tiff in R you end up with the package called 'tiff'. (http://cran.r-project.org/web/packages/tiff/tiff.pdf) In case you do not know how to install and load a package, please consult

Re: [R] Not able to submit work assignment4 with submitscript3.R

2015-05-07 Thread Kehl Dániel
Hi there, this is not a Coursera Forum. Please ask your question there or search the Forums, these are quite regular problems there. PS: do you really have a user name and a password in your e-mail? Feladó: R-help [r-help-boun...@r-project.org] ;

Re: [R] Need Help!

2015-05-06 Thread Kehl Dániel
Hi, type res #ENTER (now it contains your results as a vector) or head(res) #so you only see the first couple of values or plot(res) #to see a basic plot (you could set axis labels etc, but I suggets you to go ahead and read a tutorial on R! Best, have a great time with R, kd

Re: [R] Need Help!

2015-05-04 Thread Kehl Dániel
Dear Dawood, it is not a really good idea to open a new email with the same problem you already posted earlier. I see you accepted some suggestions (HTML, seq) but not others (pi is a defined constant in R, do not change it, type pi ENTER to see this.). I would like to add one more, c is a

Re: [R] Plotting Confidence Intervals

2015-05-02 Thread Kehl Dániel
Hi Andre, I think you'll have to give some more information about what you want to see on your plot. The 4 intervals with labels? A bar with an interval maybe? Four bars with the intervals? Only two showing differences between conf and pred intervals? Also you do miss a 1 here I guess:

Re: [R] (no subject)

2015-05-02 Thread Kehl Dániel
hi, did you try this? http://lmgtfy.com/?q=runs+test+in+r best, d Feladó: R-help [r-help-boun...@r-project.org] ; meghatalmaz#243;: Hosesin Nezami [hosseinnezami1...@yahoo.com] Küldve: 2015. május 2. 9:48 To: R-help@r-project.org Tárgy: [R] (no subject)

Re: [R] cbind question, please

2015-04-24 Thread Kehl Dániel
Hello, I am not sure what you mean by a matrix. If you want to have a matrix, use the function matrix, (matrix(c(dog,cat,tree),3)) but I have the feeling you really want a data frame as you are talking about variables. In that case simply use mydataframe - data.frame(dog,cat,tree) If you are

Re: [R] Simulate values

2015-04-07 Thread Kehl Dániel
Hi Mike, please keep conversation on the list. Your code looks wy better now. I would not name the variable variances2 but that is just a matter of taste. What you could also do as a one-liner is something like n - 40 REPS - 5 mu - 10 sigma - 5 chisq -

Re: [R] Simulate values

2015-04-06 Thread Kehl Dániel
People do not usually do homework stuff here but I do not see the point in repeating the same sample 500 times. You might want to simulate 40x500 independent samples and put those in a matrix (see ?matrix) with lets say 40 rows and 500 columns. Once done, you can apply calculate the 500 sample

Re: [R] Correlation question

2015-02-21 Thread Kehl Dániel
Hi, try cor(fitted.right,fitted.wrong) should give 1 as both are a linear function of speed! Hence cor(cars$dist,fitted.right)^2 and cor(x=cars$dist,y=fitted.wrong)^2 must be the same. HTH d Feladó: R-help [r-help-boun...@r-project.org] ;

Re: [R] simple question - mean of a row of a data.frame

2015-02-11 Thread Kehl Dániel
Hi, rock[2,] is a data frame and you should not use sum() on a data frame, first google hit for the error message gives http://stackoverflow.com/questions/19697498/r-beginner-argument-is-not-numeric-or-logical-returning-na Otherwise I think you should use ?rowSums and ?rowMeans if you have

Re: [R] plot circles where z values are circles radius

2015-01-23 Thread Kehl Dániel
Hi, see the help and especially the argument inches: Argument inches controls the sizes of the symbols. If TRUE (the default), the symbols are scaled so that the largest dimension of any symbol is one inch. If a positive number is given the symbols are scaled to make largest dimension this

Re: [R] Making several plots using a loop function

2014-06-24 Thread Kehl Dániel
Hi, try something like main=paste(plot,i) in the plot command. HTH, kd Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ; meghatalmaz#243;: li li [hannah@gmail.com] Küldve: 2014. június 24. 15:17 To: r-help Tárgy: [R] Making

Re: [R] how to add a table under a plot?

2014-05-23 Thread Kehl Dániel
Hi, the function is in the plotrix package, so you have to install and call that package first. After installing see example(addtable2plot). HTH, daniel Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ; meghatalmaz#243;: Helen Gao

Re: [R] bin a vector of continuous variables

2014-05-15 Thread Kehl Dániel
Hi, you might try writing your own function, something like roundDown - function(x) floor(x/100)*100 roundDown(c(2282,174,273,432)) [1] 2200 100 200 400 and than apply it to your column. Please use ?dput next time to present your data, and post in plain text, instead of HTML. best,

Re: [R] uniform number

2014-05-05 Thread Kehl Dániel
Maybe you thought the binomial distribution? see ?rbinom best, kd Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ; meghatalmaz#243;: Rolf Turner [r.tur...@auckland.ac.nz] Küldve: 2014. május 5. 9:27 To: Ragia Ibrahim Cc:

Re: [R] locating a data value in 3-dimensional data set

2014-04-08 Thread Kehl Dániel
Dear Mamuash Bukana, is this a data frame with variable names you indicated? you will need something like which(dataframename$variablename == x) but if you have more you might use HTH kd Feladó: r-help-boun...@r-project.org

[R] continuous time AR - predict/interpolate

2014-03-30 Thread Kehl Dániel
Dear Members, I have a dataset that is similar to the first example in the car function, cts package data(V22174) fit - car(V22174,scale=0.2,order=7, ctrl=car_control(trace=TRUE)) summary(fit) I would like to ask if there is a way to get the predicted/fitted values for all the timepoints

Re: [R] Computing predictive values

2014-03-30 Thread Kehl Dániel
Hi Tom, I think you are going to get better answers if you include some code which helps reproducing what you are doing for other users (posting guide). Exporting regression outputs to Excel does not seem to be the way to go. Aren't you just looking for ?predict. I am sure R can do the job for

Re: [R] Determine breaks based on a break type...

2014-03-22 Thread Kehl Dániel
Hi, you possibly know that there are a lot of methods to determine the number of bins. As a default R has the Sturges method. I think it does something like x - runif(100) mybreaks - hist(runif(x))$breaks r - max(x)-min(x) br - nclass.Sturges(x) #note this is a really simple approach and see

Re: [R] Assign numbers in R

2014-03-12 Thread Kehl Dániel
Hi, is this homework? Try d - c(8,7,5,5,3,3,2,1,1,1) r - rep(1,length(d)) for (i in 2:length(d)) { if (d[i] != d[i-1]) { r[i]=r[i-1]+1; } else { r[i] = r[i-1]; } } Although I am sure there are better solutions! HTH daniel Feladó:

Re: [R] Fwd: Using comma as decimal mark in plots

2014-03-07 Thread Kehl Dániel
Hi, take a look at this old conversation. I do not know about an other workaround, but maybe somebody else will know something. As we also use commas in Hungary, I am also affected by this. https://stat.ethz.ch/pipermail/r-help/2002-January/018030.html HTH daniel

Re: [R] fitting a time series into a GARCH model using fGarch

2014-02-25 Thread Kehl Dániel
Dear Charles, see the help file and the examples at http://cran.r-project.org/web/packages/fGarch/fGarch.pdf or use ?garchFit in the examples you will see for example: garchFit(~ garch(1,1), data = x.vec, trace = FALSE) Try something like that. Make sure you provide the package of the function

Re: [R] I am new to R

2014-02-13 Thread Kehl Dániel
Dear Shikami, R comes with excellent material, look for it in your /doc/manual folder, start with R-intro.pdf. Have fun on your hopfully long journey with R! daniel Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ; meghatalmaz#243;:

Re: [R] match - returns a vector of the positions of (first) matches - looking for All positions.

2014-02-03 Thread Kehl Dániel
Dear Witold, as a first hint: read posting guide please! People are answering in their free time, so please try to be polite! For your first problem: what are you expecting? You have a dataset where most of the values is missing, the others all 0's most of the time, and some Inf values as

Re: [R] Error Help only 0's may be mixed with negative subscripts

2014-01-31 Thread Kehl Dániel
Dear Agapitus, we do not know what your variables look like but I assume ((zlim[2] - z_invDist)/zlen) * 7 produces a vector with both positive and negative numbert and you are using these numbers to extract elements of an other vector. If the numbers were all positive or negative, it would

Re: [R] Markov chain simulation

2014-01-28 Thread Kehl Dániel
Hi, see inline Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ; meghatalmaz#243;: Armel KAPTUE [armel.kap...@sdstate.edu] Küldve: 2014. január 28. 8:16 To: R-help@r-project.org Tárgy: [R] Markov chain simulation Hi there, I'm wonder

Re: [R] how to replace NA values

2014-01-19 Thread Kehl Dániel
Dear Kinsly, try http://bit.ly/1mhXOfH Although values are usually missing for some good reason. Changing them to 0 might be very dangerous, R is going to think that ID3, 6 and 8 are all newborn babies! best daniel Feladó: r-help-boun...@r-project.org

Re: [R] Figure title

2012-06-20 Thread Kehl Dániel
Try ?bquote HTH kd 2012.06.20. 10:36 keltezéssel, Joaquim J.S. Ramalho írta: Hi, I created several figures and their titles should appear like this: Figure 1: Monte Carlo results for alternative estimators of structural parameters (N = 100, T = 5) Because N and T change across

Re: [R] Smoothing a persp graph

2012-06-19 Thread Kehl Dániel
Take a look at the kde2d function in the MASS package, maybe it helps. Best kd 2012.06.19. 14:26 keltezéssel, Guillaume Chapron írta: Hi, I'm unable to find a way to smooth data for a persp() graph. Example, suppose that I have data x,y,z like this: x- 1:10 y- 1:10 k- 20 z-

Re: [R] R matrix help

2012-06-14 Thread Kehl Dániel
If you have your data in x, you can try something like matrix(x,length(x)/4,4) hth kd 2012.06.14. 14:51 keltezéssel, karthicklakshman írta: Dear R experts, I am interested in getting the dimensions for the matrix dynamically, based on the the number of elements in a matrix for example. if

Re: [R] Rank a numerical variable

2012-05-28 Thread Kehl Dániel
hi, read an Introduction to R. ?rank is what you are looking for? kd 2012.05.28. 20:17 keltezéssel, gaiarrido írta: hello, Is there any function in R to transform a numerical continuos variable in a ranked variable? Thanks - Mario Garrido Escudero PhD student Dpto. de Biología Animal,

Re: [R] estimation problem

2012-05-04 Thread Kehl Dániel
keltezéssel, Petr Savicky írta: On Thu, May 03, 2012 at 03:08:00PM +0200, Kehl Dániel wrote: Dear List-members, I have a problem where I have to estimate a mean, or a sum of a population but for some reason it contains a huge amount of zeros. I cannot give real data but I constructed a toy example

[R] estimation problem

2012-05-03 Thread Kehl Dániel
Dear List-members, I have a problem where I have to estimate a mean, or a sum of a population but for some reason it contains a huge amount of zeros. I cannot give real data but I constructed a toy example as follows N1 - 10 N2 - 3000 x1 - rep(0,N1) x2 - rnorm(N2,300,100) x - c(x1,x2) n

Re: [R] estimation problem

2012-05-03 Thread Kehl Dániel
Dear Jeff, thank you for the response. Of course I know this is a theory question still I hope to get some comments on it (if somebody already dealt with alike problems might suggest a package and it would not take longer than saying this is a theoretical question) The values are counts, so 0

[R] compare two matrices

2012-04-10 Thread Kehl Dániel
Dear Members, I have two estimated transition matrices and I want to compare them. In fact I want to check the hypothesis if they come from the same process. I tried to look for some test but all I found was independence test of contingency tables. The following code shows that the usual

Re: [R] simple matrix calculation

2012-03-29 Thread Kehl Dániel
in this solution and you can use this idea sometime! Thank you again, have a great day Daniel 2012.03.29. 8:48 keltezéssel, Petr Savicky írta: On Wed, Mar 28, 2012 at 10:46:11PM +0200, Kehl Dániel wrote: Dear list-members, I have a 9-by-9 matrix lets call it A with first row a11, a12, a13

[R] simple matrix calculation

2012-03-28 Thread Kehl Dániel
Dear list-members, I have a 9-by-9 matrix lets call it A with first row a11, a12, a13,..., a19 etc. I also have a vector of length 3 (B). I want to construct a matrix of size 3x3 in the following way: - divide matrix A to 9 3x3 blocks - first is a11, a12, a13 a21, a22, a23

[R] lists everywhere

2011-12-05 Thread Kehl Dániel
Dear list members, I have a really simple problem. I connected to a DB and have the following query adat - dbGetQuery(con, paste(select * from kmdata where SzeAZ=', szeazok[i], ' order by datum, sep=)) now I have the data in the adat variable which is a list. In fact the elements of the

[R] SOLVED, Re: lists everywhere

2011-12-05 Thread Kehl Dániel
nevermind, typo (and some gray hair) sorry 12/5/2011 8:21 PM keltezéssel, Kehl Dániel írta: Dear list members, I have a really simple problem. I connected to a DB and have the following query adat - dbGetQuery(con, paste(select * from kmdata where SzeAZ=', szeazok[i], ' order by datum, sep

Re: [R] [SOLVED]looking for beta parameters

2011-11-29 Thread Kehl Dániel
I managed to solve the problem myself without using this code. thx 2011-11-24 12:26 keltezéssel, Kehl Dániel írta: Dear Community, I am trying to write code for the following problem. Lets assume we have a beta distribution. I know one quantile, lets say, 10% of the mass lies above .8

Re: [R] Why it is happeing?

2011-11-26 Thread Kehl Dániel
Note that current implementations of*R*use 32-bit integers for integer vectors, so the range of representable integers is restricted to about/+/-2*10^9/:|double http://stat.ethz.ch/R-manual/R-patched/library/base/html/double.html|s can hold much larger integers exactly. hth d 2011-11-26

[R] looking for beta parameters

2011-11-24 Thread Kehl Dániel
Dear Community, I am trying to write (update) a code for the following problem. Lets assume we have a beta distribution. I know one quantile, lets say, 10% of the mass lies above .8, that is between .8 and 1. In addition, I know that the average of this truncated tail is a given number, lets

[R] sorry, [WinBUGS] question

2011-09-05 Thread Kehl Dániel
Dear Community, I know this is not the place to ask WinBUGS questions, but I did not get any answers on other lists. I am rather new to the BUGS language and to bayesian modeling, excuse me for probably simple questions. I have to conduct a bayesian meta-analysis of some data. We have

[R] conditions simpler way

2011-06-05 Thread Kehl Dániel
Dear All, I have a MCMC result in x1. I was wondering if there is a simpler, more elegant way of evaluating the estimate of an integral then this (I am pretty sure there is): Also if I want to count the x's say -1x2 but not the ones in the burn in period. [code] z - -2 burnin - 2000 int1 -

[R] Simple MC integration question

2011-05-17 Thread Kehl Dániel
Dear Community, I try to compute the variance of a MC integral where I know the analytical solution. The function is exp(-x) integrated on the interval (2,4). (Rizzo example) The true value is exp(-2)-exp(-4)~.1170196 I have the following short code: code iter - 1 MCs - numeric(iter) n -

Re: [R] Generalized Linear Model

2011-04-25 Thread Kehl Dániel
Hi! Try to read about the glm function, type: ?glm in your R editor. It looks like you have contingency tables, maybe a loglin model would be good to start with. D 2011-04-25 12:28 keltezéssel, Megan írta: Hello, I am trying to run a generalized linear model but do not know where to

[R] all combinations with replacement

2011-04-21 Thread Kehl Dániel
Dear all, is there an easy way to get all possible combinations (?) with replacement. If n=6, k=3, i want something like 0 0 6 0 5 1 0 4 2 0 3 3 0 2 4 . . . 5 0 1 5 1 0 6 0 0 I tried to look at combn() but I could not get this done with it. Thank you in advance: Daniel

Re: [R] all combinations with replacement

2011-04-21 Thread Kehl Dániel
Thank you. I only need those where the rowsum = n. I could choose those with code, but I dont think it is efficient that way. daniel 2011-04-21 12:33 keltezéssel, Dimitris Rizopoulos írta: expand.grid(rep(list(0:6), 3)) __ R-help@r-project.org

Re: [R] What does the - operator mean?

2011-04-21 Thread Kehl Dániel
maybe help (-) helps daniel 2011-04-21 12:14 keltezéssel, Cliff Clive írta: I should probably point out that in the example, ecov_xy and decay are scalars, and x and y are vectors. -- View this message in context:

Re: [R] Merge matrix

2011-04-12 Thread Kehl Dániel
?cbind should solve your problem 2011-04-12 07:54 keltezéssel, pankaj borah írta: I have two matrices A and B dim (A) [1] 30380 104 dim(Bt) [1] 3038063 I want to combine both A and B to matrix C where dim(C) [1] 30380 167 How do I do that ? Regards, Pankaj Barah

Re: [R] Dirichlet surface

2011-03-30 Thread Kehl Dániel
Winsemius írta: On Mar 29, 2011, at 4:45 PM, Kehl Dániel wrote: Dear list members, I want to draw surfaces of Dirichlet distributions with different parameter settings. My code is the following: #begin code a1 - a2 - a3 - 2 #a2 - .5 #a3 - .5 x1 - x2 - seq(0.01, .99, by=.01) f - function(x1

Re: [R] Dirichlet surface

2011-03-30 Thread Kehl Dániel
It helped a lot indeed, thank you very much! Now I understand why it was a problem for persp! Daniel 2011-03-30 10:31 keltezéssel, Gavin Simpson írta: On Wed, 2011-03-30 at 09:55 -0700, Kehl Dániel wrote: Dear David, I think that is a small bug too, maybe because the function is constant

Re: [R] Dirichlet surface

2011-03-30 Thread Kehl Dániel
Actually, it works for the a=1 case, not for the others. It still gives the invalid 'zlim argument' error. I'll try to work it out maybe instead of NULL giving a c which is dependent on the max(z). Daniel 2011-03-30 10:42 keltezéssel, Kehl Dániel írta: It helped a lot indeed, thank you very

[R] Dirichlet surface

2011-03-29 Thread Kehl Dániel
Dear list members, I want to draw surfaces of Dirichlet distributions with different parameter settings. My code is the following: #begin code a1 - a2 - a3 - 2 #a2 - .5 #a3 - .5 x1 - x2 - seq(0.01, .99, by=.01) f - function(x1, x2){ term1 -