Re: [R] "--" < 0

2024-06-25 Thread Adrian Dusa
Oh I see... It's not that "-7" gets coerced to numeric, but 0 gets coerced to "0". Of course... On Tue, Jun 25, 2024 at 11:02 AM Martin Maechler wrote: > >>>>> Adrian Dusa > >>>>> on Tue, 25 Jun 2024 10:56:07 +0300 writes: > &

[R] "--" < 0

2024-06-25 Thread Adrian Dusa
Dear R fellows, >From time to time, just when I thought I knew my R, I get bitten by some small things that reminds one to constantly return to the basics. I knew for instance that "-1" < 0 is TRUE, presumably because R first coerces to numeric before comparing with 0. But I did not expect that

Re: [R] replacing unicode characters

2023-06-30 Thread Adrian Dusa
Right on the point, Ivan, that was the issue. The output from l10n_info() was: $MBCS [1] FALSE $`UTF-8` [1] FALSE $`Latin-1` [1] FALSE $codeset [1] "US-ASCII" (and the locale was just "C") I simply needed to write something like: export LC_ALL='en_US.UTF-8' before starting the child process,

[R] [R-pkgs] new version of QCA

2012-04-10 Thread Adrian Dusa
functions. Most notably, the previous qmcc() function is now obsolete, given that all our tests have shown that eqmcc() yield the same exact results but it's by far superior in speed. A very happy Easter, and happy QCA-ing, Adrian and Alrik -- Adrian Dusa Romanian Social Data Archive 1, Schi

Re: [R] For-loop dummy variables?

2010-10-19 Thread Adrian Dusa
On Tuesday 19 October 2010, Phil Spector wrote: > I always find R useful to solve problems like this: > >dummy = as.numeric(cleary$D1 %in% c(4,6,7)) Indeed, and this works too: dummy <- 1*(cleary$D1 %in% c(4,6,7)) Adrian -- Adrian Dusa Romanian Social Data Archive 1, Schitu

Re: [R] For-loop dummy variables?

2010-10-19 Thread Adrian Dusa
gravityflyer yahoo.com> writes: > > Hi everyone, > > I've got a dataset with 12,000 observations. One of the variables > (cleary$D1) is for an individual's country, coded 1 - 15. I'd like to create > a dummy variable for the Baltic states which are coded 4,6, and 7. In other > words, as a dummy

Re: [R] looking for .. dec if vector if element > x

2010-05-18 Thread Adrian Dusa
p? > test <- c(1, 3, 5, 7, 9) > test[test > 1] <- test[test > 1] - 1 > test [1] 1 2 4 6 8 Adrian -- Adrian Dusa Romanian Social Data Archive 1, Schitu Magureanu Bd. 050025 Bucharest sector 5 Romania Tel.:+40 21 3126618 \ +40 21 3120210 / int.101 Fax: +40 21 3158391 __

Re: [R] Question about factor that is numeric, in aov()

2010-05-09 Thread Adrian Dusa
provides a wrapper to ‘lm’ for fitting linear models to balanced or unbalanced experimental designs. So aov() calls lm(), where it is mighty important whether "group" is numeric or factor. There are both in your mind, but in R you have to declare it as factor in order to treat it

Re: [R] counting the number of times a string appears

2010-01-13 Thread Adrian Dusa
6 > > Is it possible to create a vector of counts for each spp1-spp10? > > Any help or ideas would be appreciated. > > Cheers, > Jesse > > [[alternative HTML version deleted]] > -- Adrian Dusa Romanian Social Data Archive

Re: [R] merging issue.........

2010-01-13 Thread Adrian Dusa
it is SAS, just use the following code: > merge data1(in=in1) data2(in=in2); > by id; > if in1; > > but I really have no idea about how to do it in R. > > thank you in advance, > > karean > -- Adrian Dusa Romanian Social Data Archive 1, Schitu Magureanu Bd.

[R] install.packages error

2009-12-07 Thread Adrian Dusa
space (and not attached): [1] tcltk_2.10.0 tools_2.10.0 Thanks in advance for any hint, Adrian -- Adrian Dusa Romanian Social Data Archive 1, Schitu Magureanu Bd. 050025 Bucharest sector 5 Romania Tel.:+40 21 3126618 \ +40 21 3120210 / int.101 Fax: +40 21 3158391 _

[R] [R-pkgs] New version of QCA

2009-09-20 Thread Adrian Dusa
ready for mvQCA. The QCA package performs the Quine-McCluskey algorithm for Qualitative Comparative Analysis. As usual, any suggestions and bug reports are welcomed. Adrian -- Adrian Dusa Romanian Social Data Archive 1, Schitu Magureanu Bd. 050025 Bucharest sector 5 Romania Tel.:+40

Re: [R] RMySQL - overwrite record, not table

2009-08-24 Thread Adrian Dusa
whizvast wrote: > > Hi, Adrian- > > If you use "overwrite=T" parameter, you will overwrite the entire table, > not each record. this is the essence of my problem and i still haven't > found out right solution. i am thinking of writing my own MySQLwriteTable > function... > > Thank you for your

Re: [R] RMySQL - overwrite record, not table

2009-08-18 Thread Adrian Dusa
whizvast wrote: > > Hi, useR- > > In RMySQL, how do I overwrite records? (equivalent to "replace" query). > For example, suppose that dat2 is a newer data.frame than dat1. > > con <- dbConnect(MySQL()) > res <- dbWriteTable(con, "DBname", dat1, row.names=F, append=T, replace=T) > res <- dbWri

Re: [R] Memory errors when using QCA package

2009-07-23 Thread Adrian Dusa
Allan Engelhardt cybaea.com> writes: > > It is a little stupid, but the length of a vector is limited to 2^31-1 > entries on any platform. A matrix is stored as a vector, so the product > of all dimensions is also limited to 2^31-1. > > Allan. > > Matthew Gwynne wrote: > > Hi, > > > > I have

Re: [R] re ad.table, row.names arg

2009-06-05 Thread Adrian Dusa
Markus Loecher-4 wrote: > > Dear R users, > I had somehow expected that read.table() would treat the column specified > by > the row.names argument as of class character. That seems to be the only > sensible class allowed for a column containing row names. However, that > does > not seem to be

Re: [R] read.table, row.names arg

2009-06-05 Thread Adrian Dusa
Markus Loecher gmail.com> writes: > [...] > > x > ID X1 X2 > 1 010007787048271871 1 4 > 2 1007109516820319 2 3 > 3 10094843652996959 3 2 > 4 010145176274075487 4 1 > > The first column was not read in as a string, which mangled the IDs. > I could use colClasses expli

Re: [R] exporting data to csv file -problem with column names

2009-06-01 Thread Adrian Dusa
Steven Matthew Anderson mac.com> writes: > [...] > Is there a way to exclude the row numbers from the exported csv file? > Or add a column name for row number to keep this from happening? Steven, see the "row.names" argument in write.table(), set it to FALSE. Adrian __

Re: [R] Help needed on R output

2009-05-26 Thread Adrian Dusa
A simpler solution: my.string <- c("", "01001001011011101100", "1001001011010101", "1101110100000011", "000100100101001001011001", "000101101101101001101001") my.string <- paste(my.string, collapse="\",\n

Re: [R] how to implement a circular buffer with R

2009-05-24 Thread Adrian Dusa
Still not elegant, but I would split the string first: spl.str <- unlist(strsplit("12345abcdefgh12345abcdefgh", "")) Measure its length: len.str <- length(spl.str) Shift it: spl.str <- c(spl.str[len.str], spl.str[seq(len.str - 1)]) Then paste it back together: paste(spl.str, collapse="") # "h1

Re: [R] Row number of minimum value?

2009-05-17 Thread Adrian Dusa
here can I > get the row?? Maybe this helps: which(mycol == min(mycol)) where "mycol" is your column. Hth, Adrian -- Adrian Dusa Romanian Social Data Archive 1, Schitu Magureanu Bd. 050025 Bucharest sector 5 Romania Tel.:+40 21 3126618 \ +40 21 3120

Re: [R] split a character variable into several charac ter variable by a character

2009-04-10 Thread Adrian Dusa
t; >> strsplit(d1$name, " ") > >[[1]] >[1] "Bill" "Dunlap" > >[[2]] >[1] "First" "Last" > > Bill Dunlap > TIBCO Software Inc - Spotfire Division > wdunlap tibco.com > >

Re: [R] split a character variable into several character variable by a character

2009-04-10 Thread Adrian Dusa
; and "01". I need to know how > to do that. I have tried strsplit() and substring() functions. But, I still > can not perform the spliting. > > Any advice? Thanks in advance. > > df1: > popcode codetot p3need > BCPy01-01 BCPy01-01-1 100. > BCPy01-01 BCPy01-01

Re: [R] Random sampling based on the observations

2009-03-24 Thread Adrian Dusa
> but on the values of the variables that is the random sample will be based > on the observations. It will be great if someone can help me out me out with > a proper syntax. Thanks in Advance. I think you need to read the help for: ?"[" and most probably one of the introduc

Re: [R] How to write a function that accepts unlimited number of input arguments?

2009-03-10 Thread Adrian Dusa
ay sum.test, can do > > (1+2+3+4+5)==sum.test(1,2,3,4,5) > > > > Also sum.test can work as the number of input scalar changes. > > > > Many thanks in advance! -- Adrian Dusa Romanian Social Data Archive 1, Schitu Magureanu Bd. 050025 Bucharest sector 5 Romania

Re: [R] Dropping rows conditionally

2009-03-04 Thread Adrian Dusa
;,"row6","row7"), c("C.1", "C.2", "C.3"))) > mdat<-data.frame(mdat) > mdat > > C.1 C.2 C.3 > row1 1 2 3 > row2 4 5 6 > row3 7 8 9 > row4 10 11 12 > row5 13 14 15 > row6 16 17 18 >

Re: [R] [R-pkgs] New package: exams - Automatic Generation of Standardized Exams

2009-02-23 Thread Adrian Dusa
age - are presented to get new users started easily. > > Best, > Bettina > > ___ > R-packages mailing list > r-packa...@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-packages -- Adrian Dusa Romanian Social Data Archive 1

Re: [R] sas.get under Linux

2009-02-03 Thread Adrian Dusa
On Monday 02 February 2009, Frank E Harrell Jr wrote: > > [...] > > Stat/Transfer has a menu option to read the SAS format catalog but I > haven't tried it. Been there, done that... didn't get the t-shirt though. I tried everything I believe, but with no avail. Thanks

Re: [R] sas.get under Linux

2009-02-02 Thread Adrian Dusa
://dullesopen.com/> > if you need just base SAS. Acually... no. I don't plan to use SAS in the future (I use R! :), just need it for the moment to extract some value labels. Best wishes, Adrian -- Adrian Dusa Romanian Social Data Archive 1, Schitu Magureanu Bd. 050025 Bucharest s

Re: [R] sas.get under Linux

2009-02-02 Thread Adrian Dusa
miss because value labels are not there, whatever I do... Thanks for your help, Adrian On Saturday 31 January 2009, Frank E Harrell Jr wrote: > Adrian Dusa wrote: > > Dear all, > > > > I am trying to import a SAS file into R (in fact I only need the value > > label

[R] sas.get under Linux

2009-01-31 Thread Adrian Dusa
is there another function to import the formats into R? Thanks in advance for any hint, Adrian -- Adrian Dusa Romanian Social Data Archive 1, Schitu Magureanu Bd. 050025 Bucharest sector 5 Romania Tel.:+40 21 3126618 \ +40 21 3120210 / int.101 Fax: +40 21 3158

Re: [R] QCA adn Fuzzy

2008-12-23 Thread Adrian Dusa
8, ronggui wrote: > Dear Gott and Prof Adrian DUSA , > > I am learning fuzzy set QCA and recently, I just write a function to > construct a truthTable, which can be passed to QCA:::eqmcc to do the > Boolean minimization. The function is here: > http://code.google.com/

Re: [R] sliding window over a large vector

2008-12-16 Thread Adrian Dusa
tained, reproducible example? When writing a function, it is indicated not to use reserved commands like "seq" (which is a function itself, generating a sequence of numbers). In any case, I suspect you might want to take a look on the function "rle". See ?rle I hope this

[R] SPSSyntax function

2008-11-26 Thread Adrian Dusa
Dear all, I've created a function called "spssyntax" that creates a syntax for variable labels and value labels in SPSS (in the *sps* syntax format that was recently discussed), using a list of such labels in R. The entry list looks like this (between the ### signs): ### labels <- list() labels$

Re: [R] [R-pkgs] RQDA-0.1.5 is released

2008-11-25 Thread Adrian Dusa
void using tree-like categorization > # There is a case category, which is crucial feature to bridge > qualitative and quantative research > # Search information about selected case from the Internet vis popup menu > # Temporary delete files and codes > # Rename the files,code, code category,

Re: [R] remove levels from a factor

2008-08-30 Thread Adrian Dusa
Adrian Dusa gmail.com> writes: > > [...snip...] > > f[which(f %in% names(table(f))[table(f) >= 2]), drop=TRUE] > [1] a a > Levels: a Or, more simple: > f[f %in% names(table(f))[table(f) >= 2], drop=TRUE] [1] a a Levels: a Adrian _

Re: [R] remove levels from a factor

2008-08-30 Thread Adrian Dusa
Yuan Jian yahoo.com> writes: > [...snip...] > > I want to remove level b because level b has less than 2. > > f > [1] a a > Levels: a > f[which(f %in% names(table(f))[table(f) >= 2]), drop=TRUE] [1] a a Levels: a HTH, Adrian __ R-help@r-project.or

Re: [R] How to repress the annoying complains from X window system

2008-08-12 Thread Adrian Dusa
just to catch them but they seem to have vanished. Really sorry I can't offer more information, but I will try to keep a more detailed log of my actions and if I do stumble upon them I will report back. In the mean time, enjoy useR. Best wishes, Adrian -- Adrian Dusa Romanian Social D

Re: [R] How to repress the annoying complains from X window system

2008-08-11 Thread Adrian Dusa
t; X11 protocol error: BadWindow (invalid Window parameter) > |> > |> > R.version > |> > |>_ > |> platform i486-pc-linux-gnu > |> arch i486 > > Is that a pre-Pentium machine?? Nope, quite the contrary. It's a HP mobile workstati

Re: [R] Change language in Rcmdr

2008-07-08 Thread Adrian Dusa
, Rcmdr will be opened in French. Best, Adrian -- Adrian Dusa Romanian Social Data Archive 1, Schitu Magureanu Bd. 050025 Bucharest sector 5 Romania Tel.:+40 21 3126618 \ +40 21 3120210 / int.101 Fax: +40 21 3158391 signature.asc Description: This is a digital

Re: [R] Subsetting to unique values

2008-06-06 Thread Adrian Dusa
Emslie, Paul [Ctr] atac.mil> writes: > > I want to take the first row of each unique ID value from a data frame. > For instance > > ddTable <- > data.frame(Id=c(1,1,2,2),name=c("Paul","Joe","Bob","Larry")) > > I want a dataset that is > IdName > 1 Paul > 2 Bob > > > unique(ddTable

Re: [R] best text editor for Linux?

2008-02-03 Thread Adrian Dusa
ping it like that, I might actually switch (for the moment I use the good old jEdit). Hope it helps, Adrian -- Adrian Dusa Romanian Social Data Archive 1, Schitu Magureanu Bd. 050025 Bucharest sector 5 Romania Tel./Fax: +40 21 3126618 \ +40 21 3120210 / int.101 signat

Re: [R] Trouble receiving messages from the mailing list

2008-01-18 Thread Adrian Dusa
t I dare say the rest of us can > live with that. I certainly could. One possible solution is to digitally sign the message, but there are probably few people who know about PGP and its benefits... Adrian -- Adrian Dusa Romanian Social Data Archive 1, Schitu Magureanu Bd. 050025 Bucha

Re: [R] connecting [logging] RMySQL to an external server - SOLVED

2007-12-19 Thread Adrian Dusa
y after that connect to the remote MySQL server. I hope my situation is more clear now, Adrian -- Adrian Dusa Romanian Social Data Archive 1, Schitu Magureanu Bd 050025 Bucharest sector 5 Romania Tel./Fax: +40 21 3126618 \ +40 21 3120210 / int.101 __

Re: [R] connecting [logging] RMySQL to an external server - SOLVED

2007-12-19 Thread Adrian Dusa
chine (a secure login using ssh), forwarding the MySQL port 3306 to the local port 3307 (not to interfere with the local MySQL server), and connecting R to the remote MySQL server using the ssh tunneling binded to local port 3307. Best, Adi -- Adrian Dusa Romanian Social Data Archive 1, Schitu

Re: [R] connecting [logging] RMySQL to an external server - SOLVED

2007-12-19 Thread Adrian Dusa
d mysqlpassword are the remote machine's MySQL username and password). Another possible solution is suggested by Prof. Ripley, using stunnel to create a secure tunnel between the local and the remote machines, but I haven't explored that in detail. Best wishes, Adrian -- Adrian

Re: [R] read.table and double quotes in strings

2007-12-16 Thread Adrian Dusa
On Sunday 16 December 2007, Adrian Dusa wrote: > Dear all, > > [...] > > Given these examples, I have two questions: > 1. What is the correct syntax to import the R-exported file > 2. What can I do to prevent these situations from happening? > (besides whipping the da

[R] read.table and double quotes in strings

2007-12-16 Thread Adrian Dusa
like this: ### StatTransfer export "id""var1" 1 "some "" quote" 2 "without quote" ### Given these examples, I have two questions: 1. What is the correct syntax to import the R-exported file 2. What can I do to prevent these situati

Re: [R] connecting RMySQL to and external server

2007-12-15 Thread Adrian Dusa
nguage for me (at the moment) but I'm sure your hints will be relevant to our sysadmin. I do want to understand this stuff myself, just need more digging in the manuals. Cheers, Adrian -- Adrian Dusa Romanian Social Data Archive 1, Schitu Magureanu Bd 050025 Bucharest sector 5 Romani

Re: [R] connecting RMySQL to and external server

2007-12-15 Thread Adrian Dusa
On Saturday 15 December 2007, Prof Brian Ripley wrote: > On Sat, 15 Dec 2007, Adrian Dusa wrote: > > Indeed, I noticed the "host" argument but the server demands an username > > and a password for the machine first, > > But you said 'connect to', not

Re: [R] connecting RMySQL to and external server

2007-12-15 Thread Adrian Dusa
drv, user="ripley", host="auk", dbname="ripley") > > This mixture of using the *local* configuration file overridden by > arguments is a bit dangerous: RMySQL seems not really designed for > client-server operation and there are some things that definitely

[R] connecting RMySQL to and external server

2007-12-14 Thread Adrian Dusa
possible from within R? Thank you in advance, Adrian -- Adrian Dusa Romanian Social Data Archive 1, Schitu Magureanu Bd 050025 Bucharest sector 5 Romania Tel./Fax: +40 21 3126618 \ +40 21 3120210 / int.101 __ R-help@r-project.org mailing lis

Re: [R] Dot plots in R

2007-11-26 Thread Adrian Dusa
ieve what Paul wants is better suited by the DOTplot() function from the UsingR package: it looks exactly the same as the web image and it has no axes, as Paul wants in a later message. x <- sample(1:10, 30, replace=T) library(UsingR) DOTplot(x) Hth, Adrian -- Adrian Dusa Romanian Social

Re: [R] expand.grid overflows?

2007-11-18 Thread Adrian Dusa
pply(cbn.rownos, function(x) { return(sum(getRow(rep(2, nofcolumns), x)) == 5) }) # this will be _very_ slow, as it checks each row number (in its binary # equivalent, see ?getRow) if it's sum is equal to 5 # then what you want is: cbn <- getRow(rep(2, nofcolumns), cbn.rownos[eq5]) I ho

Re: [R] generate combination set

2007-11-16 Thread Adrian Dusa
ding the list) your solution doesn't arrive in my Inbox but until the next day. Best, Adrian -- Adrian Dusa Romanian Social Data Archive 1, Schitu Magureanu Bd 050025 Bucharest sector 5 Romania Tel./Fax: +40 21 3126618 \ +40 21 3120210 / int.101 __

Re: [R] generate combination set

2007-11-16 Thread Adrian Dusa
ot;AG" "BC" "BD" "BE" "BF" "BG" "CD" "CE" > "CF" "CG" > [16] "DE" "DF" "DG" "EF" "EG" "FG" Chapeau... Adrian -- Adrian Dusa Romanian

Re: [R] generate combination set

2007-11-15 Thread Adrian Dusa
essage- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > On Behalf Of [EMAIL PROTECTED] > Sent: Thursday, 15 November 2007 2:51 PM > To: r-help@r-project.org > Subject: [R] generate combination set > > I have a set data={A,B,C,D,E,F,G} > I want to choose 2 letter

Re: [R] generate combination set

2007-11-15 Thread Adrian Dusa
On Thursday 15 November 2007, [EMAIL PROTECTED] wrote: > Actually, (now that I know about combn), a better way is > > t(matrix(set[combn(7,2)], nrow = 2)) Indeed, or to avoid transposing: matrix(set[combn(7,2)], ncol = 2, byrow=T) Adrian -- Adrian Dusa Romanian Social Data Archive

Re: [R] list matching

2007-10-07 Thread Adrian Dusa
n/viewcvs.php/*checkout*/ >pkg/R/merge.zoo.R?rev=361&root=zoo") > > as.vector(time(do.call(merge, c(lapply(aa, function(x) zoo(,x)), all = > FALSE Yeap, that fixes it. Ah-haa, so all = FALSE is merge()s argument... Neat :) Adrian -- Adrian Dusa Romanian Social Data Arc

Re: [R] list matching

2007-10-07 Thread Adrian Dusa
everything is up to date here, too. I'm using Kubuntu Linux and the latest versions of R and zoo: > R.version.string [1] "R version 2.6.0 (2007-10-03)" > packageDescription("zoo")$Version [1] "1.3-2" Adrian -- Adrian Dusa Romanian Social Data Archive

Re: [R] list matching

2007-10-06 Thread Adrian Dusa
t of lapply() is a list; when performing c() over that list, the argument all = FALSE does nothing but to add another branch... hmm, I should really use more time series... Adrian -- Adrian Dusa Romanian Social Data Archive 1, Schitu Magureanu Bd 050025 Bucharest sector 5 Romania Tel./Fax:

Re: [R] list matching

2007-10-06 Thread Adrian Dusa
gt; > L > > $a > [1] "a" "b" "b" > > $b > [1] "d" "b" "a" > > $c > [1] "d" "a" > > So: > > intersectList(aa) > > [1] "e" > > > intersectList(L) > >

[R] list matching

2007-10-06 Thread Adrian Dusa
n between the result and the third) but... perhaps there is a better and quicker way. Thanks in advance, Adrian -- Adrian Dusa Romanian Social Data Archive 1, Schitu Magureanu Bd 050025 Bucharest sector 5 Romania Tel./Fax: +40 21 3126618 \ +40 21 3120210 / int.101 __

Re: [R] Adding a table to a plot area

2007-09-24 Thread Adrian Dusa
Frank E Harrell Jr vanderbilt.edu> writes: > Judith Flores wrote: > > Is there a command to insert a table into the plot > > area other that using text? > > > > Thank you. > > To me the only completely satisfying approach is to use LaTeX and psfrag > in you want great alignment and other featur

Re: [R] Performance problems to fill up a dataframe

2007-09-24 Thread Adrian Dusa
} > m[is.na(m)] <- 0 > > Now I'm trying to prevent the loop, because it take ages for a list of > 2 entries, but I run out of ideas. > Should I inflate my list beforehand and how? Can I adress the dataframe > fields more effieciently? > > Thanks for your help

Re: [R] programming question

2007-09-17 Thread Adrian Dusa
2)) user system elapsed 12.093 0.000 12.095 With 14 input variables my function takes 24 seconds to complete, and I'd like to process 20 such input variables (their complexity grow exponentially)... Thanks again, Adrian -- Adrian Dusa Romanian Social Data Archive 1, Schitu Magureanu B

[R] programming question

2007-09-16 Thread Adrian Dusa
t <- increment(element, mbase[i]) } return(element[-1]) } position <- 1 while(position < length(myvec)) { falsevector <- findSubsets2(myvec[position]) myvec <- setdiff(myvec, falsevector) position <- position + 1 } -- Adrian Dusa Romanian Social Data Archiv