[R] Banner using R

2019-01-15 Thread Luca Meyer
Hi, I am a bit rusty with R programming and I would appreciate some assistance with the following. I have a dataset like: Data <- data.frame(v1 = c('A', 'B' ,'B' ,'A', 'B'), v2 =c('A', 'B', 'A', 'A', 'B'), v3 = c('A', 'A', 'A', 'A', 'A’)) How can I get a banner of the sort? Count v1 v

Re: [R] How to visualise what code is processed within a for loop

2018-04-30 Thread Luca Meyer
a great deal of memory used. > > Rui Barradas > > On 4/28/2018 10:12 PM, Rui Barradas wrote: > > Hello, > > instead of ifelse, the following is exactly the same and much more > efficient. > > d0[[nm]] <- as.integer(regexpr(d1[i,1], d0$X0) > 0) > >

Re: [R] How to visualise what code is processed within a for loop

2018-04-30 Thread Luca Meyer
; efficient. >> >> d0[[nm]] <- as.integer(regexpr(d1[i,1], d0$X0) > 0) >> >> >> Hope this helps, >> >> Rui Barradas >> >> On 4/28/2018 8:45 PM, Luca Meyer wrote: >> >>> Thanks Don, >>> >>> for (i in

Re: [R] How to visualise what code is processed within a for loop

2018-04-28 Thread Luca Meyer
RUE) , 1:3, 11:13) > [1] 1 12 3 > > Although it works ok for these > > ifelse(TRUE, 3, 4) > [1] 3 > > ifelse(FALSE, 3, 4) > [1] 4 > They are not really what it is intended for. > > -- > Don MacQueen > Lawrence Livermore National Laboratory > 7000 East Ave

Re: [R] How to visualise what code is processed within a for loop

2018-04-24 Thread Luca Meyer
at R does type > conversion for you when you need it) > > HTH > > Bob > > On 24 April 2018 at 09:30, Luca Meyer wrote: > > Hi, > > > > I am trying to debug the following code: > > > > for (i in 1:10){ > > t <- paste("d0$V

[R] How to visualise what code is processed within a for loop

2018-04-24 Thread Luca Meyer
Hi, I am trying to debug the following code: for (i in 1:10){ t <- paste("d0$V",i,sep="") t <- ifelse(regexpr(d1[i,1],d0$X0)>0,1,0) } and I would like to see what code is actually processing R, how can I do that? More to the point, I am trying to update my variables d0$V1 to d0$V10 accordin

[R] How to dynamically add variables to a dataframe

2018-04-22 Thread Luca Meyer
Hi, I am a bit rusty with R programming and do not seem to find a solution to add a number of variables to my existing dataframe. Basically I need to add n=dim(d1)[1] variables to my d0 dataframe and I would like them to be named V1, V2, V3, ... , V[dim(d1)[1]) When running the following code: f

[R] How to integrate a dynamic code within a R script?

2018-03-24 Thread Luca Meyer
Hi, I am working on a script which should includes a dynamic listing, i.e. # SCRIPT BEGINS # some R procedures here # DYNAMIC PART BEGINS d1$X5 <-f1("AAA") d1$X5 <-f1("AAa") d1$X5 <-f1("ABa") # etc... d1$X6 <-f2("AAA") d1$X6 <-f2("AAs") d1$X6 <-f2("ABs") # etc... # DYNAMIC PART ENDS # other pr

[R] Writing text files out of a dataset

2017-12-29 Thread Luca Meyer
Hello, I am trying to run the following syntax for all cases within the dataframe "data" d1 <- data[1,c("material")] fileConn<-file("TESTI/d1.txt") writeLines(d1, fileConn) close(fileConn) I am trying to use the for function: for (i in 1:nrow(data)){ d[i] <- data[i,c("material")] fileConn<

Re: [R] R and Supervised learning

2017-10-02 Thread Luca Meyer
Hi Bert, Thank you for your useful suggestions I will follow them and come back to this list with any specific R code issue I might have. Kind regards, Luca 2017-10-02 16:57 GMT+02:00 Bert Gunter : > Luca: > > 1. We are not a consulting service. We *help* with R pogramming issues. > Users are

[R] R and Supervised learning

2017-10-02 Thread Luca Meyer
Hi, I am currently find myself selecting manually amoungts several hundreds Google Alerts (GA) texts those that are indeed relevant for my research vs those which are not (despite they are triggered by some relevant seach keywords). Basically each week I get several hundreds GA email such as: ht

[R] How do I best create a R procedure from a R file?

2017-02-08 Thread Luca Meyer
Hi, I am working on the following file: > str(elencositi) 'data.frame':641 obs. of 2 variables: $ indirizzo.sito: chr "10ahora.com.ar" "abceconomia.co" "accmag.com" " actu.orange.fr" ... $ nome.sito : chr "10ahora" "ABC economia" "Acc Magazine" "Orange Actu" ... > head(elencositi)

Re: [R] Script/function/procedure with loop

2016-07-11 Thread Luca Meyer
te$varA[j], "\n") > cat(thisdate$varB[j], "\n\n") > } > } > > This code prints to screen: > > 07-jul-16 > > text A1 > link B1 > > text A2 > link B2 > > text A3 > link B3 > > 08-jul-16 > > text A4 > link B4 > &g

[R] Script/function/procedure with loop

2016-07-11 Thread Luca Meyer
Can anyone point me to an R script/function/procedure which, starting from the following sample data #sample data #NB: nrow(df) is variable date = c("07-jul-16","07-jul-16","07-jul-16","08-jul-16","08-jul-16","08-jul-16","09-jul-16","09-jul-16") varA = c("text A1","text A2","text A3","text A4","t

Re: [R] Assistance with httr package with R version 3.3.0

2016-05-10 Thread Luca Meyer
a dependency in httr for XML > (although xml2 is suggested). > > Jim > > > On Tue, May 10, 2016 at 2:58 PM, Luca Meyer wrote: > > Hello, > > > > I am trying to run a code I have been using for a few years now after > > downloading the new R version 3.3.0

[R] Assistance with httr package with R version 3.3.0

2016-05-09 Thread Luca Meyer
Hello, I am trying to run a code I have been using for a few years now after downloading the new R version 3.3.0 and I get the following error: > rm(list=ls()) > library(httr) > > #carico i dati da Google spreadsheets > url <- " https://docs.google.com/spreadsheets/d/102-jJ7x1YfIe4Kkvb9olQ4chQ_TS

Re: [R] [FORGED] How to remove the grid around the plot(ca(...)) function?

2015-10-09 Thread Luca Meyer
whichever bits you want > grid.remove("axis", grep=TRUE, global=TRUE) > grid.remove("box", grep=TRUE) > grid.remove("abline", grep=TRUE, global=TRUE) > > Paul > > On 09/10/15 07:06, Luca Meyer wrote: > >> Hello R-experts, >> >>

[R] How to remove the grid around the plot(ca(...)) function?

2015-10-08 Thread Luca Meyer
Hello R-experts, Could anyone suggest how I can remove the grid coming out of the plot(ca(...)) function? For instance I have: library(ca) v1 <- c(10,15,20,15,25) v2 <- c(23,4,7,12,2) v3 <- c(10,70,2,3,7) d1 <- data.frame(v1,v2,v3) rownames(d1) <- c("B1","B2","B3","B4","B5") plot(ca(d1), mass =

Re: [R] Joining two datasets - recursive procedure?

2015-03-23 Thread Luca Meyer
odified marginal distributions > aggregate(v4~v1*v2,f1,sum) v1 v2 v4 1 A A 19.61447 2 B A 3.50662 3 A B 4.49592 4 B B 3.94707 5 A C 0.00315 6 B C 0.0 > aggregate(v4mod~v1*v2,f1,sum) v1 v2v4mod 1 A A 1.145829e+01 2 B A 1.600057e+00 3 A B 6.219326e-

Re: [R] Joining two datasets - recursive procedure?

2015-03-23 Thread Luca Meyer
1$v4mod <- ifelse (f1$v1=="A" & f1$v2=="B" & f1$v3=="C", f1$v4+(tAB*f1$dif), f1$v4mod) f1$v4mod <- ifelse (f1$v1=="A" & f1$v2=="C" & f1$v3=="B", f1$v4+(tAC*f1$dif), f1$v4mod) f1$v4mod <- ifelse (f1$v1=="A" &a

Re: [R] Fwd: Joining two datasets - recursive procedure?

2015-03-22 Thread Luca Meyer
& f1$v2=="C" & f1$v3=="C", f1$v4-(tBC*1.98324), f1$v4) This are the final marginal distributions: aggregate(v4~v1*v2,f1,sum) aggregate(v4~v3,f1,sum) Can this procedure be made programmatic so that I can run it on the (8x13x13) categories matrix? if so, how would you do it? I h

[R] Fwd: Joining two datasets - recursive procedure?

2015-03-22 Thread Luca Meyer
Sorry forgot to keep the rest of the group in the loop - Luca -- Forwarded message -- From: Luca Meyer Date: 2015-03-22 16:27 GMT+01:00 Subject: Re: [R] Joining two datasets - recursive procedure? To: Bert Gunter Hi Bert, That is exactly what I am trying to achieve. Please

Re: [R] Joining two datasets - recursive procedure?

2015-03-22 Thread Luca Meyer
email... > > Just set z to what you want -- e,g, all B values to 29/number of B's, > and all C values to 2.567/number of C's (etc. for more categories). > > A slick but sort of cheat way to do this programmatically -- in the > sense that it relies on the implementation of

Re: [R] Joining two datasets - recursive procedure?

2015-03-22 Thread Luca Meyer
21, 2015 at 7:53 AM, Bert Gunter wrote: > > z <- rnorm(nrow(f1)) ## or anything you want > > z1 <- f1$v4 + z - with(f1,ave(z,v1,v2,FUN=mean)) > > > > > > aggregate(v4~v1,f1,sum) > > aggregate(z1~v1,f1,sum) > > aggregate(v4~v2,f1,sum) > > aggregat

Re: [R] Joining two datasets - recursive procedure?

2015-03-21 Thread Luca Meyer
;, "v2", "v3", "v4"), class = "data.frame", row.names = c(2L, 9L, 11L, 41L, 48L, 50L, 158L, 165L, 167L, 197L, 204L, 206L)) # please notice that while the aggregated v4 on v3 has changed … aggregate(f1[,c("v4")],list(f1$v3),sum) aggregat

Re: [R] Joining two datasets - recursive procedure?

2015-03-21 Thread Luca Meyer
questions/5963269/how-to-make-a-great-r-reproducible-example > --- > Jeff Newmiller The . . Go Live... > DCN:Basics: ##.#. ##.#. Live > Go... > Live: OO#.. Dead:

[R] Joining two datasets - recursive procedure?

2015-03-18 Thread Luca Meyer
ot sure I understand completely what you want to do, but if the data were frequencies, it sounds like task for fitting a loglinear model with the model formula ~ V1*V2 + V3 On 3/18/2015 2:17 AM, Luca Meyer wrote: >* Hello, *>>* I am facing a quite challenging task (at least to me) and I was wonder

[R] Joining two datasets - recursive procedure?

2015-03-17 Thread Luca Meyer
Hello, I am facing a quite challenging task (at least to me) and I was wondering if someone could advise how R could assist me to speed the task up. I am dealing with a dataset with 3 discrete variables and one continuous variable. The discrete variables are: V1: 8 modalities V2: 13 modalities V

Re: [R] How to verify char variables contain at least one value

2014-01-02 Thread Luca Meyer
Hi Jim, Thank you, it works indeed :) Luca 2014/1/2 Jim Lemon > On 01/02/2014 05:17 PM, Luca Meyer wrote: > >> Happy new year fellows, >> >> I am trying to do something I believe should be fairly straightforward but >> I cannot find my way out. >> >&g

[R] How to verify char variables contain at least one value

2014-01-01 Thread Luca Meyer
Happy new year fellows, I am trying to do something I believe should be fairly straightforward but I cannot find my way out. My dataset d2 is 26 rows by 245 columns, exclusively char variables. I would like to check whether at least one column from V13 till V239 (they are in numerical sequence) h

Re: [R] sourcing from 2 different computers R code

2013-11-12 Thread Luca Meyer
urce("C:/Users/...R")? > > Regards, > Pascal > > > On 12 November 2013 15:13, Luca Meyer wrote: > >> Hi, >> >> I have a piece of code sitting on a dropbox directory and haev installed R >> 3.0.2 on 2 machines: one MacBook Pro and one Sony Vai

[R] sourcing from 2 different computers R code

2013-11-11 Thread Luca Meyer
Hi, I have a piece of code sitting on a dropbox directory and haev installed R 3.0.2 on 2 machines: one MacBook Pro and one Sony Vaio pc. Now, when I use source("/Users/R") to call the script from the Mac no problems, but when I use source("C:\Users\...R") to call the script from the Sony

Re: [R] Uploading Google Spreadsheet data into R

2013-11-08 Thread Luca Meyer
2013 50 TEXT > > ----- > David L Carlson > Department of Anthropology > Texas A&M University > College Station, TX 77840-4352 > > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-proje

[R] Uploading Google Spreadsheet data into R

2013-11-07 Thread Luca Meyer
Hello, I am trying to upload data I have on a Google Spreadsheet within R to perform some analysis. I regularly update such data and need to perform data analysis in the quickiest possible way - i.e. without need to publish the data, so I was wondering how to make work this piece of code (source h

Re: [R] Reading .gsheet within R

2012-12-01 Thread Luca Meyer
Thank you Henrik & the others that have commented. Accessing the actual online data is what I would need, but apparently this is not yet feasible… Luca Il giorno 01/dic/2012, alle ore 04:53, Henrik Bengtsson ha scritto: > On Fri, Nov 30, 2012 at 9:43 AM, Luca Meyer wrote: >> He

[R] Reading .gsheet within R

2012-11-30 Thread Luca Meyer
Hello R-experts, I would like to know if there is a solution to read files with extension .gsheet directly into R - see http://www.fileinfo.com/extension/gsheet for more info on this file format. Thank you, Luca Mr. Luca Meyer www.lucameyer.com R 2.15.1 Mac OS X 10.8.2

[R] Leading plus in numeric fields

2012-08-29 Thread Luca Meyer
m -27 $ GioFor: logi NA $ OrGFor: logi NA $ OreOrt: num -18 $ GioOrt: logi NA $ OrGOrt: logi NA $ OreSpo: num -6 $ GioSpo: logi NA $ OrGSpo: logi NA $ OreUff: num -7 $ GioUff: logi NA $ OrGUff: logi NA $ temp : num 0 Thank you in advance, Luca Mr. Luca Meyer www.lucameyer.com R vers

Re: [R] regexpr with accents

2012-08-06 Thread Luca Meyer
xt = 9", "some > tèxt = 9")) > > d1$V1[regexpr("some tèxt = 9",d1$V2)>0] <- 9 > d1$V1[regexpr("some tèxt = 9",d1$V2)>0] <- 9 > d1$V1[regexpr("some tèxt = 9",d1$V2)>0] <- 9 > > d1 > V1 V2 >

[R] regexpr with accents

2012-08-06 Thread Luca Meyer
Sorry but my previous email did not go through properly. Instead of the ? you should really read an è or è according to http://www.lookuptables.com/. So there are extended ASCII characters I need to deal with. I have tried d1$V1[regexpr("some tèxt = 9",d1$V2)>0] <- 9 and d1$V1[regexpr("some

[R] regexpr with accents

2012-08-05 Thread Luca Meyer
Hello, I have build a syntax to find out if a given substring is included in a larger string that works like this: d1$V1[regexpr("some text = 9",d1$V2)>0] <- 9 and this works all right till "some text" contains standard ASCII set. However, it does not work when accents are included as the foll

Re: [R] Multiple lines for each record: how do I handle that

2012-02-22 Thread Luca Meyer
Names = c("id", > "v1", "v2", "v3"), row.names = c(NA, -6L), class = "data.frame") > > # processing > out <- lapply(split(d0, d0$id), function(l) apply(l[,-1], 2, function(x) > x[!is.na(x) & x != ""])) > out <- data

Re: [R] Multiple lines for each record: how do I handle that

2012-02-22 Thread Luca Meyer
t; If you provide a small reproducible example of your data format and > expected output, I'm sure someone here can offer a useful solution. > > Without knowing what your data look like, not so easy. > > Sarah > > On Wed, Feb 22, 2012 at 2:22 PM, Luca Meyer wrote: &

[R] Multiple lines for each record: how do I handle that

2012-02-22 Thread Luca Meyer
procedure that automatically takes the multiple lines and aggregates them into a single line? Thank you in advance, Luca Mr. Luca Meyer www.lucameyer.com R version 2.14.1 (2011-12-22) Mac OS X 10.6.8 [[alternative HTML version deleted]]

[R] Row percentage labels within mosaic graph

2011-09-21 Thread Luca Meyer
digits=0) etichette <- ifelse(d2 < 5, "<5", paste("(n=",d3,")", sep="")) labeling_cells(text = etichette, clip = FALSE, gp_text=gpar(fontsize=10))(d2) but I would need to show row proportions, do you know how I can do that?

[R] ordering rows within CrossTable

2011-09-10 Thread Luca Meyer
---|---|---| Column Total |46 |54 | 100 | -|---|---|---| I would like to have the df$reason sorted by decreasing count on the Row Total - that is showing R2, R4, R3 and finally R1 - how can I do that? Thanks, Luca Mr

Re: [R] Showing zero frequencies with xtabs

2011-08-30 Thread Luca Meyer
Thanks Peter & Petr, It was indeed an issue of having some character variables in there. Now it works just fine. Cheers, Luca Il giorno 30/ago/2011, alle ore 10.15, peter dalgaard ha scritto: > > On Aug 30, 2011, at 10:04 , Luca Meyer wrote: > >> Hi, >> >> Do

[R] Showing zero frequencies with xtabs

2011-08-30 Thread Luca Meyer
. Alternatively, do you know how to column bind tables with different number of rows? I cannot use merge as it requires daata.frame and that modifies the look of the banner table I am trying to create... Thanks, Luca Mr. Luca Meyer www.lucameyer.com R version 2.13.1 (2011-07-08) Mac OS X 10.6.8

Re: [R] How do I get a weighted frequency table?

2011-08-29 Thread Luca Meyer
Thank you, that's works just fine. Luca Il giorno 29/ago/2011, alle ore 23.48, H. T. Reynolds ha scritto: > Hi, > > I use xtabs with the weight variable on the left hand side of the formula as > in > > xtabs(weight ~ opinion + gender + ...) __ R-h

Re: [R] How do I get a weighted frequency table?

2011-08-29 Thread Luca Meyer
ion, TX 77843-4352 > > > > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Leandro Marino > Sent: Sunday, August 28, 2011 12:15 PM > To: Luca Meyer > Cc: r-help@r-project.org > Subject: Re: [R]

[R] How do I get a weighted frequency table?

2011-08-28 Thread Luca Meyer
procedure in R? Thanks, Luca Mr. Luca Meyer www.lucameyer.com R version 2.13.1 (2011-07-08) Mac OS X 10.6.8 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] Adding labels into lattice's barchart

2011-02-14 Thread Luca Meyer
1), sum)) next to each stacked bar. In the previous example, I would need show in the Crew panel Female (n=23), in the 3rd Class panel Female (n=196), etc... Can I do that? Thanks, Luca Il giorno 14/feb/2011, alle ore 11.43, Deepayan Sarkar ha scritto: > On Wed, Feb 9, 2011 at 11:04 PM,

Re: [R] Adding labels into lattice's barchart

2011-02-14 Thread Luca Meyer
1), sum)) next to each stacked bar. In the previous example, I would need show in the Crew panel Female (n=23), in the 3rd Class panel Female (n=196), etc... Can I do that? Thanks, Luca Il giorno 14/feb/2011, alle ore 11.43, Deepayan Sarkar ha scritto: > On Wed, Feb 9, 2011 at 11:04 PM,

[R] Adding labels into lattice's barchart

2011-02-09 Thread Luca Meyer
groups=V3, stack=TRUE, auto.key= list(space="top"), layout = c(1,4), xlab=" " ) is a bunch of empty bars due to the fact that the unique combinations have risen. Any

[R] Panel title: mfrow() or ?

2011-01-10 Thread Luca Meyer
Hi, I am trying to build a 3 rows by 2 columns panel using par(mfrow=c(3,2)) The 6 graphs are coming out quite all right, but now I would like to put a title on top of the page - i.e. something that is common for all 6 graphs - how can I do that? Thanks, Luca Mr. Luca Meyer

[R] Getting total bar's label & value labels in a barplot

2011-01-09 Thread Luca Meyer
? Also, I would like to plot onto each bar the corresponding numerical value - e.g. "1824" on the first bar, ecc... Please notice that str(t1) would look like: Named num [1:8] 1824 2339 2492 2130 2360 ... - attr(*, "names")= chr [1:8] "1" "2" "3&qu

Re: [R] error in calling source(): invalid multibyte character in parser

2011-01-04 Thread Luca Meyer
ot; is what I get under locale when I run sessionInfo() Il giorno 03/gen/2011, alle ore 09.48, Prof Brian Ripley ha scritto: > On Mon, 3 Jan 2011, peter dalgaard wrote: > >> >> On Jan 3, 2011, at 08:32 , Luca Meyer wrote: >> >>> Being italians when writing comments/i

Re: [R] error in calling source(): invalid multibyte character in parser

2011-01-04 Thread Luca Meyer
t;UC Berkeley > spec...@stat.berkeley.edu > > > On Mon, 3 Jan 2011, Luca Meyer wrote: > >> Being italians when writing comments/instructions we use accented letters - >> like à, ò, è, etc when ru

[R] error in calling source(): invalid multibyte character in parser

2011-01-02 Thread Luca Meyer
find anything that I could intelligibly apply to my case. Can anyone suggest a fix for this error? Thanks, Luca Mr. Luca Meyer www.lucameyer.com IBM SPSS Statistics release 19.0.0 R version 2.12.1 (2010-12-16) Mac OS X 10.6.5 (10H574) - kernel Darwin 1

Re: [R] Passing parameter to a function

2010-12-20 Thread Luca Meyer
not valid in ExtractVars Any idea on how I should modify the function to make it work? Thanks, Luca Il giorno 20/dic/2010, alle ore 19.28, Duncan Murdoch ha scritto: > On 20/12/2010 1:13 PM, Luca Meyer wrote: >> I am trying to pass a couple of variable names to a xtabs formula: >&g

Re: [R] Alternative to extended recode sintax? Bug?

2010-12-20 Thread Luca Meyer
> > On Dec 20, 2010, at 10:58 AM, Luca Meyer wrote: > >> Right, I appreciate the first day of the year start date. I am just >> wondering why then the cut off day is not the same for the rest of the >> year...but it's all right to use other packages. > > Are

[R] Passing parameter to a function

2010-12-20 Thread Luca Meyer
t I have tried with different combinations of deparse(), substitute(), eval(), etc without success, can someone help? Thanks, Luca Luca Meyer www.lucameyer.com IBM SPSS Statistics release 19.0.0 R version 2.12.1 (2010-12-16) Mac OS X 10.6.5 (10H574) - kernel Darwin 10.5.0 _

Re: [R] Alternative to extended recode sintax? Bug?

2010-12-20 Thread Luca Meyer
0, 2010, at 12:54 AM, Luca Meyer wrote: > >> All right, I get it now: lubridate's week() define weeks from Thursday till >> the following Wednesday. You'd probably agree with me that it's a bit >> strange what it is going to do over the turn of the year: >>

Re: [R] Alternative to extended recode sintax? Bug?

2010-12-20 Thread Luca Meyer
day and not Wednesday and Friday like every other week? Cheers, Luca Il giorno 19/dic/2010, alle ore 18.14, Uwe Ligges ha scritto: > > > On 19.12.2010 13:20, David Winsemius wrote: >> >> On Dec 19, 2010, at 5:11 AM, Luca Meyer wrote: >> >>> Something go

[R] tabulating 2 factors weighting by a third var

2010-12-19 Thread Luca Meyer
table(v1,v2) I would like to get the sum(v3), how can it be done? Thanks, Luca Luca Meyer www.lucameyer.com IBM SPSS Statistics release 19.0.0 R version 2.12.1 (2010-12-16) Mac OS X 10.6.5 (10H574) - kernel Darwin 10.5.0 __ R-help@r-project.org mai

[R] Ifelse stability problems?

2010-12-19 Thread Luca Meyer
(50-67%) 65.5 265 B (10-20%) 13.5ok 266 C (5-15%) 4.6 267 D (1-5%) 0.9 268 E (10-20%) 15.4ok 269 A (50-67%) 72.1 270 B (10-20%) 6.4 271 C (5-15%) 12.7ok 272 D (1-5%) 1.1 273 E (10-20%) 7.7 274 A (50-67%) 71.4 275 B (10-20%) 0.9

Re: [R] Alternative to extended recode sintax? Bug?

2010-12-19 Thread Luca Meyer
51 51 51 > Please notice Mercoledì=Wednesday and Giovedì=Thursday, why would the beginning of the week start on Thursday? Also please beware that on previous weeks this does not occur, that is all weeks till 49 will all begin on Mondays and end on Sundays as required. Thanks, Luca Il

[R] testing with if: what I am doing wrong?

2010-12-19 Thread Luca Meyer
I am running this small program: x <- factor(c("A","B","A","C")) y <- c(1,2,3,4) w <-data.frame(x,y) if (w$x=="A"){ w$z=1 } w And I obtain: x y z 1 A 1 1 2 B 2 1 3 A 3 1 4 C 4 1 And not x y z 1 A 1 1 2 B 2 NA 3 A 3 1 4 C 4 NA Like I should obtain. What am I doing wrong? Please not

[R] Alternative to extended recode sintax?

2010-12-18 Thread Luca Meyer
"2010-09-06 00:00:00" "2010-09-13 00:00:00" "2010-09-20 00:00:00" "2010-09-27 00:00:00" "2010-10-04 00:00:00" [81] "2010-10-11 00:00:00" "2010-10-18 00:00:00" "2010-10-25 00:00:00" "2010-10-31 23:00:00" &qu

[R] how to use diff() with different variables?

2010-12-09 Thread Luca Meyer
fine1 that should contain the lagged value for "fine", that is: xfine fine1 1 A 2010-12-09 07:57:33 NA 2 B 2010-12-09 08:05:00 2010-12-09 07:57:33 3 C 2010-12-08 20:42:00 2010-12-09 08:05:00 How can I do that? Thanks, Luca Luca Meyer www.lucameyer.com IBM SPSS