[R] Kate terminal window

2010-05-20 Thread Luc Villandre
Dear R-users, I've recently switched to Ubuntu and I've decided to use Kate to edit my R code. I really like how Kate allows one to simply pipe their code to the terminal. However, I would find it even better if I could actually get the Kate console to display error messages (or any console

Re: [R] Matching data to a new column

2009-06-26 Thread Luc Villandre
Hi Laura, The function merge() works well, but another elegant to do it would involve match(). (Assuming your data.frame object is called x) x$motherAge - with(x, age[match(mothers.I.D,I.D)]) Cheers, -- *Luc Villandré* /Biostatistician McGill University Health Center - Montreal Children's

[R] Problem with groupedData and lme

2009-07-02 Thread Luc Villandre
Dear R-users, I'm currently having trouble with the implementation of a groupedData object in the lme() function. Executing the following function applyScalingSimp - function(input.population) { ## GA is a time value varInOrder - c(GA,weight,grouping,sex) modelVar -

Re: [R] Need to clean a table, and compute mean and SD

2009-05-04 Thread Luc Villandre
Thom_249 wrote: Hi For a school project I have a file with 120 columns and ~2000 lines. This file contains timestamps of spike detected in 60 channels, and the time elapsed between the last spike. I need to clean too high values. About 98% of values are between 0 and 2000 and 2% are between

Re: [R] Print to File Formatting

2009-05-07 Thread Luc Villandre
Brigid Mooney wrote: Hello, I am writing out to a file and have two quick questions that I can't seem to track down the correct answers for. Luckily, I *think* they are both simple enough that someone might be able to point me in the right direction on them without too much trouble. Both

Re: [R] Help to extract results from lme.object

2009-05-08 Thread Luc Villandre
Auston wrote: Hi list, Would someone please give me a hint how to extract the between and within subject StdDev from lme fit? Below is the output from the fit, but I couldn't find the number 0.3927714 anywhere in the fitted object. Thanks in advance for your help! Random effects: Formula: ~1

Re: [R] Searching within a ch. string

2009-05-11 Thread Luc Villandre
Hi Ron, Look up the grep() function. Cheers, -- *Luc Villandré* /Biostatistician McGill University Health Center - Montreal Children's Hospital Research Institute/ RON70 wrote: Hi all, is there any function to find some words in a character-string? For example suppose the string is :

Re: [R] Input to variables - help please

2009-05-13 Thread Luc Villandre
Steve Sidney wrote: Dear list I have managed to write a short program to evaluate data which is inputted from a csv file using the following x = read.csv(wms_results.csv, header=TRUE) All works fine but since I have a number of similar data files which have different names, I would like the

Re: [R] Input to variables - help please

2009-05-13 Thread Luc Villandre
Steve Sidney wrote: Hi Luc Many thanks for the suggestions. I will take a look at them as soon as I can. Are the functions standard or are they part of a function and if so which one? Regards Steve - Original Message - From: Luc Villandre villa...@dms.umontreal.ca To: Steve

Re: [R] [OT?]R Reference Manual review/recommend

2009-05-13 Thread Luc Villandre
AG wrote: Hello all I am looking to learn R and was thumbing through volume 1 of R reference manual - Base Package. I'm sorry if this is ludicrously silly to ask, but is this book worth the investment as a good way to learn how to use R? AG __

Re: [R] automated polynomial regression

2009-05-14 Thread Luc Villandre
Dieter Wirz wrote: Dear all - We perform some measurements with a machine that needs to be recalibrated. The best calibration we get with polynomial regression. The data might look like follows: true_y - c(1:50)*.8 # the real values m_y - c((1:21)*1.1, 21.1, 22.2, 23.3 ,c(25:50)*.9)/0.3-5.2

Re: [R] Using while statements to insert rows in a dataframe

2009-05-19 Thread Luc Villandre
Eric McKibben wrote: Hi. I am very new to R and have been diligently working my way through the manual and various tutorials. I am now trying to work with some of my own data and have encountered a problem that I need to fix. I have a dataframe with 8 columns and approximately 850 rows. I

Re: [R] How to google for R stuff?

2009-05-20 Thread Luc Villandre
Kynn Jones wrote: Hi! I'm new to R programming, though I've been programming in other languages for years. One thing I find most frustrating about R is how difficult it is to use Google (or any other search tool) to look for answers to my R-related questions. With languages with even

Re: [R] Getting lm() to work with a matrix

2009-05-20 Thread Luc Villandre
MikSmith wrote: Hi I'm fairly new to R and am trying to analyse some large spectral datasets using stepwise regression (fairly standard in this area). I have a field sampled dataset, of which a proportion has been held back for validation. I gather than step() needs to be fed a regression model

Re: [R] How to load data from Statistics Canada

2009-05-20 Thread Luc Villandre
g...@ucalgary.ca wrote: We would like to load data from Statistics Canada (http://www.statcan.gc.ca/) using R, for example, Employment and unemployment rates. It seems to me that the tables are displayed in HTML. I was wondering if you know how to load these tables. Thanks, -james

Re: [R] Creating multiple graphs based on one variable

2009-05-26 Thread Luc Villandre
Tim Clark wrote: Dear List, I would like to create several graphs of similar data. I have x and y values for several different individuals (in this case fish). I would like to plot the x and y values for each fish separately. I can do it using a for loop, but I think I should be using

[R] Object-oriented programming in R

2009-05-27 Thread Luc Villandre
Dear R-users, I have very recently started learning about object-oriented programming in R. I am far from being an expert in programming, although I do have an elementary C++ background. Please take a look at these lines of code. some.data = data.frame(V1 = 1:5, V2 = 6:10) ; p.plot =

Re: [R] How this addition works?

2009-05-28 Thread Luc Villandre
bogaso.christofer wrote: I have following addition : 1:2 + 1:10 [1] 2 4 4 6 6 8 8 10 10 12 I could not understand how R adding those two unequal vector? Any help? [[alternative HTML version deleted]] __

Re: [R] excluding NAs in data frame without deleting rows

2009-05-29 Thread Luc Villandre
Wade Wall wrote: Hi all, I have a binary matrix with NAs included. Each row and column includes at least one NA, so I don't want to omit them. Is there a way to sum across rows and columns, ignoring the NAs but not deleting the row or column? If not, I suppose I can write a loop function,

Re: [R] remove object

2009-05-29 Thread Luc Villandre
fernando espindola wrote: Hi list I try to remove all object less one, this object is called index. I have many object with different names and pattern option in ls function may not remove this object why any word in index object repeats with other object. Anybody can give me one advise

Re: [R] maxtrix to permutation vector

2009-05-29 Thread Luc Villandre
Ian Coe wrote: Hi, Is there a way to convert a matrix into a vector representing all permutations of values and column/row headings with native R functions? I did this with 2 nested for loops and it took about 25 minutes to run on a ~700x700 matrix. I'm assuming there must be a smarter

Re: [R] number of zeros in a matrix -row by row

2009-04-06 Thread Luc Villandre
Hi, Try /rowSums(M==0)/ This should work just fine. Cheers, Luc onyourmark wrote: Hi. I have an n x m matrix M some of who's entries are zeros. I want to know how many zeros there are in each row-perhaps stored in a 1 x n vector which lists the number of zeros for each row of M.

Re: [R] Best way to turn a list into a data.frame

2009-04-06 Thread Luc Villandre
Hi Daniel, In your case, I guess you could use: col1 = rep(attributes(my.list)$names,lapply(my.list,length)) ; col2 = unlist(my.list,use.names=FALSE) ; my.data.frame = as.data.frame(cbind(col1,col2)) ; This should work well. Cheers, Luc Daniel Brewer wrote: Hello, What is the best way to

Re: [R] Recommended packages for a statistician

2009-04-06 Thread Luc Villandre
Hi, Pretty hard to say. It really depends on what you want to. MASS, nlme, lme4 and Hmisc are packages I use on a daily basis. I guess you could also ask for those. David Scott wrote: On Wed, 1 Apr 2009, Eamonn O'Brien wrote: The company I work for require users to request what packages

Re: [R] approximation function

2009-04-06 Thread Luc Villandre
Hi, This is a rather broad question. The function lowess() might be a good place to start, I guess (although I'm not sure whether this fits in your definition of approximation functions...). Best of luck, Luc carol white wrote: Hi, Having a set of values (non-time series data), what

Re: [R] Frequency table to histogram

2009-04-07 Thread Luc Villandre
Hi Mary, Could you please provide a copy of the first few lines of your frequency table (with only relevant columns)? I think this could help many potential contributors understand in more details what you're trying to do. Cheers, Luc Mary Winter wrote: I have read a frequency table in

Re: [R] Frequency table to histogram

2009-04-07 Thread Luc Villandre
Hi Louisa, I'm still not entirely sure of what you're trying to do, but I'll attempt an answer to your question nevertheless. Let's assume that this frequency table was created from a dataset that comprised only a single column of Chest values. If you want to recreate this

Re: [R] group by-like statement for 2-row matrix

2009-04-07 Thread Luc Villandre
Hi Henning, Although there might be a better way to do this, I'd suggest (with my.matrix being the matrix you provided): complete.vector = rep(my.matrix[1,],my.matrix[2,]) ; table(complete.vector) ; Is this what you're looking for? Cheers, Luc Hans-Henning Gabriel wrote: Hi, my problem

Re: [R] use the value of variable to quote certain elements in matrix

2009-04-07 Thread Luc Villandre
Hi Weicheng, Did you forget to add to index your elements? The following example works perfectly fine. test.matrix = matrix(1:4,nrow=2) ; rownames(test.matrix)=c(hi1,hi2) ; colnames(test.matrix)=c(bye1,bye2) ; test.matrix bye1 bye2 hi113 hi224 test.matrix[hi1,bye2] ;

Re: [R] Pulling data into a model

2009-04-08 Thread Luc Villandre
Hi Jacy, I'll take my chances answering your question. I'd suggest using the paste() function and then transforming the string into a formula object: my.formula = as.formula(paste(y~x1+x2+,paste(colnames(REG)[2:num],collapse=+), sep= )) ; aov(my.formula,data=REG) ; The first line

Re: [R] Factor to continuous

2009-04-14 Thread Luc Villandre
Hi, You'll need to be more specific about the nature of your problem. Could you describe what exactly you're trying to do and why you need to transform factors into continuous variables? Could you also provide a small subsample of the data you're working with? Without such information, I

Re: [R] cbind

2009-04-14 Thread Luc Villandre
Hi Emma, Here's what I suggest: na.vec = is.na(A[,1]) ; first.num.pos = min(which(na.vec==FALSE)) ; first.part = (-first.num.pos+1):(-1) ; second.part = 0:(length(A[,1])-length(first.part)-1) ; Result.mat = cbind(c(first.part,second.part),A[,1]) ; I hope this is what you

Re: [R] method ML

2009-04-14 Thread Luc Villandre
Hi Joe, You're using the lme() function? If so, then adding /method = ML / to the argument list should do the trick. Cheers, Luc joewest wrote: Hi I am doing lme models and they are coming out using the REML method, can anyone please tell me how i use the ML method and exactly what i put

Re: [R] matrix merge problem

2009-04-14 Thread Luc Villandre
Hi again, Your second problem can be solved with the merge function. Look at the help file with ?merge. Best of luck, Luc Juan Pablo Fededa wrote: Merci a lot!! On Tue, Apr 14, 2009 at 10:32 PM, Luc Villandre villa...@dms.umontreal.ca mailto:villa...@dms.umontreal.ca wrote: Hi

Re: [R] matrix merge problem

2009-04-14 Thread Luc Villandre
Hi Juan, Your first question can be answered easily. bin.matrix = matrix(A %in% B,nrow(A),ncol(A)) ; bin.vector = rowSums(bin.matrix) 0 ; C = A[bin.vector,] ; This should do the trick. Cheers, Luc Juan Pablo Fededa wrote: Dear r-help contributors, I have two questions: first: I have a

Re: [R] Changing the binning of collected data

2009-04-21 Thread Luc Villandre
Hi Lorenzo, I think it would be better if you provided a few example datasets/tables. Right now, I can't exactly circumscribe your problem. When binning data, the cut() function tends to be very useful. To fit common univariate distributions to a given dataset, you should take a look at the

[R] Loess over split data

2009-04-23 Thread Luc Villandre
Dear R users, I am having trouble devising an efficient way to run a loess() function on all columns of a data.frame (with the x factor remaining the same for all columns) and I was hoping that someone here could help me fix my code so that I won't have to resort to using a for loop.

[R] Can't load package 'lars'

2011-12-05 Thread Luc Villandre
] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] tools_2.13.1 ### Is there at least a way to circumvent the problem? Thank you for your help, Luc Villandre __ R-help@r-project.org mailing list https

Re: [R] Can't load package 'lars'

2011-12-06 Thread Luc Villandre
...@statistik.tu-dortmund.de] Sent: Tuesday, December 06, 2011 8:01 AM To: Luc Villandre Cc: r-help Subject: Re: [R] Can't load package 'lars' On 06.12.2011 03:33, Luc Villandre wrote: Hi, I installed package 'lars' earlier tonight and did not get any sort of error message. ### ** building package indices