Thanks for the clear explanation Terry!
It gets ugly for many factanal applications, where you are dealing with 300
variables…
One question: what would be wrong with auto generating the formula from a
matrix call?
That way the matrix call gets the benefit of returning scores.
Also: you say a
hi,
Does factanal() force the user to use the formula interface if they wish to
specify an na.action?
v1 <- c(1,1,1,1,1,1,1,1,NA,1,3,3,3,3,3,4,5,6)
v2 <- c(1,2,1,1,1,1,2,1,2,1,3,NA,3,3,3,4,6,5)
v3 <- c(3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,5,4,6)
v4 <- c(3,3,4,NA,3,1,1,2,1,1,1,1,2,NA,1,5,6,4)
v5 <- c(1,1
This caught me learning R, and no doubt thousands of others.
When would one ever want the results of fitted() or residuals() to NOT match
the data frame rows which went into the model? Certainly making shrinking the
results the default is not what 99% of user will want if they need to access
If you find yourself asking "is there a way..?", put that question mark in
front of the function you are wondering about and push return
?write.csv
In this case, you will see that the write function has a parameter to say
whether to write out row names ornot, which defaults to TRUE...
row.nam
So when I do the merge on your example frames, I get the expected result.
But the example component dataframes you sent are already full of NAs, and
there are no rows which are present in both data sets. So I think perhaps, that
merge is just highlighting a problem that has its roots in your com
I think you want something like this (I like to be explicit about what you are
merging)
df3 = merge(df1, df2, by = "date", all=T)
You can be explicit about what you are merging on in each file:
df3 = merge(df1,df2, by.x = "date”, by.y="date", all=T)
You were trying to merge on “date1” but it l
this works
x=1; y=-100;
z = min(5, max(1, x+y));
z
On 25 Oct 2011, at 1:46 PM, Jim Maas wrote:
> Hello,
>
> Is there a simple way/function to constrain the minimum and maximum value of
> an output from an assignment?
>
> if I have
>
> z <- x +y
>
> but I want z to always be between 1 and 5
Dear Kevin,
# this works
nchar("read the help for length”)
[1] 24
On 24 Oct 2011, at 4:14 PM, Kevin Burton wrote:
> This is very basic but I have not been able to find an answer. Basically I
> want to find the length of a string.
>
> length("Text")
>
> returns 1 so I know that is not right.
>
On Oct 12, 2011, at 12:04 AM, Rolf Turner wrote:
> On 12/10/11 08:31, Timothy Bates wrote:
>> To do matrix multiplication: m x n, the Rows and columns of m must be equal
>> to the columns and rows of n, respectively.
> No. The number of columns of m must equal the number of r
To do matrix multiplication: m x n, the Rows and columns of m must be equal to
the columns and rows of n, respectively.
Sent from my iPhone
On 11 Oct 2011, at 06:45 PM, flokke wrote:
> Dear all,
> I wanted to create the mean using a algebra matrix.
> so I tried this one:
>
>> meanAnimal
so… cleared out, and now it’s working: Must have been an obscure workspace
conflict. Thanks for quick helpful replies
a <- 1:4
assign("a[1]", 2)
> a[1] == 2
[1] FALSE
> get("a[1]") == 2
[1] TRUE
On 11 Oct 2011, at 5:45 PM, Duncan Murdoch wrote:
> On 11/10/20
In the help for get(), the following example is given:
a <- 1:4
assign("a[1]", 2)
a[1] == 2 #FALSE
get("a[1]") == 2 #TRUE
However, executing that last line for me gives
Error in get("a[1]") : object 'a[1]' not found
__
R-help@r-project.org
if it was me, i'd do
library("ggplot2")
df <- read.table(pipe("pbpaste"), header=T, sep='\t')
df$Animus=factor(df$Animal, labels=c("Tom", "Dick", "Harry"))
qplot(Day, Cort, data = df, geom="line", colour=Animus)
On Sep 28, 2011, at 8:03 AM, clara_eco wrote:
> Hi I have data in the following forma
Yes, in over 3/4s of the data points A is > B… which suggests the A measure is
reading higher than the B measuring system.
length(A[A>B])/length(A)
On 20 Sep 2011, at 6:46 PM, Pedro Mardones wrote:
> Dear all;
>
> A very basic question. I have the following data:
>
>
On 16 Sep 2011, at 1:49 AM, andrewH wrote:
>> I'm trying to make a function that takes column names then
>> using the variable colName, containing the name of
>> the column, to refer to the column itself
rmail...@justemail.net said
> What am I missing about your inquiry: It seems like x[ , colNam
>> %<% would extend the vocabulary established by %in%, and work in the same
>> situations.
>> e.g.
>> # only set “flynnEffect" for people known to be under 12, not for people
>> where age is NA
>> twinData[twinData$Age %<% 12, "flynnEffect"] = FALSE
>> Addressing Duncan's point about returni
Dear Duncan and Hadley,
I stumbled across the NA behavior of subset a little while ago and thought it
might do the trick. But my common usage case is not getting a subsetting sans
NAs, but setting values in the whole dataframe.
So I need T/F at each row, not just the list of rows that match th
Dear R cognoscenti,
While having NA as a native type is nifty, it is annoying when making binary
choices.
Question: Is there anything bad about writing comparison functions that
behavior like %in% (which I love) and ignore NAs?
"%>%" <- function(table, x) {
return(which(table > x))
}
> On Fri, Aug 26, 2011 at 10:20 AM, Benjamin Polidore
> wrote:
>> I have two distributions. Is there a statistical approach to determine
>> if the skew of distribution 1 is similar to the skew of distribution 2?
On Aug 26, 2011, at 10:07 PM, Joshua Wiley wrote:
> par(mfrow = c(2, 1))
> plot(de
This takes a few seconds to do 1 million lines, and remains explicit/for loop
form
numberofSalaryBands = 100 # 200
x= sample(1:15,numberofSalaryBands, replace=T)
y= sample((1:10)*1000, numberofSalaryBands, replace=T)
df = data.frame(x,y)
finalN = sum(df$x)
myVar
Perhaps this:
matches = grep("^ibm|sears|exxon", zeespan$customer, value=F)
zee = zeespan[matches,]
t
On Aug 14, 2011, at 12:44 AM, eric wrote:
> I have a dataframe zeespan. One of the columns has the name "customer". The
> data in the customer column is text. I would like to return a subset of
diag(adjMatrix) <-0
On Aug 13, 2011, at 7:34 AM, collegegurl69 wrote:
> I have created an adjacency matrix but have not been able to figure something
> out. I need to put zeros on the diagonal of the adjacency matrix. For
> instance, location (i,i) to equal 0. Please help. Thanks
_
7:24 PM, peter dalgaard wrote:
>
> On Aug 7, 2011, at 20:05 , David Winsemius wrote:
>
>>
>> On Aug 6, 2011, at 1:19 PM, Timothy Bates wrote:
>>
>>> Dear R-users,
>>> I am comparing differences in variance, skew, and kurtosis between two
>>>
Dear R-users,
I am comparing differences in variance, skew, and kurtosis between two groups.
For variance the comparison is easy: just
var.test(group1, group2)
I am using agostino.test() for skew, and anscombe.test() for kurtosis. However,
I can't find an equivalent of the F.test or Mood.test
It's not immediately obvious
You need to look at coord_cartesian() and its ylim argument.
Best, t
Sent from my iPhone
On 4 Aug 2011, at 02:38 PM, Christopher Desjardins
wrote:
> Hi,
> I am using ggplot2 to with the following code:
>
> gmathk2 <-
> qplot(time,math,colour=Kids,data=kids.ach.
Dear R-users,
I am comparing differences in variance, skew, and kurtosis between two groups.
For variance the comparison is easy: just
var.test(group1, group2)
I am using agostino.test() for skew, and anscombe.test() for kurtosis.
However, I can't find an equivalent of the F.test or Mood.tes
Hi Matt,
Though it's the last solution on your list, I would treat this as a
text editing problem: just find and replace "\.[0-9]", then read in
the result.
perl -pi -e 's/x\.[0-9]//g' *test.txt
likely done in seconds.
But other R solutions seem to be coming in in a fairly timely manner too.
t
On 26 May 2011, at 08:02, Vijayan Padmanabhan wrote:
> I have a requirement for which I am seeking help.
Best to just ask, compactly. This is a very straightforward question: best to
read on how to use R: You are just set 1 column of a dataframe to a value based
on the others, applying this to
On 24 May 2011, at 10:20 PM, Lutz Fischer wrote:
> n<-data.matrix(s);
> > s[1,2]
> [1] 30.94346629 # 3136 Levels: 0.026307482
> turned into:
> > n[1,2]
> [1] 3020
Dear Lutz, “3020” is the factor level associated with 30.94346629, in turn
generated by importing with strings in the column
Try pas
Dear Janko,
I think requires a for loop. The approach I took here was mark the dups, then
dump them all in one hit:
testData = expand.grid(letters[1:4],c(1:3))
testData$keep=F
uniqueIDS = unique(testData$Var1)
for(thisID in uniqueIDS) {
firstCaseOnly = match(thisID,testData$Var1)
> Person A is working on the file on their computer the path to the data would
> be (Mac OSX) /Users/PersonA/Dropbox/Project/data.csv However, to Person B
> the path would be /Users/PersonB/Dropbox/data.csv I'm looking for a way to
> keep the path to data.csv universal and independent of who i
The problem is that dropbox sharable links unpack to https URIs, and R doesn't
support secture http (at least not on Mac, not sure about other platforms).
Would be great to compile the read.table etc. functions to use curl when it is
installed, as curl supports a myriad of protocols.
Rcurl pac
Dear Karena,
x = 1:100
y = rnorm(100)
fit = lm(x~y)
# what properties does a fit have?
names(fit)
# [1] "coefficients" "residuals" "effects" "rank"
"fitted.values" "assign""qr"
# [8] "df.residual" "xlevels" "call" "terms" "model"
The most interesting thing in this thread for me was "within()" - that is what
I want 99% of the time, but I had only ever heard of with()
A real boon! Thanks Bill V!
The help for within gives this example for with(), which seems unnecessary, as
glm supports data=
with(anorexia, {
anorex.1
lol:-)
is there a way to get a fortune on start up in R?
On 19 May 2011, at 00:33, Rolf Turner wrote:
>
> On 19/05/11 10:26, bill.venab...@csiro.au wrote:
>
>
>> Most of [the Google style guide's] advice is very good (meaning I agree with
>> it!) but some is a bit too much (for example, the b
Can’t you just embed it in the html as a symbol?
∫ or ∫
I’d have thought you also just put it into straight into the document as a
character – ∫– , as long as the html is stored as unicode
U+222B
http://en.wikipedia.org/wiki/Integral_symbol
On 18 May 2011, at 4:04 PM, Javi Hidalgo wrote:
>
Dear Augustin: What are the duplicated times? Looks they really do occur twice
or more in your original data: perhaps two stamps less time apart than the
resolution of your clock?
delme[duplicated(delme)]
aur2009[[duplicated(delme),1]
On 18 May 2011, at 8:49 AM, Agustin Lobo wrote:
> and is it
something like this will get you going, assuming your data are in a dataframe
called “qual”
# qual <- read.table(pipe("pbpaste"), header=T, sep='\t')
boxplot(formula=Time~Distance+Season, data=qual)
Followup question from me:
i can’t see why
boxplot(formula=Time, data=qual)
should return the
Dear Bryony: the suggestion was not to change the name of the data object, but
to explicitly tell glm.nb what dataset it should look in to find the variables
you mention in the formula.
so the salient difference is:
m1 <- glm.nb(Cells ~ Cryogel*Day, data = side)
instead of
attach(side)
m1 <-
39 matches
Mail list logo