Displaying 20 results from an estimated 5000 matches similar to: "tabulating 2 factors weighting by a third var"
2011 Jan 03
2
error in calling source(): invalid multibyte character in parser
Being italians when writing comments/instructions we use accented letters - like ?, ?, ?, etc.... when running R scripts using such characters I get and error saying:
invalid multibyte character in parser
I have been looking at the help and searched the r-help archives but I haven't find anything that I could intelligibly apply to my case.
Can anyone suggest a fix for this error?
Thanks,
2011 Jan 09
1
Getting total bar's label & value labels in a barplot
Hi,
I have been trying to get the label under the total column - i.e. a mean value of columns 2 to 6 - in a barplot I generate with this script:
t1 <- tapply(A, B, sum)
t1[8] <- mean(t1[2:6])
t1 <- as.table(t1)
barplot(t1, ylim=c(0,3000))
mtext("Var1", side = 1, line = 3)
mtext("Var2", side = 2, line = 3)
I have been trying to use
axis(1, at=1:8,
2010 Dec 19
3
monthly median in a daily dataset
Hello,
I have a multi-year dataset (see below) with date, a data value and a flag
for the data value. I want to find the monthly median for each month in this
dataset and then plot it. If anyone has suggestions they would be greatly
apperciated. It should be noted that there are some dates with no values and
they should be removed.
Thanks
Emily
> print ( str(data$flow$daily) )
2010 Dec 20
1
Passing parameter to a function
I am trying to pass a couple of variable names to a xtabs formula:
> tab <- function(x,y){
xtabs(time~x+y, data=D)
}
But when I run:
> tab(A,B)
I get:
Error in eval(expr, envir, enclos) : object "A" not found
I am quite sure that there is some easy way out, but I have tried with different combinations of deparse(), substitute(), eval(), etc without success, can someone
2010 Dec 09
1
how to use diff() with different variables?
Hi,
I first should say I am new to R. I have searched without success the R-archives to see if I could find an answer to what I am about to ask you.
My dataset is like:
x fine
1 A 2010-12-09 07:57:33
2 B 2010-12-09 08:05:00
3 C 2010-12-08 20:42:00
...
that is:
'data.frame': 3 obs. of 2 variables:
$ x : Factor w/ 3 levels "A","B","C":
2010 Dec 17
3
Alternative to extended recode sintax?
Dear R-users,
I have a factor variable within my data frame which I derive week after week from a POSIXct variable using the cut(var,"weeks") command I have found in the chron package. The levels() command gives me:
[1] "2009-03-30 00:00:00" "2009-04-06 00:00:00" "2009-04-13 00:00:00" "2009-04-20 00:00:00" "2009-04-27 00:00:00"
2011 Aug 28
4
How do I get a weighted frequency table?
? stato filtrato un testo allegato il cui set di caratteri non era
indicato...
Nome: non disponibile
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110828/d35f51a1/attachment.pl>
2012 Nov 30
3
Reading .gsheet within R
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
[[alternative HTML version deleted]]
2012 Aug 30
4
Leading plus in numeric fields
Hello R experts,
I have go this data frame:
'data.frame': 1 obs. of 20 variables:
$ Anno : chr "PREVISIONI VS TARGET"
$ OreTot: num 41
$ GioTot: logi NA
$ OrGTot: logi NA
$ OreCli: num 99
$ GioCli: logi NA
$ OrGCli: logi NA
$ OreFor: num -27
$ GioFor: logi NA
$ OrGFor: logi NA
$ OreOrt: num -18
$ GioOrt: logi NA
$ OrGOrt: logi NA
$ OreSpo: num -6
$ GioSpo: logi
2011 Feb 09
1
Adding labels into lattice's barchart
*** APOLOGIZES FOR THOSE READING THE LIST THROUGH NABBLE THIS WAS ALREADY POSTED THERE BUT NOT FORWARDED TO THE LIST FOR SOME UNKNOWN REASON ***
I have a dataset that looks like:
$ V1: factor with 4 levels
$ V2: factor with 4 levels
$ V3: factor with 2 levels
$ V4: num (summing up to 100 within V3 levels)
$ V5: num (nr of cases for each unique combination of V1*V2*V3 levels)
Quite new to
2011 Aug 30
2
Showing zero frequencies with xtabs
? stato filtrato un testo allegato il cui set di caratteri non era
indicato...
Nome: non disponibile
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110830/7c33d4d0/attachment.pl>
2009 Oct 02
3
Tabulating using arbitrary numbers of factors
Dear R-help,
First of all, thank you VERY much for any help you have time to offer. I
greatly appreciate it.
I would like to write a function that, given an arbitrary number of factors
from a data frame, tabulates the number of occurrences of each unique
combination of the factors. Cleary, this works:
> table(horse,date,surface)
<SNIP>
, , surface = TURF
2010 Mar 29
0
Question on entry exit tabulating in any R finance package
I asked the question in Rmetrics subforum, but for some reason, almost two
weeks later, it keeps saying I haven't been approved to post yet there.
I'll try again here on the open forum.
I wanted to have a script that tabulates results by trade. I.e. instead of
tabulating each day as a trade event, you enter on one date, exit another,
and simply tabulate metrics based on one trade period.
2011 Sep 20
1
Tabulating Baseline Characteristics on specific observations
I have a data set with many missing observations. When I run a
regression, R of course discards the observations (the whole row) that
have "NA". I want to tabulate some baseline characteristics (column
means) but only for the observations that R used for the regression.
I tried to recreate this data frame by using na.omit on the original
data frame, but this will not work as this will
2003 Feb 28
3
Tabulating
Hello,
I wonder if someone could send me suggestions on how to solve the following problem:
I have a vector of an arbitrary size (ex. data<-c(10,10,11,10,12,11,10,12,11,11,10,11)) and use the table function, which gives the following result
10 11 12
5 5 2
that''s fine, but what I would like to do now is:
construct new classes based on the number of classes from table, 10
2008 Mar 29
1
Tabulating Sparse Contingency Table
I have a sparse contingency table (most cells are 0):
> xtabs(~.,data[,idx:(idx+4)])
, , x3 = 1, x4 = 1, x5 = 1
x2
x1 1 2 3
1 0 0 31
2 0 0 112
3 0 0 94
, , x3 = 2, x4 = 1, x5 = 1
x2
x1 1 2 3
1 0 0 0
2 0 0 0
3 0 0 0
, , x3 = 3, x4 = 1, x5 = 1
x2
x1 1 2 3
1 0 0 0
2 0 0 0
3 0 0 0
, , x3 = 1, x4
2012 Feb 22
1
Multiple lines for each record: how do I handle that
? stato filtrato un testo allegato il cui set di caratteri non era
indicato...
Nome: non disponibile
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120222/a28536ba/attachment.pl>
2010 Dec 29
1
helps on upgrading R in Mac OS
Dear R-helpers,
I intend to upgrade R in Mac OS with updated R version and updated Mac
OS version.
I think my Mac notebook is produced with Mac x86_64, darwin9.8.0. I
have updated my Mac OS to Mac OS X version 10.6.5. But, when I
installed R 2.12.1, the "version" function still gave me information
that R is based on old Mac OS. I need to know how can I update R to
let it to fit for
2008 Feb 29
2
Getting multiple tables when using table(dataframe) to tabulate data
I am having hard time tabulating data in a dataframe, and getting a single
"table" for an answer. I am trying to tabulate all "counts" for given
"status" on a given date.
I have a data frame such as:
delta_ts status count
1 2008-02-27 CLOSED 3
2 2008-02-27 NEW 56
3 2008-02-27 RESOLVED 5
4 2008-02-21 ASSIGNED 1
5
2009 Oct 28
1
Aggregate and cross tabulation
R-helpers:
I have a data frame containing 4 factor variables (let's say A,B,C,
and D) and 1 numerical variable (N). I would like to produce a
cross-tabulated data frame in which A,B,C are individual columns, each
factor of D is its own column, and the field is calculated as a given
function of N (I would like to have two output data frames, one with the
mean(N) and one with the