[R] exp / log scaled version of cut?

2022-02-03 Thread Fredrik Karlsson
. Is there one? Thanks! Fredrik Karlsson -- "Life is like a trumpet - if you don't put anything into it, you don't get anything out of it." [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more,

Re: [R] Variable labels

2021-05-13 Thread Fredrik Karlsson
Hi, I am sorry but I don't understand your question, Generally, "clicking" is not something you can assume to be implemented for anything in R. However, if you read the manual for the package https://gdemin.github.io/expss/ you get an example at the bottom where an illustration of how the

Re: [R] Problem with loop in folders

2020-04-25 Thread Fredrik Karlsson
Hi, I am sorry if I am misunderstanding what you are trying to do here, but can you simplify it this way? (unfortualtely, this is untested since I dont have a suitable set of files and a directory structure to test against) dbifiles <- list.files(pattern="*.dbi",recursive=TRUE) csvfiles <-

Re: [R] Creating Dummy Var in R for regression?

2016-08-08 Thread Fredrik Karlsson
Hi, please also have a look at the 'cut' function.Very handa function for these types of situations. Best, Fredrik On Sun, Aug 7, 2016 at 8:10 PM, Shivi Bhatia wrote: > Thank you Jeremiah and all others for the assistance. This really helped. > > On Sat, Aug 6, 2016 at

[R] L1 penalized regression fails to predict from model

2016-06-20 Thread Fredrik Karlsson
Dear list, Sorry for this cross-post from StackOverflow, but I see that SO was maybe the wrong forum for this question. Too package specific and Ok, what I am trying to do is to predict from an L1 penalized regression. This falls due to a data set dimension problem that I cannot figure out. The

[R] ggplot: geom_line with only pairs of points connected

2012-12-12 Thread Fredrik Karlsson
Dear list, I've been using plotmeans {gplots} a lot before, and found the connect argument to be quite useful. I've moved to ggplot for several reasons, but would still like to connect lines conditionally, somehow. Is it possible to do? Small example: df -

Re: [R] Math labels in .eps files

2012-06-05 Thread Fredrik Karlsson
Dear Professor Ripley, Thank you for your prompt answer. Indeed, cairo_ps solved the problem for me. Thank you! Fredrik 5 jun 2012 kl. 11:51 skrev Prof Brian Ripley rip...@stats.ox.ac.uk: On 04/06/2012 17:25, Fredrik Karlsson wrote: Dear list, I have non-ascii labels that I want

Re: [R] Using ddply within a function by argument transfer

2012-03-06 Thread Fredrik Karlsson
, Mar 5, 2012 at 2:11 AM, David Winsemius dwinsem...@comcast.netwrote: On Mar 4, 2012, at 6:28 PM, Fredrik Karlsson wrote: Hi Joshua, Yes, sorry - I attached an .rda file - maybe it was squashed. The old version of the Posting Guide warned readers that only 'txt' files and 'pdf's would

Re: [R] Using ddply within a function by argument transfer

2012-03-04 Thread Fredrik Karlsson
will have to do some processing in order to get the arguments in the right mode/class - but I don't know how. /Fredrik On Sun, Mar 4, 2012 at 6:44 AM, David Winsemius dwinsem...@comcast.netwrote: On Mar 4, 2012, at 12:20 AM, Fredrik Karlsson wrote: Hi Michael, No, sorry - that is neither

Re: [R] Using ddply within a function by argument transfer

2012-03-04 Thread Fredrik Karlsson
are planning to have some other stuff go on in the real testfun(). Cheers, Josh On Sun, Mar 4, 2012 at 9:06 AM, Fredrik Karlsson dargo...@gmail.com wrote: Hi, Sorry all - I will provide a reproducable version of this. I am still seeing the same problem - maybe it is due to me having to use

[R] Using ddply within a function by argument transfer

2012-03-03 Thread Fredrik Karlsson
Dear list, Sorry, but I cannot get my head around how and I could pass arguments along to high-level functions. What I have is a function that would benefit from me using ddply from the plyr package. However, I cannot get the arguments passing part right. So, this is my function:

Re: [R] Using ddply within a function by argument transfer

2012-03-03 Thread Fredrik Karlsson
be simpler than that: suspicious.vowels(pb,c(Type,Sex,Vowel),F1,F2) Note that F1 is in quotes but F2 isn't. Michael On Sat, Mar 3, 2012 at 5:46 PM, Fredrik Karlsson dargo...@gmail.com wrote: Dear list, Sorry, but I cannot get my head around how and I could pass arguments along

[R] Multiple comparisons of lme model - interactions?

2012-02-10 Thread Fredrik Karlsson
Dear list, Please excuse my ignorance, but I'm trying to model some data using the lme package. vot is a numeric response, and condition, location and obs are all categories. This works: anova(vot.lme - lme(vot ~ condition * location * obs,data=mergedCodesL,random= ~1 |patient))

[R] Finding suspicious data points?

2012-01-26 Thread Fredrik Karlsson
Dear list, I would like to find data points that at least should be checked one more time before I process them further. I've had a look at the outliers package for this, and the outliers function in that package, but it appears to only return one value. An example:

Re: [R] Constructing an additional key inside of a lattice panel

2011-08-18 Thread Fredrik Karlsson
deepayan.sar...@gmail.comwrote: On Tue, Aug 16, 2011 at 4:35 PM, Fredrik Karlsson dargo...@gmail.com wrote: Hi, I would like to add an additional key inside of a panel based on a factor that is not the groups argument. I've tried using the panel.key function in latticeExtras, but I cannot get

Re: [R] Constructing an additional key inside of a lattice panel

2011-08-17 Thread Fredrik Karlsson
at 1:05 PM, Fredrik Karlsson dargo...@gmail.comwrote: Hi, I would like to add an additional key inside of a panel based on a factor that is not the groups argument. I've tried using the panel.key function in latticeExtras, but I cannot get the line types the way I want it. Using my factor

[R] Constructing an additional key inside of a lattice panel

2011-08-16 Thread Fredrik Karlsson
Hi, I would like to add an additional key inside of a panel based on a factor that is not the groups argument. I've tried using the panel.key function in latticeExtras, but I cannot get the line types the way I want it. Using my factor myGroups, I've tried this:

[R] current.panel.limits() of lattice returning NaN limits - why?

2011-08-12 Thread Fredrik Karlsson
Hi, I need a custom axis function for a plot, but it seems that current.panel.limits() sometimes returns NaN limits for the plot, which it much harder to calculate anything sensible. An illustration: Given this axis function: vs.axis - function(...){ xlim - current.panel.limits()$xlim

[R] Passing on groups argument to xyplot within a plotting function

2011-08-11 Thread Fredrik Karlsson
Hi, I am constructing a plotting function that I would like to behave like plotting functions within the lattice package. It takes a groups argument, which I process, and then I would like to pass that argument on to the xyplot function for the actual plotting. However, what ever I do, get an

[R] How do I make proper use of the by() function?

2011-06-10 Thread Fredrik Karlsson
Dear list, I have a function that uses values from two vectors and spits out one new vector based on all the values of the two original vectors, and with the same length as them. Ok, I would now like to be able to apply that function simply on two columns in a data frame, divided by the levels

[R] Display data.frame as tree?

2011-05-17 Thread Fredrik Karlsson
Dear list, I have a data.frame with aggregated frequencies of occurrence of two-way (and in one case three-way) features in my observations. Like this: location condition transient fricationmrallvoiced correctstop vpresent frequency 1 STNPOSTON TRUE FALSE FALSE

[R] How to reshape wide format data.frame to long format?

2011-01-20 Thread Fredrik Karlsson
Dear list, I need to convert this data.frame names(codesM) [1] keyAMR.pa1.M AMR.pa2.M AMR.pa3.M AMR.pa4.M [6] AMR.pa5.M AMR.pa6.M AMR.pa7.M AMR.pa8.M AMR.pa9.M [11] AMR.pa10.M AMR.ta1.M AMR.ta2.M AMR.ta3.M AMR.ta4.M [16] AMR.ta5.M AMR.ta6.M AMR.ta7.M AMR.ta8.M AMR.ta9.M

Re: [R] Any way to apply TWO functions with tapply()?

2010-05-07 Thread Fredrik Karlsson
Hi, What you can do is define your own function which takes a vector of values, computes the statistics you want and then returns a string which displays the output the way you want it. Then use this function in your tapply call. like (untested) mySummary - function(x) {

Re: [R] Converting dollar value (factors) to numeric

2010-05-05 Thread Fredrik Karlsson
Hi, Something similar to this maybe? test - as.factor($111.11) test [1] $111.11 Levels: $111.11 as.numeric(substring(as.character(test),2)) [1] 111.11 To be applied to your data.frame columns. /Fredrik On Wed, May 5, 2010 at 9:16 AM, Wang, Kevin (SYD) kevinw...@kpmg.com.au wrote: Hi,

[R] Best option for exporting data frame to SPSS?

2009-09-01 Thread Fredrik Karlsson
Dear list, I am leaving my old position and now need to convert my R data frames into a format that can be used by an SPSS user replacing me, without running into conversion problems. The data set consists of strings in UTF8 encoding and values in double precision floats. The data set is not

[R] Surpress one panel in lattice plot..?

2009-08-23 Thread Fredrik Karlsson
Dear list, I have a two character vector with two different values in them (two each, that is). Naturally, when I use these vectors as grouping factors in a lattice plot, I get four panels. Now, one of the possible four combinations will never have data, so one panel will always be empty. So now

Re: [R] Selecting groups with R

2009-08-21 Thread Fredrik Karlsson
Hi John, I would guess that your Color column is a factor, with three levels (RED,BLUE,WHITE), which means that they will all be included in the output of a table() call, even if they are empty. Try dataset - transform(dataset, Color=as.character(Color)) or something similar and then create the

Re: [R] Stata file Import and Analysis in R

2009-06-29 Thread Fredrik Karlsson
Hi, You should install the foreign package and try the read.dta function. I don't know whether the size of your fiel will be a problem, but you would try it at least. /Fredrik On Mon, Jun 29, 2009 at 1:58 PM, saurav pathakpathak.sau...@gmail.com wrote: Hi I have a  stata data set (.dta file)

[R] How do I get just the two last tokens of each string in a vector?

2009-06-26 Thread Fredrik Karlsson
Dear list, Sorry for asking this very silly question on the list, but I seem to have made my life complicated by going into string manipulation in vectors. What I need is to get the last part of a sting (the two last tokens, separated by a space), and of course, this should be done for all

Re: [R] How do I get just the two last tokens of each string in a vector?

2009-06-26 Thread Fredrik Karlsson
(tail(.tokens, 2), collapse=' ')) [1] L*H H% H* H%  L*H %  L*H % On Fri, Jun 26, 2009 at 7:21 AM, Fredrik Karlsson dargo...@gmail.com wrote: Dear list, Sorry for asking this very silly question on the list, but I seem to have made my life complicated by going into string manipulation

[R] Lattice group colors?

2009-06-22 Thread Fredrik Karlsson
Dear list, I have been struggling to find how I would go about changing the bakground colors of groups in a lattice barchart in a way so that the auto.key generated also does the right thing and pick it up for the key. I have used the col argument (which I guess is sent to par()) in a way so that

[R] Urgent - odfWeave produces graphs /images with Read-Error

2009-06-17 Thread Fredrik Karlsson
Dear list, I have been working on a report with around 60 images in it, and everything has been fine, until now. I find that the image output that is produced by odfWeave produces images that are NOT readable by OpenOffice or NeoOffice. I get empty boxes with Read-Error written in them. While

[R] Fwd: Urgent - odfWeave produces graphs /images with Read-Error

2009-06-17 Thread Fredrik Karlsson
-- Forwarded message -- From: Fredrik Karlsson dargo...@gmail.com Date: Wed, Jun 17, 2009 at 11:10 AM Subject: Re: [R] Urgent - odfWeave produces graphs /images with Read-Error To: Ronggui Huang ronggui.hu...@gmail.com Hi Ronggui, Thank you for this! In some of the graphs

Re: [R] Creating a variable which is the sum of equal rows in a dataframe

2009-05-04 Thread Fredrik Karlsson
Hi Cecilia, You can use table for this: #Generate a dataframe dat.df - data.frame(Firm = sample(c(500600700,500600800,500600800),6,replace=TRUE),Banks=sample(c(Citybank,CGD,DES,Bank1),6,replace=TRUE) ) #Get the counts in a table format with(dat.df, table(Firm,Banks)) Banks

[R] Retrieving the context

2009-03-30 Thread Fredrik Karlsson
Dear list, I have a general problem that I really don't know how to solve efficiently in R. Lets say we have a sequence of things, like for instance a string of words, that is stored in a file. We need all the words in a table format, so therefore we create an id for the word, that links the word

Re: [R] Analogy for %in% for the whole columns (rather than individual values)

2009-03-26 Thread Fredrik Karlsson
Hi Dimitri, What about this: with(a, x == y) - a$equal a xy equal 1 john mary FALSE 2 mary mary TRUE 3 mary john FALSE 4 john john TRUE /Fredrik On Thu, Mar 26, 2009 at 7:48 PM, Dimitri Liakhovitski ld7...@gmail.comwrote: Hello! I have a matrix a with 2 variables (see below)

[R] ANOVA and TukeyHSD disagrees?

2009-03-20 Thread Fredrik Karlsson
Dear list, Sorry for posting a borderline statistical question on the list, but hte SPSS people around me just stares at me blankly when refering to tests with any term other than ANOVA and post-hoc. I would appreciate any insight on how this all is possible: I have a model fitted by aov()

Re: [R] odfWeave : change of text style of output is ignored

2009-03-20 Thread Fredrik Karlsson
of sessionInfo() after starting odfWeave. Max On Fri, Mar 20, 2009 at 11:03 AM, Fredrik Karlsson dargo...@gmail.com wrote: Dear list, The output of my embedded code sections come out in the style ttBlue wich is Times New Roman and Blue when I open document. I would like to change

[R] Last char of a string in a list - list of strings

2009-03-18 Thread Fredrik Karlsson
Dear list, This seems like a very simple problem, but I am failing to loose a dimension (I think). I have list, like this: ... [2072] !H*L L% %L H*L L% %L H*L H*L L% %L H*L !H*L L% %L %L %L %L H*L !H*L [2091] L% H* %L H*L L_% %L %H %H !H*L %H H* %H %H

Re: [R] Last char of a string in a list - list of strings

2009-03-18 Thread Fredrik Karlsson
) sub(.*([^*_!%0])[*_!%0]*$, \\1, x)  [1] L L L L L L L L L L L L L L L L L L L L H L L L L H H L H H H H H H L L L H [39] L L L L L H H H H H H L H L L H L L L L L L L L L L L H L L On Wed, Mar 18, 2009 at 11:10 AM, Fredrik Karlsson dargo...@gmail.com wrote: Dear list, This seems like a very

[R] odfWeave problem Error in xmlEventParse

2009-02-24 Thread Fredrik Karlsson
Dear list, Sorry for bothering you with a pure odfSweave question, but I just ran into a problem that I cannot find the cause of. Anyonse seen this before? This file used to work, but not anymore. Would apreciate all the help I could get. /Fredrik

[R] Grouped bwplots?

2009-02-20 Thread Fredrik Karlsson
Dear list, I am sorry for asking you this, but I am trying to do again what I thought I have done before, although this time it does not work. So, given the data set: testdf - data.frame(grfak=sample(c(One,Two),size=100,replace=TRUE), panfak= sample(c(Yes,No),size=100,replace=TRUE), xfak=

[R] Grayscale figures in odfWeave?

2009-01-12 Thread Fredrik Karlsson
Dear list, I am sorry if this is a FAQ, but I have just started using odfWeave for report construction and it seems not to behave exactly like Sweave. I want to get my figures in grayscale, but the tip given in the FAQ of Sweave http://www.stat.uni-muenchen.de/~leisch/Sweave/FAQ.html#x1-1A.8

[R] Change in Lattice bwplot?

2008-12-16 Thread Fredrik Karlsson
Dear list, Sorry for asking this question, but has something changed in the syntax for bwplot in Lattice? In an old publication, I used bwplot( VOTMS ~gender |type * group, data=merge(vot,words,by=ord), nint=30, horizontal=F, layout=c(3,3),

[R] TukeyHSD and 0.0000000

2008-11-05 Thread Fredrik Karlsson
Dear list, Sorry to ask you this, but I just ran a TukeyHSD on an model with a two thee level factors as independent variables and a numeric score dependent variable. The aov gives a significant interaction effect, and using the TukeyHSD, I get almost every row to be exactly 0.000. Should I

Re: [R] TukeyHSD and 0.0000000

2008-11-05 Thread Fredrik Karlsson
2.1684662 0.000 German:German-Belfast:German2.98766407 2.67639017 3.2989380 0.000 German:German-L2:German 1.06769554 0.81905292 1.3163382 0.000 /Fredrik On Wed, Nov 5, 2008 at 1:15 PM, hadley wickham [EMAIL PROTECTED] wrote: On Wed, Nov 5, 2008 at 5:42 AM, Fredrik Karlsson

[R] Reversed but positive axis in trellis plots?

2008-03-05 Thread Fredrik Karlsson
Hi, In my discpipline, it is common to plot one acoustic property on a positive scale but from top to bottom on the ordinate and the same for another measurement on the abscissa. So, the origin of the plot is on the top right of the plot, with increasing values to the left /down. This is to