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
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)
>
>
; 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
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
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
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
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
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
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<
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
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
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)
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
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
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
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
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,
>>
>>
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 =
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-
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
& 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
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
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
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
;, "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
questions/5963269/how-to-make-a-great-r-reproducible-example
> ---
> Jeff Newmiller The . . Go Live...
> DCN:Basics: ##.#. ##.#. Live
> Go...
> Live: OO#.. Dead:
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
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
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
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
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
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
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
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
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
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
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
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
>
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
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
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
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:
&
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]]
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?
---|---|---|
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
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
.
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
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
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]
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
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,
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,
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
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
?
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
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
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
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
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
>
> 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
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
_
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:
>>
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
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
(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
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
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
"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
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
69 matches
Mail list logo