Displaying 20 results from an estimated 10000 matches similar to: "indexing data.frames"
2009 Aug 17
1
R : how does %in% operator work?
*Problem-1*
CASE-I---------(works fine)
> var1<-"tom"
> var1
[1"tom"
> var1<-as.character(var1)
> var1
[1] "tom"
> var2<-c("tom","harry","kate")
> logc<-(var1 %in% var2)
> logc
[1] TRUE
> typeof(var1)
[1] "character"
> typeof(var2)
[1] "character"
2010 Jun 09
1
counting across leves of factors
I have dataframe with 17factors variables (for example every factor have
3levels)
I have maybe 5000 observation.
And i need to do table where is in every raw 1 of possible combination of
this factors and the numbur how many time is this combination in my dataset.
I wrote one code, but this is very slow and dumb.
it looks like this:
i<-0
for(i1 in levels(hivdat$pohl)){
2013 Apr 17
1
Merging big data.frame
Hi all,
I am trying to merge 2 big data.frame. The problem is merge is memory
intensive so R is going out of memory error: cannot allocate vector of size
360.1 Mb. To overcome this, I am exploring option of using data.table
package. But its not helping in term of memory as merge in data.table is
fast but not memory efficient. Similar error is coming.
My inputs are
inp1
V1 V2
1 a i1
2 a i2
3 a
2009 Aug 20
2
Insert rows in between dataframes
Hi all,
Can anyone suggest me how to insert rows in between data frames and also
keep the ordering of row numbers correct?
Estimate Std. Error t
value Pr(>|t|)
recmeanC2 9.275880e-17 6.322780e-17 1.467057e+00
0.14349903
recmeanC3 1.283534e-17 2.080644e-17 6.168929e-01
0.53781390
2011 Sep 27
1
array extraction
hello everyone.
Look at the following R idiom:
a <- array(1:30,c(3,5,2))
M <- (matrix(1:15,c(3,5)) %% 4) < 2
a[M,] <- 0
Now, I think that "a[M,]" has an unambiguous meaning (to a human).
However, the last line doesn't work as desired, but I expected it
to...and it recently took me an indecent amount of time to debug an
analogous case. Just to be explicit, I would
2009 Aug 24
1
natural sorting a data frame /vector by row
How to NATURAL sort a vector or data frame* by row* , in ascending order ?
V1 V2 V3 V4
i1 5.000000e-01 1.036197e-17 4.825338e+16 0.00000000
i10 4.001692e-18 1.365740e-17 2.930053e-01 0.76973827
i12 -1.052843e-17 1.324484e-17 -7.949081e-01 0.42735000
i13 2.571236e-17 1.357336e-17 1.894325e+00 0.05922715
i2
2009 Jul 20
1
Regression function lm() not giving proper results
*
*
Hi ,
Can anyone help me please with this problem?*
*
*CASE-I*
all_raw_data_NAomitted is my data frame.It has columns with names i1 ,i2,
i3,i4…, till i15.It has 291 rows actually ,couldn’t show here.
The data frame looks like this:--
i1 i2 i3 i4 i5 i6 i7 i8 i9 i10 i11 i12 i13 i14 i15
2 2 2 2 2 2 2 2 2 2 2 1 2 2 3 2
3 2 2 2 2 3 2 2 3 3
2006 Jan 18
1
Within-Subjects ANOVA & comparisons of individual means
I am having problems with comparing individual means in a
within-subjects ANOVA. From my understanding, TukeyHSD is not
appropriate in this context. So I am trying to compute contrasts, as
follows:
seven subjects participated in each of 6 conditions (intervals).
> subject = factor(rep(c(1:7), each = 6))
> interval = factor(rep(c(1:6), 7))
and here is the dependent variable:
> dv
2012 Mar 05
1
Forward stepwise regression using lmStepAIC in Caret
I'm looking for guidance on how to implement forward stepwise regression
using lmStepAIC in Caret.
The stepwise "direction" appears to default to "backward". When I try to
use "scope" to provide a lower and upper model, Caret still seems to
default to "backward".
Any thoughts on how I can make this work?
Here is what I tried:
itemonly <-
2006 Nov 16
1
How Aggegate Data in R
Hello:
When I use SPSS I execute the AGGREGATE DATA comand for the next data:
2112141123212213212213334
3143244113442312121213344
2114141123112214212113344
2112211122212413421213221
3114444123442414343413344
2312231223212222323223322
2143241123212313131213234
2113241113212313222213333
2113141123112214212113344
2114141123412111114413344
2113211122342314222313234
2114141123112414212113344
2008 Mar 06
2
Help with parsing a data file
Hi All,
I need to parse data from a file, example shown below. The first two lines
can be skipped, the third line contains the column names. The next 13 lines
can be skipped. The next line "1991" is a year value, with the following 13
values data for that year. The file then repeats this format with (year, 13
lines of data for that year). I would ideally like to end up with an
2007 Jul 15
1
NNET re-building the model
Hello,
I've been working with "nnet" and now I'd like to use the weigths, from
the fitted model, to iterpret some of variables impornatce.
I used the following command:
mts <- nnet(y=Y,x=X,size =4, rang = 0.1,
decay = 5e-4, maxit = 5000,linout=TRUE)
X is (m x n) Y is (m x 1)
And then I get the coeficients by:
Wts<-coef(mts)
b->h1 i1->h1
2012 Jun 19
1
weird --no 'dimnames' attribute for array-- error for R lordif package
Hi All,
? I am trying to use the lordif package in R and can't figure out the reason for the above error when I try to run the calctheta() function.
##################
# read data using foreign package - must be Stata 11 or earlier
racedata<- read.dta("race.dta")???
# item responses
resp.data<-racedata[,-c(1:2)]
# grouping variable is in the second column
2004 Oct 28
1
gsub() on Matrix
Hi,
Suppose I've got a matrix, and the first few elements look like
"x1 + x3 + x4 + x5 + x1:x3 + x1:x4"
"x1 + x2 + x3 + x5 + x1:x2 + x1:x5"
"x1 + x3 + x4 + x5 + x1:x3 + x1:x5"
and so on (have got terms from x1 ~ x14).
If I want to replace all the x1 with i7, all x2 with i14, all x3 with i13,
for example. Is there an easy way?
I tried to put what I want
2009 Aug 28
1
How to generate mean anova value row in anova table, instead of individual value for each predictor
Hi All ,
Can anybody tell me if there's any way to get the summarized anova
values.Now i will explain what i mean , when i say "*summarized*".
Below you can see the anova table of recmeanC1 with rest* all* i.e from
recmeanC2 to i15(predictors),as shown in table.
Df Sum Squares Mean Square F value Significance [Pr(>F)]
recmeanC2 1 89.272 89.272
2010 Sep 13
2
SF-36 questionnaire scoring for R?
Dear useRs from the physiology department,
Does someone know of an implementation of the SF-36 questionnaire scoring in
R? I only found SAS and STATA versions, e.g
http://gim.med.ucla.edu/FacultyPages/Hays/util.htm
Dieter
2017 Sep 15
2
What should a truncating store do?
For example, truncating store of an i32 to i6. My assumption was that this
should write the low six bits of the i32 to somewhere in memory.
Should the top 24 bits of a corresponding 32 bit region of memory be
unchanged, zero, undefined?
Should the two bits that would round the i6 up to a byte be preserved,
zero, undefined?
I can't write six bits directly so am trying to determine what set
2011 Aug 31
2
[LLVMdev] A pass to minimize instruction bitwidth?
Does llvm have a pass that minimizes the bitwidth of llvm instructions?
For instance:
%8 = and i32 %7, 63
63 is 111111 in binary. So the 'and' instruction only requires 6 bits.
We could rewrite the above code as:
%8 = trunc i32 %7 to i6
%9 = and i6 %8, 63
Since we only need the lower 6 bits we could also propagate this
change backwards to reduce the bitwidth of prior
2020 Oct 08
2
Undef and Poison round table follow-up & a plan
Hello all,
Thank everyone who participated in the (impromptu) round table discussion
on Tuesday.
For those who are interested, I share the summary of the discussion.
Also, I share a short-term plan regarding this issue and relevant patches.
*Fixing Miscompilations using Freeze*
-----------------------------------
To reduce the cost of fixing miscompilations using freeze instruction, we
need to
2015 Jul 24
2
[LLVMdev] SIMD for sdiv <2 x i64>
It seems that that it's hard to vectorize int64 in LLVM. For example, LLVM
3.4 generates very complicated code for the following IR. I am running on a
Haswell processor. Is it because there is no alternative AVX/2 instructions
for int64? The same thing also happens to zext <2 x i32> -> <2 x i64> and
trunc <2 x i64> -> <2 x i32>. Any ideas to optimize these