Re: [R] How to connect .mdb file

2012-07-11 Thread Mikhail Titov
imnew jubil...@live.com.sg writes: Hi, I'm currently having some problem connect .mdb file into R. I've installed the RODBC packages and I do the code this way: channel - odbcConnectAccess(C:/Users/Documents/XYZ) I have a total of 5 tables in the .mdb database. any one can help me with

Re: [R] problem for installing rgdal

2012-07-11 Thread Prof Brian Ripley
On 10/07/2012 17:35, stanislas rebaudet wrote: Hello, I run [R] 2.14 on Mac OS 10.6 and I've been desperately trying to install rpy2 in order to compute spatial statistics on QGIS 1.7.3. rpy2 is dependent upon the rgdal [R]package that I've been unable to install in spite of up to date

Re: [R] fill 0-row data.frame with 1 line of NAs

2012-07-11 Thread Liviu Andronic
On Tue, Jul 10, 2012 at 4:53 PM, Peter Ehlers ehl...@ucalgary.ca wrote: Both this and Liviu's original solution destroy the factor nature of 'Species' (which may not matter, of course). How about (.xb - iris[ iris$Species=='zz', ]) .xb - .xb[1, ] # this probably shouldn't work, but it

Re: [R] -1.1 - 0.1 + 1.2 is NOT null! Why?

2012-07-11 Thread Richard M. Heiberger
This is a fascinating example. It is an accident that it looks like it comes out even. Here are both sets displayed using hex format where we see exactly what bits are used in the internal representation of the numbers. dphex - function(x) {sprintf(%+.13a, x)} ones - c(-1.1, +

[R] Package MuMIn (dredge): Error in ret[, ] - cbind(x, se, rep(if (is.null(df)) NA_real_ else df, : number of items to replace is not a multiple of replacement length.

2012-07-11 Thread Jeremy Little
Hello R community, I am attempting to run multiple logistic regressions (multinomial, via package 'nnet'), with Automated Model Selection (dredge, package 'MuMIn'). The aim is to reduce the number of predictor variables by assessing relative performance of each variable, which can be done in a

Re: [R] Package 'MASS' (polr): Error in svd(X) : infinite or missing values in 'x'

2012-07-11 Thread Jeremy Little
Dear Jessica thank you for the scale solution to my problem. I tried to manually scale my data (scaling up and removing decimals), however, this resulted in the same error message. It remains vague to me what the precise meaning of... the model matrix should be sensibly scaled with all columns

[R] browser() question

2012-07-11 Thread darnold
All, How come i=1 in the first case, but i=2 in the second case. The second case seems to work, but the first case does not. David. findruns - function(x,k) { + n - length(x) + runs - NULL + for (i in 1:(n-k+1)) { + if (all(x[i:(i+k-1)]==1)) runs - c(runs,i) + browser(i1) + } +

[R] how to create the data frame

2012-07-11 Thread ????????
there is a data frame £¬x weekly.returns 2010-1-4-0.015933327 2010-1-11-0.015042868 2010-1-180.005350297 2010-1-25-0.049324703 2010-2-1-0.052674121 when i input colnames(data)[1] - 'date' it becomes date 2010-1-4

Re: [R] how to create the data frame

2012-07-11 Thread Ivan Calandra
Hi, Let's say you original data.frame is called df1, you can do: df2 - data.frame(date=row.names(df1), weekly.returns=df1[[1]]) Next time, think about giving us you sample data through the dput() function. It makes it way easier. HTH, Ivan -- Ivan CALANDRA Université de Bourgogne UMR

Re: [R] Package 'MASS' (polr): Error in svd(X) : infinite or missing values in 'x'

2012-07-11 Thread Jessica Streicher
I'm not sure either, the wordings starnge and english isn't my primary language I would GUESS, that it means that all columns values should be between 0,1 or 1,2 or -0.5,0.5 or something like that. The scale function scales the columns to be comparable between each other, by dividing each

Re: [R] Understanding cenros Error

2012-07-11 Thread Jim Lemon
On 07/11/2012 05:54 AM, Rich Shepard wrote: Before reading water chemistry into a data frame I removed all missing data. Yet when I try to run cenros() to summarize a specific chemical I get an error that I do not understand: with( subset(chem, param=='Ag'), cenros(quant,ceneq1) ) Error in

Re: [R] browser() question

2012-07-11 Thread Sarah Goslee
Hi, On Wednesday, July 11, 2012, darnold wrote: All, How come i=1 in the first case, but i=2 in the second case. The second case seems to work, but the first case does not. It dos work: whne your code gets to browser() R calls that function and passes it the argument given. If you expect

Re: [R] Extracting arithmetic mean for specific values from multiple .txt-files

2012-07-11 Thread Rui Barradas
Hello, Try make.row - function(x, skip = 14, column){ dat - read.table(x, skip = skip - 1, header = TRUE, stringsAsFactors = FALSE) vpNum - dat$vpNum[1] trial - length(dat[[ column ]]) correct - sum(dat$correct == 1) result - c(vpNum, trial, correct, correct/trial)

Re: [R] Skipping lines and incomplete rows

2012-07-11 Thread Uwe Ligges
You actually jsut need to say what the comment char and what the na.strings are: read.table(filename, sep=;, skip=3, header=TRUE, na.string=#N/A, comment.char=) Uwe Ligges On 10.07.2012 19:30, arun wrote: Hello Ravi, I was not aware that your dataset have special character # before NA.

[R] The R Journal, Vol. 4 Issue 1

2012-07-11 Thread Martyn Plummer
Dear All, The first issue of the fourth volume of The R Journal is now available at http://journal.r-project.org/current.html Thanks to everyone involved. Martyn Plummer Editor-in-Chief --- This message and its attachments

Re: [R] identify.hclust() doesn't cut tree at the vertical position of the mouse pointer

2012-07-11 Thread Uwe Ligges
On 10.07.2012 10:48, WATSON Mick wrote: Dear All According to the identify.hclust documentation the function cuts the tree at the vertical position of the pointer and highlights the cluster containing the horizontal position of the pointer. When I carry out this, the tree isn't cut where I

Re: [R] How to add marker in Stacked bar plot?

2012-07-11 Thread Uwe Ligges
On 10.07.2012 05:37, Manish Gupta wrote: Hi, I am working on stacked bar plot and want to add marker(arrow) in stacked bar plot. DF=data.frame(names=c(tomato, potato, cabbage, sukuma-wiki, terere), freq=c(7,4,5,8,20)) barplot(as.matrix(DF[,2]), col=heat.colors(length(DF[,2])), legend=DF[,1],

Re: [R] Why 95% quantile empty in R or why 95% quantile = 1 with data values between 0 and 1?

2012-07-11 Thread Uwe Ligges
On 10.07.2012 02:55, Angelr wrote: I am calling quantiles as follows. I don't understand why sometimes the columns (data values) above 95% are returned as NULL!! When I drop the percentile down to 92%, I see colums appearing. Why would any quantile be empty? I see sometimes that 95% percentile

Re: [R] browser() question

2012-07-11 Thread Michael Weylandt
Incidentally, the OP might want to take a look at ?rle. Michael On Jul 11, 2012, at 3:42 AM, Sarah Goslee sarah.gos...@gmail.com wrote: Hi, On Wednesday, July 11, 2012, darnold wrote: All, How come i=1 in the first case, but i=2 in the second case. The second case seems to work, but

Re: [R] define stuff to be only usable in the same file

2012-07-11 Thread Jessica Streicher
Packaging ist still too complicated for my level i guess, can't get it to work properly, and it seems a lot of work. However apparently putting a . in front of functions will hide them, saw that in another script, don't know what its about, but it works, so who cares.. On 10.07.2012, at 17:02,

Re: [R] fill 0-row data.frame with 1 line of NAs

2012-07-11 Thread David Winsemius
On Jul 10, 2012, at 2:05 PM, Rui Barradas wrote: Hello, Em 10-07-2012 18:59, Peter Ehlers escreveu: On 2012-07-10 08:50, Brian Diggs wrote: On 7/10/2012 7:53 AM, Peter Ehlers wrote: On 2012-07-10 06:57, Rui Barradas wrote: Hello, If you write a function, it becomes less convoluted...

Re: [R] define stuff to be only usable in the same file

2012-07-11 Thread Barry Rowlingson
On Tue, Jul 10, 2012 at 4:02 PM, Jessica Streicher j.streic...@micromata.de wrote: Forget about that, i'm stupid and can't use the tools available... Here's something I wrote specially for all you wonderful stupid people out there... https://gist.github.com/3025606 What it tries to do is

Re: [R] fill 0-row data.frame with 1 line of NAs

2012-07-11 Thread Gabor Grothendieck
On Tue, Jul 10, 2012 at 9:15 AM, Liviu Andronic landronim...@gmail.com wrote: Dear all Is there a simpler method to achieve the following: When I obtain an empty data.frame after subsetting, I need for it to contain one line of NAs. Here's a dummy example: (.xb - iris[ iris$Species=='zz', ])

[R] I need to get function name from R file

2012-07-11 Thread purushothaman
Hi, i need to get functions name from R file example test.R file having 2 functions like add-function() { a+b } sub-function() { a-b } how to get function name from test.R file i need output is functions are add,sub. Thanks B.Purushothaman -- View this message in context:

Re: [R] Understanding cenros Error

2012-07-11 Thread Rich Shepard
On Wed, 11 Jul 2012, Jim Lemon wrote: I don't have the NADA package, but I suspect that the cenros function is doing something like dividing by zero. With that much data, it may be hard to pinpoint where this is occurring. I would cut my data in half, run it, cut the remainder in half, run it

Re: [R] Extracting arithmetic mean for specific values from multiple .txt-files

2012-07-11 Thread vimmster
Dear Rui, thank you VERY much. You helped me a lot! I've just added the following: rsort - ratios[order(ratios$vpNum),] Now the test subjects are arranged according to their vpNum. Thanks a lot again! -- View this message in context:

Re: [R] define stuff to be only usable in the same file

2012-07-11 Thread Jessica Streicher
Thanks Barry, that helped a lot, modified it a bit and it does pretty much what i wanted. On 11.07.2012, at 15:08, Barry Rowlingson wrote: On Tue, Jul 10, 2012 at 4:02 PM, Jessica Streicher j.streic...@micromata.de wrote: Forget about that, i'm stupid and can't use the tools available...

Re: [R] I need to get function name from R file

2012-07-11 Thread Eik Vettorazzi
Hi, how about this: sandbox-new.env() sys.source(test.R,envir=sandbox) #all objects defined in test.r (tstf-ls(env=sandbox)) #just the functions tstf[sapply(tstf, function(n) exists(n, envir = sandbox, mode = function, inherits = FALSE))] hth Eik Am 11.07.2012 15:22, schrieb purushothaman:

[R] nls problem: singular gradient

2012-07-11 Thread Jonas Stein
Why fails nls with singular gradient here? I post a minimal example on the bottom and would be very happy if someone could help me. Kind regards, ### # define some constants smallc - 0.0001 t - seq(0,1,0.001) t0 - 0.5 tau1 - 0.02 # generate yy(t) yy - 1/2 * ( 1- tanh((t - t0)/smallc)

Re: [R] nls problem: singular gradient

2012-07-11 Thread Duncan Murdoch
On 11/07/2012 11:04 AM, Jonas Stein wrote: Why fails nls with singular gradient here? I post a minimal example on the bottom and would be very happy if someone could help me. Take a look at the predicted values at your starting fit: there's a discontinuity at 0.4, which sure makes it look as

[R] Using data stored in a file for a heatmap

2012-07-11 Thread Richard Müller
Hi all, I just try to get familiar with levelplot() for generating heatmaps. I have x, y, z-data stored in a file: e.g.: file.csv: 0 0 0.1 0 1 0.5 0 2 0.4 1 0 0.3 1 1 0.4 1 2 0.6 ... I can use scan() for generating the matrix for R: inp - scan(file.csv, list(0, 0, 0)) How can I feed inp into

Re: [R] Using data stored in a file for a heatmap

2012-07-11 Thread R. Michael Weylandt
I might suggest you use read.csv() instead of scan if your data really is a csv (what you provided isn't). Once you have it in R, I'd recommend you use a formula interface to levelplot(). Taking an example from the help page [which you can access by typing ?levelplot and run the examples by

Re: [R] Getting objects from quantmod ticker list

2012-07-11 Thread Cren
# One more question, Joshua: let instead of merging tickers # I would like to put prices from an OHLC object # in weekly format, then selecting just the close prices. # What would be a code to do it? # I guess: data = new.env() ticker.list - c('SPY', 'TLT', 'GLD') getSymbols(ticker.list, env =

Re: [R] Import ASCII data using a .sas program

2012-07-11 Thread ajdamico
Hi Don, Sorry that this may be too late for what you were working on, but wanted to reply just in case you have to tackle this in the future.. :) library(SAScii) x - read.SAScii( d:/fh4.txt , d:/sas input script.sas ) Anthony -- View this message in context:

Re: [R] For loop help

2012-07-11 Thread Yasir
Read your data using read.table with as.is=TRUE then you could reformat the date column to make R understand that it is a date, depending on your raw date format. Thanks. -- View this message in context: http://r.789695.n4.nabble.com/For-loop-help-tp4636155p4636157.html Sent from the R help

Re: [R] how to create the data frame

2012-07-11 Thread arun
Hi, Try this: dat1-read.table(text=     weekly.returns 2010-1-4    -0.015933327 2010-1-11    -0.015042868 2010-1-18    0.005350297 2010-1-25    -0.049324703 2010-2-1    -0.052674121 ,sep=,header=TRUE) dat2-data.frame(date=row.names(dat1),weekly.returns=dat1[1])

Re: [R] fitting power growth

2012-07-11 Thread Yasir
read the part on power fitting: http://www.itc.nl/~rossiter/teach/R/R_CurveFit.pdf -- View this message in context: http://r.789695.n4.nabble.com/fitting-power-growth-tp4635999p4636158.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Skipping lines and incomplete rows

2012-07-11 Thread vioravis
Thanks a lot for the guidance. I have another text file with a time stamp and an empty column as given below: First line: Skip this line Second line: skip this line Third line: skip this line variable1

Re: [R] info about R arulesSequences

2012-07-11 Thread Yasir
Your error comes from the source file makebin it's because your sequence identifiers are not in ascending order: // check if the sequence and event/time // identifiers are in ascending order and // determine the number of sequences. ns = l = h = 0; for (i = 0; i LENGTH(sx);

Re: [R] Questions about doing analysis based on time

2012-07-11 Thread APOCooter
Hmm, I guess that's not exactly what I needed. It's my fault; you gave me what I asked for, I was just asking for the wrong thing. What I'm hoping to do is something similar to: aggregate(dat$SunScore, by=list(h), median) except I'd like to do it by half hour instead of hour. I guess what I

Re: [R] fill 0-row data.frame with 1 line of NAs

2012-07-11 Thread arun
Hi, Try this: .xa-iris[1,][rep(NA,length(iris),1),] .xa #   Sepal.Length Sepal.Width Petal.Length Petal.Width Species #NA   NA  NA   NA  NA    NA #or .xb-iris[1,][rep(NA,ncol(iris),1),]  .xb #   Sepal.Length Sepal.Width Petal.Length Petal.Width Species #NA

[R] MODE , VARIANCE , NTH PERCENTAILE

2012-07-11 Thread Rantony
Hi, Here i have an matrix like this, ABCPQRXYZ MNO -- --- -- 367 15 2 122415 20 5 1 2 25 50 15 35 i need to get the

Re: [R] replacing NaN for every attribute in my data

2012-07-11 Thread Yasir
You can try this: for (i in 1:length(ds)) { dummy-ds[[i]]; dummy[is.nan(dummy)]-0 ds[[i]]-dummy } if is.nan doesn't work, replace with is.na - Yasir Kaheil -- View this message in context: http://r.789695.n4.nabble.com/replacing-NaN-for-every-attribute-in-my-data-tp4636160p4636163.html

Re: [R] MODE , VARIANCE , NTH PERCENTAILE

2012-07-11 Thread Rantony
Thank you chamilka. From: chamilka [via R] [mailto:ml-node+s789695n4636142...@n4.nabble.com] Sent: Wednesday, July 11, 2012 8:13 PM To: Akkara, Antony (GE Energy, Non-GE) Subject: Re: MODE , VARIANCE , NTH PERCENTAILE Din't you try sapply function? I tried it for you. Just convert your

[R] Subset based on multiple values

2012-07-11 Thread Amanduh320
I'm stuck on a seemingly simple problem. I'm trying to subset the data by several numbers and it cuts out half of the rows. Here is the sample code: test - as.matrix(c(1,1,1,1,3,3,7,7,7,7)) Count - tapply(test[,1], test[,1], length) # count for each value spp - unique(test[,1]) Count1 -

Re: [R] Subset based on multiple values

2012-07-11 Thread Yasir
I see that this is your input: c(1,1,1,1,3,3,7,7,7,7) what do you want the output to be? what could the multiple values of AllMax be? - Yasir Kaheil -- View this message in context: http://r.789695.n4.nabble.com/Subset-based-on-multiple-values-tp4636159p4636167.html Sent from the R help

Re: [R] Understanding cenros Error

2012-07-11 Thread MacQueen, Don
An my easy but not very useful answer is that this particular subset probably violates some assumption of the cenros() model. I myself would start with simple inspections of the data, such as with( subset(chem, param=='Ag'), table(ceneq1) ) with( subset(chem, param=='Ag'), qqnorm(quant) )

[R] RGL axis labels parallel to axes

2012-07-11 Thread PatGauthier
Hello useRs, I'm having trouble trying to produce axis labels running parallel to the axes in 3d space. Is their a way to do this when producing 3d graphs using the rgl package? Thanks for your help, Patrick -- View this message in context:

Re: [R] fill 0-row data.frame with 1 line of NAs

2012-07-11 Thread William Dunlap
Why does one want to replace a zero-row data.frame with a one-row data.frame of NA's? Unless this is for an external program that cannot handle zero-row inputs, this suggests that there is an unnecessary limitation (i.e., a bug) in the R code that uses this data.frame. Bill Dunlap Spotfire,

Re: [R] Getting objects from quantmod ticker list

2012-07-11 Thread R. Michael Weylandt
On Wed, Jul 11, 2012 at 1:49 PM, Cren oscar.soppe...@bancaakros.it wrote: # One more question, Joshua: let instead of merging tickers # I would like to put prices from an OHLC object # in weekly format, then selecting just the close prices. # What would be a code to do it? # I guess: data =

Re: [R] Getting objects from quantmod ticker list

2012-07-11 Thread R. Michael Weylandt
On Wed, Jul 11, 2012 at 3:08 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: On Wed, Jul 11, 2012 at 3:07 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: On Wed, Jul 11, 2012 at 1:49 PM, Cren oscar.soppe...@bancaakros.it wrote: # One more question, Joshua: let instead of

Re: [R] Subset based on multiple values

2012-07-11 Thread andrija djurovic
Hi. Maybe this: ct - table(test) as.numeric(names(ct[ct==max(ct)])) test[test[,1]%in%as.numeric(names(ct[ct==max(ct)])),,drop=FALSE] ? Andrija On Wed, Jul 11, 2012 at 8:33 PM, Amanduh320 aadam...@uwo.ca wrote: I'm stuck on a seemingly simple problem. I'm trying to subset the data by several

Re: [R] Understanding cenros Error

2012-07-11 Thread Rich Shepard
On Wed, 11 Jul 2012, MacQueen, Don wrote: An my easy but not very useful answer is that this particular subset probably violates some assumption of the cenros() model. I myself would start with simple inspections of the data, such as with( subset(chem, param=='Ag'), table(ceneq1) ) with(

[R] declaring negative log likelihood of a distribution

2012-07-11 Thread chamilka
Hi everyone! I already posted http://r.789695.n4.nabble.com/Declaring-a-density-function-with-for-loop-td4635699.html a question on finding density values of a new Binomial like distribution which has the following pmf: http://r.789695.n4.nabble.com/file/n4636134/kb.png Thank fully

Re: [R] Help with vectors and rollapply

2012-07-11 Thread Raghuraman Ramachandran
Hi Bill Many thanks for your help. Cheers R -Original Message- From: William Dunlap [mailto:wdun...@tibco.com] Sent: 10 July 2012 17:22 To: Raghuraman Ramachandran; r-help@r-project.org Subject: RE: Help with vectors and rollapply It looks like you already have the zoo package loaded

Re: [R] how to create the data frame

2012-07-11 Thread sureshraj
Hi Dude!! It seems that your column names are not sequentially arranged, I guess, If so u just reorder them and do it your way...it will work.. for example, colnames(data)[2]–weekly.returns ## sometimes u can use like this as well, if u want to assign at last most column

[R] Poisson ridge regression

2012-07-11 Thread umesh khatri
-- Forwarded message -- From: umesh khatri khatriumes...@gmail.com Date: Wed, 11 Jul 2012 16:15:11 +0530 Subject: Poisson ridge regression To: r-h...@rproject.org I'm student of Masters in Statistics (Actuarial) from Central University of Rajasthan, India. I am doing a major

Re: [R] HELP me please with import of csv to R

2012-07-11 Thread F86
Thank you! It is fixed now. However, now when I'm trying with hist(skatter) i get this message: Error in hist.default(skatter) : 'x' must be numeric I don't know what I'm doing wrong but it worked perfectly on windows some weeks ago. My data skater looks like this: skatter

[R] Substitute list value

2012-07-11 Thread Charles Stangor
I can't seem to determine how to get the name of a list member to substitute: ll - list(a1 = a,a2 = b) t1[t==ll[0], v] - 99 why doesn't this substitute to: t1[t==a, v] - 99 Thank you! -- Charles Stangor Professor [[alternative HTML version deleted]]

Re: [R] HELP me please with import of csv to R

2012-07-11 Thread F86
Thank you! It is fixed now. However, now when I'm trying with hist(skatter) i get this message: Error in hist.default(skatter) : 'x' must be numeric I don't know what I'm doing wrong but it worked perfectly on windows some weeks ago. My data skatter looks like this: skatter

[R] Modifying the design matrix X in GAMS to suit data assimilation

2012-07-11 Thread Ateljevich, Eli
I have a data assimilation problem that might be amenable to the use of GAMS, but I am not sure how feasible it is to implement. I was told the R mailing list was a great resource. My observations are spatiotemporal salinity in the San Francisco Bay at a number of instruments over a few days.

[R] Chunking in RCurl using getBinaryURL()

2012-07-11 Thread els
Hello everyone, I'm relatively new to the RCurl package, and I'm having some issues with reading in my data the way I want to. I have binary data that I've only been able to read in correctly using getBinaryURL(), but I also want to read the data in chunks (it's a huge timeseries dataset).

[R] read.xls question

2012-07-11 Thread Tsay, Edwin
Hello, I've been using: tmp.df = read.xls(filename, stringsAsFactors = FALSE) to read in my files. Even though I get the There were 50 or more warnings thing, for the most part most of the data is read in correctly. However, there are a few select rows where there are values but they are

[R] For loop help

2012-07-11 Thread cs389
Hi Everyone, I could use help developing a for loop. I have a dataset with tallies for a number of species within 7 different size classes. I need to uncollate the data into the rawest form (ie: each row a different individual) retrain the metadata associated with each row (Date, Recorder,

[R] Substitute list value

2012-07-11 Thread Charles Stangor
I can't seem to determine how to get the name of a list member to substitute: ll - list(a1 = a,a2 = b) t1[t==ll[0], v] - 99 why doesn't this substitute to: t1[t==a, v] - 99 Thank you! [[alternative HTML version deleted]] __

[R] replacing NaN for every attribute in my data

2012-07-11 Thread mishkind
Hi, I have a list called ds which has the following attributes: attributes(ds) $names [1] adj.r.squared fstatisticintercept slope [5] std.error tstatistic I want to replace all the NaN is ds with 0, and after searching past posts I found I can hardcode it like this:

[R] Help with loop

2012-07-11 Thread paulalou
Hi, I have two dataframes: The first, df1, contains some missing data: cola colb colc cold cole 1NA59 NA 17 2NA6 NA 14 NA 3 3NA 11 15 19 4 48 12 NA 20 The second, df2, contains the following: cola colb colc cold cole 1 1.4 0.8

[R] Help needed to tackle multicollinearity problem in count data with the help of R

2012-07-11 Thread umesh khatri
Dear everyone, I'm student of Masters in Statistics (Actuarial) from Central University of Rajasthan, India. I am doing a major project work as a part of the degree. My major project deals with fitting a glm model for the data of car insurance. I'm facing the problem of multicollinearity for this

Re: [R] Subset based on multiple values

2012-07-11 Thread Amanduh320
I want the output to be 1,1,1,1,7,7,7,7 The multiple values of AllMax are 1 and 7. I think I've figured it out though, I added a loop at the end: test - as.matrix(c(1,1,1,1,3,3,7,7,7,7)) Count - tapply(test[,1], test[,1], length) # count for each value spp - unique(test[,1]) Count1 -

Re: [R] Mixed Models providing a correlation structure.

2012-07-11 Thread Marcio
Dear Simon, Thanks for the quick reply. Unfortunately I don't have access to Pinheiro and Bates. I tried googling the pdSymm and lme but I still cannot get the syntax right. In my model, I only have 1 random factor with repetitions (groups) (e.g. 2 records per each level) I am pasting bellow a

Re: [R] Subset based on multiple values

2012-07-11 Thread Yasir Kaheil
yes just use %in% instead of == AllMax.. but also use table for count - Yasir Kaheil -- View this message in context: http://r.789695.n4.nabble.com/Subset-based-on-multiple-values-tp4636159p4636183.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] replacing NaN for every attribute in my data

2012-07-11 Thread mishkind
Thanks. That worked. -- View this message in context: http://r.789695.n4.nabble.com/replacing-NaN-for-every-attribute-in-my-data-tp4636160p4636185.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

[R] Computing inverse cdf (quantile function) from a KDE

2012-07-11 Thread firdaus.janoos
Hello, I wanted to know if there is a simple way of getting the inverse cdf for a KDE estimate of a density (using the ks or KernSmooth packages) in R ? The method I'm using now is to perform a numerical integration of the pdf to get the cdf and then doing a search for the desired probablity

[R] igraph function graph.bfs unavailable

2012-07-11 Thread David Marx
Hi, I've installed the igraph package and have been otherwise using it successfully, but when I try to use graph.bfs I get the error: could not find function graph.bfs Moreover, I don't seem to have the documentation installed either. (per ?graph.bfs and ??graph.bfs). I'm using RStudio

Re: [R] HELP me please with import of csv to R

2012-07-11 Thread William Dunlap
Did you use read.table(filename, ..., dec=,) when importing the data (so 30,3 is read as the number 30 and 3 tenths instead of as the character string 30,3)? Whenever importing data follow up by using str() or summary() on its output, before doing any further analysis. E.g., bad -

Re: [R] MODE , VARIANCE , NTH PERCENTAILE

2012-07-11 Thread chamilka
Din't you try sapply function? I tried it for you. Just convert your matrix into a data frame using as.data.frame and then * rantony* ABC PQR XYZ MNO [1,] 3 6 7 15 [2,] 2 12 24 15 [3,] 20 5 1 2 [4,] 25 50 15 35 * rantony=as.data.frame(rantony)* *

[R] do I need plyr, apply or something else?

2012-07-11 Thread Russell Bowdrey
Dear all, This is what I'd like to do (I have an implementation using for loops, which I designed before I realised just how slow R is at executing them - this process currently takes days to run). I have a large dataframe containing corporate bond data, columns are: BondID Date (goes back

[R] Passing Multiple Variable Into SQLDF Statement as parameters of function

2012-07-11 Thread scstrein
Hey guys, So I'm working with a project where I manage a database within R, and I'm developing a script/function that will automatically run my queries in R depending on the date parameters passed in. The problem is that when I create variables for the dates, and use those variables in my sqldf

Re: [R] replacement has length zero

2012-07-11 Thread fabiano
Thanks Peter. We did manage to solve the problem using the approach bellow. Hab - cbind(seq(1,21),habitat) hab - matrix(NA,nrow=3,ncol=7) for (i in 1:3) {hab[i,] - Hab[habitat==i,1]} The problem was that the hab matrix was not a multiple of habitat. -- View this message in context:

[R] Substitute list value

2012-07-11 Thread Charles Stangor
I can't seem to determine how to get the name of a list member to substitute as a variable name: ll - list(a1 = a,a2 = b) t1[t==ll[1], v] - 99 why doesn't this substitute to: t1[t==a, v] - 99 Thank you! -- Charles Stangor Professor -- Charles Stangor Professor [[alternative

Re: [R] Questions about doing analysis based on time

2012-07-11 Thread Rui Barradas
Hello, If I understanding it, what you want are the values below. half.hours - function(x){ s - strsplit(as.character(x), :) H - as.integer(sapply(s, `[`, 1)) M - as.integer(sapply(s, `[`, 2)) h - (H*60 + M)/60 floor(h/0.5)*0.5 } half.hours(dat$SunTime)

Re: [R] info about R arulesSequences

2012-07-11 Thread Jennifer Maldonado
thanks! 2012/7/11 Yasir kah...@gmail.com Your error comes from the source file makebin it's because your sequence identifiers are not in ascending order: // check if the sequence and event/time // identifiers are in ascending order and // determine the number of sequences. ns

Re: [R] fill 0-row data.frame with 1 line of NAs

2012-07-11 Thread Liviu Andronic
On Wed, Jul 11, 2012 at 9:56 PM, William Dunlap wdun...@tibco.com wrote: Why does one want to replace a zero-row data.frame with a one-row data.frame of NA's? Unless this is for an external program that cannot handle zero-row inputs, this suggests that there is an unnecessary limitation

Re: [R] c(a, b) for POSIXct objects with tzone attributes?

2012-07-11 Thread Spencer Graves
Hi, Prof. Ripley, Bert: Thanks for the comments. Might there be a function similar to c but retains more attributes than just names? Before I write such, I felt a need to ask if anyone knows where it may already have been done -- and if people have suggestions for how

Re: [R] For loop help

2012-07-11 Thread Rui Barradas
Hello, Please don't post datasets like this, it's unusable by us. Use dput(). ?dput dput(head(myData, 20)) # post the output of this. Paste the output of that command in a post. It starts with 'structure'. Don't worry if it looks awkward, it is, on the contrary, very usefull. All we need

Re: [R] Substitute list value

2012-07-11 Thread R. Michael Weylandt michael.weyla...@gmail.com
It should. Reproducible example of it not? Michael On Jul 11, 2012, at 3:06 PM, Charles Stangor cstan...@gmail.com wrote: I can't seem to determine how to get the name of a list member to substitute as a variable name: ll - list(a1 = a,a2 = b) t1[t==ll[1], v] - 99 why doesn't this

Re: [R] Help with loop

2012-07-11 Thread Rui Barradas
Hello, A one-liner could be df1 - read.table(text= cola colb colc cold cole 1NA59 NA 17 2NA6 NA 14 NA 3 3NA 11 15 19 4 48 12 NA 20 , header=TRUE) df2 - read.table(text= cola colb colc cold cole 1 1.4 0.8 0.02 1.6 0.6 , header=TRUE)

Re: [R] Passing Multiple Variable Into SQLDF Statement as parameters of function

2012-07-11 Thread Gabor Grothendieck
On Wed, Jul 11, 2012 at 11:16 AM, scstrein scstr...@ncsu.edu wrote: Hey guys, So I'm working with a project where I manage a database within R, and I'm developing a script/function that will automatically run my queries in R depending on the date parameters passed in. The problem is that

Re: [R] do I need plyr, apply or something else?

2012-07-11 Thread R. Michael Weylandt
On Wed, Jul 11, 2012 at 10:05 AM, Russell Bowdrey russell.bowd...@justretirement.com wrote: Dear all, This is what I'd like to do (I have an implementation using for loops, which I designed before I realised just how slow R is at executing them - this process currently takes days to run).

[R] Variance Inflation factor

2012-07-11 Thread Hui Du
Hi All, I need to calculate VIF (variance inflation factor) for my linear regression model. I found there was a function named vif in 'HH' package. I have two questions: 1) I was able to install that package in my R under windows. But while trying to install that package in UNIX, I

Re: [R] Skipping lines and incomplete rows

2012-07-11 Thread Rui Barradas
Hello, That seems easy. dat$variable1 - with(dat, paste(variable1, variable2)) dat$variable2 - dat$variable3 dat$variable3 - Then convert variable1 to date/time using as.POSIXct or strptime See ?strptime. Hope this helps, Rui Barradas Em 11-07-2012 13:30, vioravis escreveu: Thanks a lot

Re: [R] Variance Inflation factor

2012-07-11 Thread Jorge I Velez
See the examples at # install.pacages('car') require(car) ?vif HTH, Jorge.- On Wed, Jul 11, 2012 at 6:10 PM, Hui Du wrote: Hi All, I need to calculate VIF (variance inflation factor) for my linear regression model. I found there was a function named vif in 'HH' package. I have two

Re: [R] Variance Inflation factor

2012-07-11 Thread Hui Du
Thanks. But in UNIX side, I got the same error In getDependencies(pkgs, dependencies, available, lib) : package ‘car’ is not available HXD From: Jorge I Velez [mailto:jorgeivanve...@gmail.com] Sent: Wednesday, July 11, 2012 3:19 PM To: Hui Du Cc: R-help Subject: Re: [R] Variance

[R] help with merging 2 data frames

2012-07-11 Thread Dimitri Liakhovitski
Dear R-ers, I feel I am close, but can't get it quite right. Thanks a lot for your help! Dimitri # I have 2 data frames: x-data.frame(a=c(aa,aa,ab,ab,ba,ba,bb,bb),b=c(1:2,1:2,1:2,1:2),d=c(10,20,30,40,50,60,70,80))

Re: [R] Variance Inflation factor

2012-07-11 Thread Jorge I Velez
Could you please include your sessionInfo() ? Thank you, Jorge.- On Wed, Jul 11, 2012 at 6:27 PM, Hui Du hui...@dataventures.com wrote: Thanks. But in UNIX side, I got the same error ** ** In getDependencies(pkgs, dependencies, available, lib) : package ‘car’ is not

Re: [R] Variance Inflation factor

2012-07-11 Thread Hui Du
Thank you for your consideration. sessionInfo() R version 2.11.1 (2010-05-31) i686-pc-linux-gnu locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8

Re: [R] help with merging 2 data frames

2012-07-11 Thread Jorge I Velez
Hi Dimitri, Try creating a key for x and y and then merging the result by that variable: x$key - with(x, paste(a, b, sep = /)) y$key - with(y, paste(a2, b, sep = /)) merge(x, y, by = 'key')[, c(2:4, 8:9)] HTH, Jorge.- On Wed, Jul 11, 2012 at 6:28 PM, Dimitri Liakhovitski wrote: Dear R-ers,

Re: [R] fill 0-row data.frame with 1 line of NAs

2012-07-11 Thread William Dunlap
In that case, I think that using a subscript of NA is the best way to go. It works for both matrices and data.frames (unlike an integer larger than nrow(data)) and its meaning is pretty clear. Also, you will probably get better results if the function in your call to apply() returns the index

Re: [R] Variance Inflation factor

2012-07-11 Thread Richard M. Heiberger
Hui Du, There is probably something wrong with either your setup or your choice of CRAN mirror. Both HH and car are present in CRAN for all platforms. ---Your session info just arrived. R version 2.11.1 (2010-05-31) is over two years old. The current version is R version 2.15.1 (2012-06-22).

Re: [R] Mixed Models providing a correlation structure.

2012-07-11 Thread Kevin Wright
Why did you use the 'lower.tri' syntax? Does this work for you? lme(Y~Random, data = DATA, random = list(Random = pdSymm(CovM,~Random))) Kevin On Wed, Jul 11, 2012 at 9:27 AM, Marcio mrese...@ufl.edu wrote: Dear Simon, Thanks for the quick reply. Unfortunately I don't have access to

  1   2   >