[R] Sorting data.frame and again sorting within data.frame

2013-04-15 Thread Katherine Gobin
Dear R forum, I have a data.frame as defied below - df = data.frame(names = c(C, A, A, B, C, B, A, B, C), dates = c(4/15/2013, 4/13/2013, 4/15/2013, 4/13/2013, 4/13/2013, 4/15/2013, 4/14/2013, 4/14/2013,4/14/2013 ),values = c(10, 31, 31, 17, 11, 34, 102, 47, 29)) df   names dates

[R] how to transform string to Camel Case?

2013-04-15 Thread Liviu Andronic
Dear all, Given the following vector: (z - c('R project', 'hello world', 'something Else')) [1] R project hello worldsomething Else I know how to obtain all capitals or all lower case letters: tolower(z) [1] r project hello worldsomething else toupper(z) [1] R PROJECT

Re: [R] how to transform string to Camel Case?

2013-04-15 Thread Pascal Oettli
Hi, There is an example of how to do do what you are looking for in ?toupper Regards, Pascal On 04/15/2013 03:50 PM, Liviu Andronic wrote: Dear all, Given the following vector: (z - c('R project', 'hello world', 'something Else')) [1] R project hello worldsomething Else I know how

Re: [R] how to transform string to Camel Case?

2013-04-15 Thread Henrik Bengtsson
See for instance capitalize() in the R.utils package. Henrik On Apr 14, 2013 11:51 PM, Liviu Andronic landronim...@gmail.com wrote: Dear all, Given the following vector: (z - c('R project', 'hello world', 'something Else')) [1] R project hello worldsomething Else I know how to

Re: [R] how to transform string to Camel Case?

2013-04-15 Thread peter dalgaard
On Apr 15, 2013, at 08:50 , Liviu Andronic wrote: Dear all, Given the following vector: (z - c('R project', 'hello world', 'something Else')) [1] R project hello worldsomething Else I know how to obtain all capitals or all lower case letters: tolower(z) [1] r project hello

Re: [R] Sorting data.frame and again sorting within data.frame

2013-04-15 Thread Jeff Newmiller
The examples in ?order show a method that could be applied if you avoid the decreasing argument and instead convert the Date to numeric for purposes of sorting. --- Jeff NewmillerThe .

[R] Imputation with SOM using kohonen package

2013-04-15 Thread Ben Harrison
I have a data set with 10 variables, and about 8000 instances (or objects/rows/samples). In addition I have one more ('class') variable that I have about 10 instances for, but for which I wish to impute values for. I am a little confused how to go about doing this, mostly as I'm not well-versed

Re: [R] how to transform string to Camel Case?

2013-04-15 Thread Gergely Daróczi
Dear Liviu, I have just updated tocamel to have a new argument, so the development version of the package would produce: tocamel(z, upper = TRUE, sep = ' ') [1] R Project Hello WorldSomething Else Best, Gergely PS #1: to install the dev branch you might give a try to the devtools

[R] create an access file

2013-04-15 Thread Aileen Lin
Hi there, I have seen this post. https://stat.ethz.ch/pipermail/r-help/2007-June/133606.html have odbc installed in my machine. Now I have the following message: channel2 - odbcDriverConnect(test.mdb)Warning messages:1: In odbcDriverConnect(test.mdb) : [RODBC] ERROR: state IM002, code 0,

Re: [R] model frame and formula mismatch in model.matrix()

2013-04-15 Thread jul 2-pom
Hi Eva, you're right, it works with 50 variables. Then, how could I change this variable limit in the lm function? Thank you very much for your help. Julien. -- View this message in context: http://r.789695.n4.nabble.com/model-frame-and-formula-mismatch-in-model-matrix-tp4664093p4664226.html

Re: [R] create an access file

2013-04-15 Thread Prof Brian Ripley
On 15/04/2013 07:12, Aileen Lin wrote: Hi there, I have seen this post. https://stat.ethz.ch/pipermail/r-help/2007-June/133606.html have odbc installed in my machine. Now I have the following message: channel2 - odbcDriverConnect(test.mdb)Warning messages:1: In odbcDriverConnect(test.mdb) :

[R] nearest stations in distance matrix

2013-04-15 Thread eliza botto
Dear R-user, Is there a way in R to locate the nearest 5 indices to a station, based on distances in a distance matrix. In other words i want to have nearest stations based on the distances in the matrix. The distance matrix, i have, has dimension 44*44. Thankyou very much in advance Elisa

Re: [R] nearest stations in distance matrix

2013-04-15 Thread ONKELINX, Thierry
Dear Eliza, If you have the coordinates of the stations you can use the nnwhich() function from the spatstat package. Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie Kwaliteitszorg / team Biometrics Quality

[R] Fwd: Dotchart per groups

2013-04-15 Thread zuzana zajkova
Hi all, I would like to ask you for advice. I did a dotplot - using dotchart function. There are two localites (loc) with values 75 or 56 in my data ZZ. The f column has 4 levels: P1, S1, S8, R6. The dataframe is ordered by N value, pchloc value is assign to use pch in plot. head(ZZ) loc f

Re: [R] how to transform string to Camel Case?

2013-04-15 Thread Liviu Andronic
On Mon, Apr 15, 2013 at 9:25 AM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: See for instance capitalize() in the R.utils package. Unfortunately this also fails when NA values are present: z - c(R project, hello world, something Else, NA) R.utils::capitalize(z) [1] R project Hello world

Re: [R] how to transform string to Camel Case?

2013-04-15 Thread Liviu Andronic
On Mon, Apr 15, 2013 at 9:20 AM, Pascal Oettli kri...@ymail.com wrote: There is an example of how to do do what you are looking for in ?toupper Unfortunately this fails when NA values are present: z - c(R project, hello world, something Else, NA) tocapwords(z) [1] R Project Hello World

Re: [R] how to transform string to Camel Case?

2013-04-15 Thread Liviu Andronic
On Mon, Apr 15, 2013 at 10:10 AM, Gergely Daróczi gerg...@snowl.net wrote: Dear Liviu, I have just updated tocamel to have a new argument, so the development version of the package would produce: tocamel(z, upper = TRUE, sep = ' ') [1] R Project Hello WorldSomething Else Thanks

Re: [R] how to transform string to Camel Case?

2013-04-15 Thread Rainer M. Krug
Liviu Andronic landronim...@gmail.com writes: On Mon, Apr 15, 2013 at 9:25 AM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: See for instance capitalize() in the R.utils package. Unfortunately this also fails when NA values are present: z - c(R project, hello world, something Else, NA)

Re: [R] how to transform string to Camel Case?

2013-04-15 Thread Gergely Daróczi
On 15 April 2013 14:10, Liviu Andronic landronim...@gmail.com wrote: On Mon, Apr 15, 2013 at 10:10 AM, Gergely Daróczi gerg...@snowl.net wrote: Dear Liviu, I have just updated tocamel to have a new argument, so the development version of the package would produce: tocamel(z, upper

[R] Indices of lowest values in matrix

2013-04-15 Thread eliza botto
Dear R users,Sorry for such a basic question. I really need to know that how can i pick the indices of 5 lowest values from each row of a matrix with dimensions 12*12??Thank you very much in advance Elisa [[alternative HTML version deleted]]

Re: [R] importing and merging many time series

2013-04-15 Thread Joshua Ulrich
On Sun, Apr 7, 2013 at 7:40 AM, Anton Lebedevich mab...@gmail.com wrote: Hello. I've got many (5-20k) files with time series in a text format like this: 1359635460 2.006747 1359635520 1.886745 1359635580 3.066988 1359635640 3.633578 1359635700 2.140082 1359635760

Re: [R] Indices of lowest values in matrix

2013-04-15 Thread peter dalgaard
On Apr 15, 2013, at 14:27 , eliza botto wrote: Dear R users,Sorry for such a basic question. I really need to know that how can i pick the indices of 5 lowest values from each row of a matrix with dimensions 12*12??Thank you very much in advance Something like this? m [,1] [,2]

Re: [R] how to transform string to Camel Case?

2013-04-15 Thread Liviu Andronic
On Mon, Apr 15, 2013 at 2:22 PM, Gergely Daróczi gerg...@snowl.net wrote: I have added an extra check in the function for NA values before applying `paste` at https://github.com/Rapporter/rapport/compare/34ca6a35fb...a04abc8b21 Alex might not like it :) Example: tocamel(z, upper = TRUE,

Re: [R] Sorting data.frame and again sorting within data.frame

2013-04-15 Thread arun
library(plyr) arrange(df,names,desc(dates)) #  names dates values #1 A 4/15/2013 31 #2 A 4/14/2013    102 #3 A 4/13/2013 31 #4 B 4/15/2013 34 #5 B 4/14/2013 47 #6 B 4/13/2013 17 #7 C 4/15/2013 10 #8 C 4/14/2013 29 #9 C 4/13/2013   

Re: [R] Sorting data.frame and again sorting within data.frame

2013-04-15 Thread arun
You can also use: df[order(df$names,-xtfrm(df$dates),decreasing=FALSE),]  # names dates values #3 A 4/15/2013 31 #7 A 4/14/2013    102 #2 A 4/13/2013 31 #6 B 4/15/2013 34 #8 B 4/14/2013 47 #4 B 4/13/2013 17 #1 C 4/15/2013 10 #9 C

Re: [R] Kruskal-Wallis

2013-04-15 Thread arun
Hi, set.seed(25)  myFile1-as.data.frame(matrix(sample(1:40,50,replace=TRUE),nrow=10))  row.names(myFile1)- LETTERS[1:10] groups - rep (0:1, c(3,2)) kruskal-apply(myFile1,1,kruskal.test,groups)  p_kruskal - sapply(kruskal, function(x) x$p.value)  p_kruskal # A  B  C 

Re: [R] Kruskal-Wallis

2013-04-15 Thread Charles Determan Jr
One statistical point beyond A.K.'s well done response. As you should well know, Kruskal-Wallis is a non-parametric equivalent of ANOVA. However, you only have two groups and do not require an ANOVA approach. You could simply use a Mann-Whitney U (aka.. independent Wilcoxon) test using

[R] Overlay two stat_ecdf() plots

2013-04-15 Thread Robin Mjelle
I want to plot two scdf-plots in the same graph. I have two input tables with one column each: Targets - read.table(/media/, sep=, header=T) NonTargets - read.table(/media/..., sep=, header=T) head(Targets) V1 1 3.160514 2 6.701948 3 4.093844 4 1.992014 5 1.604751 6 2.076802

[R] need help with R

2013-04-15 Thread sam tingey
hey there can i email questions to this address to get help with using R thanks sam [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] (no subject)

2013-04-15 Thread ilovestats
Hi, I'm trying to decide between doing a FA or PCA and would appreciate some pointers. I've got a questionnaire with latent items which the participants answered on a Likert scale, and all I want to do at this point is to explore the data and extract a number of factors/components. Would FA or PCA

[R] Optimisation and NaN Errors using clm() and clmm()

2013-04-15 Thread Thomas
Dear List, I am using both the clm() and clmm() functions from the R package 'ordinal'. I am fitting an ordinal dependent variable with 5 categories to 9 continuous predictors, all of which have been normalised (mean subtracted then divided by standard deviation), using a probit link

Re: [R] how to transform string to Camel Case?

2013-04-15 Thread arun
HI, You could use: gsub((^|\\s+)([a-z]),\\1\\U\\2,z,perl=TRUE) #[1] R Project  Hello World    Something Else #or  gsub(\\b([a-z]),\\U\\1,z,perl=TRUE) #[1] R Project  Hello World    Something Else A.K. - Original Message - From: Liviu Andronic landronim...@gmail.com To: r-help

Re: [R] need help with R

2013-04-15 Thread Sarah Goslee
Yes, but do read: http://www.R-project.org/posting-guide.html first. Sarah On Mon, Apr 15, 2013 at 2:09 AM, sam tingey sam.ting...@gmail.com wrote: hey there can i email questions to this address to get help with using R thanks sam __

Re: [R] Cross validation for Naive Bayes and Bayes Networks

2013-04-15 Thread Marco Scutari
Hi Guilherme, On Sun, Apr 14, 2013 at 11:48 PM, Guilherme Ferraz de Arruda gu...@yahoo.com.br wrote: Hi, I need to classify, using Naive Bayes and Bayes Networks, and estimate their performance using cross validation. How can I do this? I tried the bnlearn package for Bayes Networks,

Re: [R] Indices of lowest values in matrix

2013-04-15 Thread arun
Hi, TRy this: set.seed(30)  mat1- matrix(sample(1:50,12*12,replace=TRUE),ncol=12) mat1   [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]  [1,]    5   28   13    4   47    3   30   16    3    39    42 9  [2,]   25   44   15   21    9    5   32    5    4    33    30    21  

Re: [R] need help with R

2013-04-15 Thread Dieter Menne
Sam tingey wrote: can i email questions to this address to get help with using R Sarah Goslee replied; Yes, but do read: http://www.R-project.org/posting-guide.html Dieter Menne thought: Catch 42. When you are so good that you can create a reproducible example without using R, you only will

Re: [R] (no subject)

2013-04-15 Thread peter dalgaard
On Apr 15, 2013, at 14:30 , ilovestats wrote: Hi, I'm trying to decide between doing a FA or PCA and would appreciate some pointers. I've got a questionnaire with latent items which the participants answered on a Likert scale, and all I want to do at this point is to explore the data and

Re: [R] as.date not reading Hour/Minute am/pm Data

2013-04-15 Thread arun
Hi, Try: x- c(2/26/13 11:59 PM, 2/25/13 10:25 AM) strptime(x,%m/%d/%y %I:%M %p) #[1] 2013-02-26 23:59:00 2013-02-25 10:25:00 #or library(lubridate) parse_date_time(x,%m/%d/%y %I:%M %p) # 2 parsed with %m/%d/%y %I:%M %p #[1] 2013-02-26 23:59:00 UTC 2013-02-25 10:25:00 UTC A.K. I'm a newbie to

[R] use of simulate.Arima (forecast package)

2013-04-15 Thread Stefano Sofia
I would like to simulate some SARIMA models, e.g. a SARIMA (1,0,1)(1,0,1)[4] process. I installed the package 'forecast', where the function simulate.Arima should do what I am trying to do. I am not able to understand how it works Could somebody help me with an example? thank you Stefano Sofia

[R] Using R commander within R Studio (Mac)

2013-04-15 Thread h moore
Hi. I am a R studio user and would like to use RCommander within R studio. Each time I try to install and use Rcommander, I see the following message: Loading Tcl/Tk interface ... Error : .onLoad failed in loadNamespace() for 'tcltk', details: call: dyn.load(file, DLLpath = DLLpath, ...)

Re: [R] how to transform string to Camel Case?

2013-04-15 Thread Gabor Grothendieck
On Mon, Apr 15, 2013 at 2:50 AM, Liviu Andronic landronim...@gmail.com wrote: Dear all, Given the following vector: (z - c('R project', 'hello world', 'something Else')) [1] R project hello worldsomething Else I know how to obtain all capitals or all lower case letters: tolower(z)

Re: [R] Using R commander within R Studio (Mac)

2013-04-15 Thread John Fox
Dear Helene, I don't think that your problem has anything to do with RStudio. I suspect that you haven't installed Tcl/Tk for X-Windows on your Mac, as is required by the tcltk package for versions of R on the Mac prior to 3.0.0. Please read the Rcmdr installation instructions at

Re: [R] how to transform string to Camel Case?

2013-04-15 Thread Gabor Grothendieck
On Mon, Apr 15, 2013 at 10:56 AM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Mon, Apr 15, 2013 at 2:50 AM, Liviu Andronic landronim...@gmail.com wrote: Dear all, Given the following vector: (z - c('R project', 'hello world', 'something Else')) [1] R project hello world

Re: [R] Indices of lowest values in matrix

2013-04-15 Thread eliza botto
Dear Arun, Thankyou very much. it worked out :D Elisa Date: Mon, 15 Apr 2013 07:19:40 -0700 From: smartpink...@yahoo.com Subject: Re: [R] Indices of lowest values in matrix To: eliza_bo...@hotmail.com Hi Elisa, I am not sure how you got that values for the first rows of mat1. Is it from

Re: [R] RJSONIO Installation

2013-04-15 Thread Uwe Ligges
On 13.04.2013 08:22, Jeff Newmiller wrote: R CMD build will only work on Windows if you have Rtools installed. Visit your local CRAN mirror and read... this is not exactly trivial. Not exactly true: pure R code / data packages typically R CMD build and R CMD INSTALL without those tools

[R] Is it possible to create Dual y axes with ggplot2 package?

2013-04-15 Thread jpm miao
Hi, Is it possible to create Dual y axes with ggplot2 package? If so, is there any sample codes that reaches (or partially) this goal? The author of the package, Dr Hadley Wickham, seem to discourage the dual axes, but some remedies were provided by other users (If I am wrong, please

Re: [R] group data

2013-04-15 Thread Ye Lin
What if more generally that the group name doest have anything to do with the ID, eg. for ID=AL1 and AL2, I want to name the group as Key1, how can I approach that? Thanks, On Thu, Apr 11, 2013 at 11:54 AM, Rui Barradas ruipbarra...@sapo.pt wrote: Hello, Try the following. dat -

Re: [R] Sorting data.frame and again sorting within data.frame

2013-04-15 Thread David Winsemius
On Apr 14, 2013, at 11:01 PM, Katherine Gobin wrote: Dear R forum, I have a data.frame as defied below - df = data.frame(names = c(C, A, A, B, C, B, A, B, C), dates = c(4/15/2013, 4/13/2013, 4/15/2013, 4/13/2013, 4/13/2013, 4/15/2013, 4/14/2013, 4/14/2013,4/14/2013 ),values = c(10,

[R] regression with paired left-censored data

2013-04-15 Thread Laura MacCalman
HI I am trying to analyse data which is left-censored (i.e. has values below the detection limit). I have been using the NADA package of R to derive summary statistics and do some regression. I am now trying to carry out regression on paired data where both my X and Y have left-censored data

[R] Latent variable manual construction

2013-04-15 Thread Taman Powell
Dear all, I had a question around how to manually construct latent variables. I'll provide a little background…. Basically I have a SEM with 17 items, 6 latent variables and 615 rows of data. I have all my model data (loadings, t values etc.) from lavaan, as well as correlation matrices. I

[R] Convert results from print(survfit(formula, ...)) into a matrix or data frame

2013-04-15 Thread Paul Miller
Hello All, Below is some sample survival analysis code. I'd like to able to get the results from print(gehan.surv) into a matrix or data frame, so I can manipulate them and then create a table using odfWeave. Trouble is, I'm not quite sure how make such a conversion using the results from a

Re: [R] Sorting data.frame and again sorting within data.frame

2013-04-15 Thread Jeff Newmiller
Yes, that would be because she converted to Date on the fly in her example, and so apparently did not need this reminder. --- Jeff NewmillerThe . . Go Live...

Re: [R] Convert results from print(survfit(formula, ...)) into a matrix or data frame

2013-04-15 Thread Marc Schwartz
On Apr 15, 2013, at 11:31 AM, Paul Miller pjmiller...@yahoo.com wrote: Hello All, Below is some sample survival analysis code. I'd like to able to get the results from print(gehan.surv) into a matrix or data frame, so I can manipulate them and then create a table using odfWeave. Trouble

Re: [R] Convert results from print(survfit(formula, ...)) into a matrix or data frame

2013-04-15 Thread Paul Miller
Hi Marc, Oh, yes. That is quite simple. Silly me for not recognizing this. Thanks very much for your help. Paul __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] Remove Rows Based on Factor

2013-04-15 Thread Sparks, John James
Dear R Helpers, I did a search for deleting rows based on conditions but wasn't able to find an example that addressed the error that I am getting. I am hoping that this is a simple syntax phenomenon that somebody else knows off the top of their head. My apologies for not providing a

Re: [R] Sorting data.frame and again sorting within data.frame

2013-04-15 Thread David Winsemius
On Apr 15, 2013, at 9:33 AM, Jeff Newmiller wrote: Yes, that would be because she converted to Date on the fly in her example, and so apparently did not need this reminder. I apologize, Iobviously missed that. So the answer was simply to put a minus sign in front of the as.Date()

Re: [R] Remove Rows Based on Factor

2013-04-15 Thread David Winsemius
On Apr 15, 2013, at 9:58 AM, Sparks, John James wrote: Dear R Helpers, I did a search for deleting rows based on conditions but wasn't able to find an example that addressed the error that I am getting. I am hoping that this is a simple syntax phenomenon that somebody else knows off the

Re: [R] Remove Rows Based on Factor

2013-04-15 Thread arun
Hi, May be this helps: ZZ-

Re: [R] Remove Rows Based on Factor

2013-04-15 Thread arun
Hi, In addition: You can subset based on time or date: ZZ1['2006'] #   Open High  Low Close   Volume Adjusted #2006-04-07 17.5 18.2 17.3  17.5 23834500 16.8 #2006-04-08 17.6 17.6 16.8  16.8  2916000 16.2 ZZ1['2007-01/2008-01'] #   Open High  Low Close  Volume Adjusted

Re: [R] group data

2013-04-15 Thread arun
Hi, You could do this: dat1- read.table(text= ID  Value AL1  1 AL2  2 CA1  3 CA4  4 ,sep=,header=TRUE,stringsAsFactors=FALSE)  lst1-split(dat1,gsub(\\d+,,dat1$ID)) res-do.call(rbind,lapply(seq_along(lst1),function(i) {x1-lst1[[i]]; x1$group- paste0(Key,i);x1}))  res #   ID Value group #1 AL1

Re: [R] regression with paired left-censored data

2013-04-15 Thread MacQueen, Don
I would probably start with maximum likelihood estimation. I suppose you could impute X and Y separately using ros() from the NADA package, and then run you ordinary regression on the imputed values. Obviously, this ignores any relationship between X and Y, since each is imputed independently of

Re: [R] regression with paired left-censored data

2013-04-15 Thread David Winsemius
On Apr 15, 2013, at 8:55 AM, Laura MacCalman wrote: HI I am trying to analyse data which is left-censored (i.e. has values below the detection limit). I have been using the NADA package of R to derive summary statistics and do some regression. I am now trying to carry out regression on

[R] Smallest Space Analysis help

2013-04-15 Thread Diego Cesar
Hello fellow R users, I need to perform Guttman's Smallest Space Analysis, which is a type of Non-metric Multidimensional Scaling. Not wanting to reinvent the wheel i decided to look for a package which may have an implementation of it, but no success at all. Do you guys know of any package that

Re: [R] Removing multiple elements from a vector or list

2013-04-15 Thread arun
Hi,  vec1- letters vec1[!grepl(b|r|x,alp)] # [1] a c d e f g h i j k l m n o p q s t u #[20] v w y z  vec1[!vec1%in% c(b,r,x) ] # [1] a c d e f g h i j k l m n o p q s t u #[20] v w y z alp-lapply(seq_along(vec1),function(i) vec1[i])  res-alp[!grepl(b|r|x,alp)] unlist(res) # [1] a c d e f g h i

[R] View saved workspace commands

2013-04-15 Thread Sourabh Sinha
R version : 2.15.2 Windows: 7 32-bit Hello, I was trying to load a saved workspace image from the working directory. I issued the command load('image_name') in R console. It did not throw any error, but then it returned the prompt. I want to view the commands (or history) I typed there, how do

[R] matching multiple fields from a matrix

2013-04-15 Thread jercrowley
I have been trying many ways to match 2 separate fields in a matrix. Here is a simplified version of the matrix: site1 depth1 year1 site2 depth2 year2 10 30 1860NA NA NA NA NA NA 50 30 1860 Basically I am trying to identify the sites

[R] Can not load Rcmdr

2013-04-15 Thread Ludwig Asam
Hello, I have the same problem on my mac and it doesn't work to load Rcmdr.. library(Rcmdr) Error : .onAttach failed in attachNamespace() for 'Rcmdr', details: call: structure(.External(.C_dotTclObjv, objv), class = tclObj) error: [tcl] invalid command name image. Error: package or

Re: [R] Removing multiple elements from a vector or list

2013-04-15 Thread David Winsemius
On Apr 15, 2013, at 2:30 PM, arun wrote: Hi, vec1- letters alp - as.list(letters) would have constructed the vector that was described. vec1[!grepl(b|r|x,alp)] # [1] a c d e f g h i j k l m n o p q s t u #[20] v w y z vec1[!vec1%in% c(b,r,x) ] # [1] a c d e f g h i j k l m n o p q s

Re: [R] Can not load Rcmdr

2013-04-15 Thread David Winsemius
On Apr 15, 2013, at 1:51 PM, Ludwig Asam wrote: Hello, I have the same problem on my mac and it doesn't work to load Rcmdr.. library(Rcmdr) Error : .onAttach failed in attachNamespace() for 'Rcmdr', details: call: structure(.External(.C_dotTclObjv, objv), class = tclObj) error:

Re: [R] nearest stations in distance matrix

2013-04-15 Thread Rolf Turner
Presumably --- based on the question she actually *asked* --- she does NOT have the coordinates of the stations; only the distance matrix. I believe that the following will do the job: Let M be the distance matrix. diag(M) - Inf nn5 -

[R] Fwd: Imputation with SOM using kohonen package

2013-04-15 Thread Ben Harrison
Trying re-send as plain text. I have a data set with 10 variables, and about 8000 instances (or objects/rows/samples). In addition I have one more ('class') variable that I have about 10 instances for, but for which I wish to impute values for. I am a little confused how to go about doing this,

Re: [R] nearest stations in distance matrix

2013-04-15 Thread Rolf Turner
There was a bit of cranial wind-passing in my previous message. (A bit of redundancy.) My solution should have read: diag(M) - Inf nn5 - apply(M,1,function(x){order(x)[1:5]}) What I wrote gave the right answer; there was just a bunch of unnecessary ring-around-the-rosy playing in it.

Re: [R] View saved workspace commands

2013-04-15 Thread Uwe Ligges
On 15.04.2013 21:53, Sourabh Sinha wrote: R version : 2.15.2 Windows: 7 32-bit Hello, I was trying to load a saved workspace image from the working directory. I issued the command load('image_name') in R console. It did not throw any error, but then it returned the prompt. I want to view

Re: [R] create an access file

2013-04-15 Thread Aileen Lin
worked it out. Thank you. misunderstood the post earlier. Aileen On 15 April 2013 20:17, Prof Brian Ripley rip...@stats.ox.ac.uk wrote: On 15/04/2013 07:12, Aileen Lin wrote: Hi there, I have seen this post.

Re: [R] create an access file

2013-04-15 Thread Aileen Lin
Hi there, I tried the command in https://stat.ethz.ch/**pipermail/r-help/2007-June/** 133606.html https://stat.ethz.ch/pipermail/r-help/2007-June/133606.html In R, it works OK. In Rstudio, there seems to be a problem: library(RODBC)ch - odbcDriverConnect(Driver={Microsoft Access Driver

Re: [R] Can not load Rcmdr

2013-04-15 Thread John Fox
Dear Lugwig, Have you followed the steps in the Rcmdr installation notes at http://socserv.socsci.mcmaster.ca/jfox/Misc/Rcmdr/installation-notes.html? In particular, have you installed X-Windows? Mac OS X Mountain Lion does not come with X-Windows installed. Best, John

Re: [R] create an access file

2013-04-15 Thread Jeff Newmiller
You missed that this is not the RStudio support forum. You probably also missed that R comes in both 32-bit and 64-bit flavors in the Windows binary distribution, and you have to use the one that matches the ODBC drivers you want to use. You can specify which version RStudio is to use.

Re: [R] converting blank cells to NAs

2013-04-15 Thread arun
You can use na.strings= in read.table() or read.csv() library(stringr) vec1-unlist(str_split(readLines(textConnection(3,7,11,,12,14,15,,17,18,19)),,))  vec1[vec1==]- NA  vec1 # [1] 3  7  11 NA   12 14 15 NA   17 18 19 #or scan(text=3,7,11,,12,14,15,,17,18,19,sep=,) #Read 11 items  #[1]  3  7

Re: [R] how to add a row vector in a dataframe

2013-04-15 Thread arun
Hi, May be this helps you. #Using set.seed(12345) S=10 simdata - replicate(S, generate(250)) lstpshat-lapply(seq_len(ncol(simdata)),function(i)

Re: [R] matching multiple fields from a matrix

2013-04-15 Thread arun
HI, May be this helps: dat1- read.table(text= site1 depth1 year1 site2 depth2 year2 10 30 1860 NA NA NA NA NA NA 50 30 1860 10 20 1850  11 20 1850 11 25 1950  12 25 1960 10 NA 1870  12 30 1960 11 25 1880  15 22  1890 14 22 1890  14 25 1880 ,sep=,header=TRUE,stringsAsFactors=FALSE)  

[R] HMM Package parameter estimation

2013-04-15 Thread Richard Philip
Hi, I am having difficulties estimating the parameters of a HMM using the HMM package. I have simulated a sequence of observations from a known HMM. When I estimate the parameters of a HMM using these simulated observations the parameters are not at all close to the known ones. I realise the

[R] rdagum(Library (VGAM))

2013-04-15 Thread Shant Ch
Hello! I am working with a procedure where I need to draw one observation at a time from dagum distribution. I used the function defined in the VGAM library. when I did, rdagum(n=1, 0.2,1,4.5)) it says: Error in qdagum(runif(n), shape1.a = shape1.a, scale = scale, shape2.p =