up to date with new development features follow the github page:
https://github.com/andrija-djurovic/LGDtoolkit.
I hope some of you will find the package useful.
Kind regards,
Andrija
[[alternative HTML version deleted]]
___
R-packages maili
homogeneity, heterogeneity, discriminatory and predictive power of
the model.
For details and examples please check out the github page
https://github.com/andrija-djurovic/PDtoolkit or README file on CRAN page
https://CRAN.R-project.org/package=PDtoolkit
Best regards,
Andrija Djurovic
help page of the function
(?mdt.bin) or visit the github page:
https://github.com/andrija-djurovic/monobin
Soon I will upload to the CRAN updated version of monobinShiny package in
order to reflect changes from the monobin. Until then users can install
github version (https://github.com/andrija-djurovic/mo
. The function descriptive
statistics is exported and can be used in R sessions independently from the
user interface, while the special case and the outlier imputation functions
are written to be used with shiny UI.
Here is, also, the link to github page:
https://github.com/andrija-djurovic/monobinShiny
'
argument. Missing values and other possible special values are treated
separately from so-called complete cases.
Close attention should be paid when modeling continuous target due to
possible negative values.
Hope that some of you will find the package useful.
Best regards,
Andrija Djurovic
Something like this?
set.seed(123)
y <- rnorm(20)
sapply(1:length(y), function(x) sum(y[1:x]))
or this, depending what is the output of your custom function
lapply(1:length(y), function(x) sum(y[1:x]))
On Thu, Aug 10, 2017 at 8:39 PM, Christofer Bogaso <
bogaso.christo...@gmail.com> wrote:
Hi. Here is one approach:
x - rep(c(A, B, C), c(3,1,2))
DF - data.frame(x, stringsAsFactors=FALSE)
cbind(DF, new_c=c(lapply(rle(DF$x)[[1]], function(x) 1:x), recursive=T))
Andrija
On Wed, May 28, 2014 at 10:46 PM, Marcos Santos mmsantos...@gmail.comwrote:
I have a data frame like this:
Here is another approach:
x - rep(c(A, B, C), c(3,1,2))
DF1 - data.frame(x)
cbind(DF1, new_c=ave(as.numeric(DF1$x), DF1$x, FUN=function(x) 1:length(x)))
Note the difference between DF (in previous solution) and DF1
str(DF)
str(DF1)
Andrija
On Thu, May 29, 2014 at 12:03 AM, Andrija Djurovic
Hi. Here is one solution:
table(Donner$family)[Donner$family]
Andrija
On Fri, Apr 11, 2014 at 10:40 PM, Michael Friendly frien...@yorku.cawrote:
I'm sure this is pretty simple, but it's Friday afternoon, and I just
don't see it...
In a data frame with a categorical/character factor, I
another:
ave(as.numeric(Donner$family), Donner$family, FUN=length)
On Fri, Apr 11, 2014 at 10:51 PM, Andrija Djurovic djandr...@gmail.comwrote:
Hi. Here is one solution:
table(Donner$family)[Donner$family]
Andrija
On Fri, Apr 11, 2014 at 10:40 PM, Michael Friendly frien
Hi. Here is one way:
l - list(structure(list(BP_A = c(27001689L, 27001689L, 27001689L,
27001689L, 27001689L, 27001689L), SNP_A = c(rs4822747, rs4822747,
rs4822747, rs4822747, rs4822747, rs4822747), BP_B = c(27002392L,
27004298L, 27004902L, 27004964L, 27005122L, 27005158L), SNP_B =
c(rs4820690,
Hi. Here are two approaches:
c(mapply(function(x,y) rep(c(x,y), 2), (1:10)[c(T,F)], (1:10)[c(F,T)]))
c(tapply(1:10, rep(1:(10/2), each=2), rep, 2), recursive=T)
Andrija
On Mon, Nov 11, 2013 at 1:11 PM, Federico Calboli
f.calb...@imperial.ac.ukwrote:
Hi All,
I am trying to create an
Hi here is the solutions using XLConnect package:
library(XLConnect)
wb - loadWorkbook(path to your Excel file)
c(particular sheet name)%in%getSheets(wb)
Andrija
On Tue, Oct 29, 2013 at 9:26 PM, Ron Michael ron_michae...@yahoo.comwrote:
Hi,
I am looking for some R function which will
Hi.
See ?sample, ?replicate,?colMeans, ?plot..
Here is the simple example:
sample(1:1000,20)
replicate(5, sample(1:1000,20))
colMeans(replicate(5, sample(1:1000,20)))
Andrija
On Wed, Jul 31, 2013 at 1:23 PM, Rita Gamito rslo...@fc.ul.pt wrote:
Could anyone tell me how,from a pool of 1002
Hi.
See
http://stackoverflow.com/questions/1995933/number-of-months-between-two-dates
Andrija
On Thu, Jul 11, 2013 at 11:56 AM, Gallon Li gallon...@gmail.com wrote:
My data are from 2008 to 2010, with repeated measures for same subjects. I
wish to compute number of months since january
XLConnect package
Andrija
On Jun 27, 2013 9:15 PM, Spencer Graves
spencer.gra...@structuremonitoring.com wrote:
Hello:
Is there a fully transportable way to write an Excel workbook?
The writeFindFn2xls function in the sos package attempts to write
search results to an Excel workbook
Hi.
Try this:
beta_results[beta_results$instrument%in%instru, ]
and see help page ?%in%
Hope this helps
Andrija
On Thu, Jun 20, 2013 at 12:45 PM, Katherine Gobin katherine_go...@yahoo.com
wrote:
Dear R Forum
I have a data frame as
beta_results = data.frame(instrument = c(ABC, DEF,
Hi. Here is an example of sorting matrix columns:
mat - matrix(10:1, ncol=2, byrow=TRUE)
mat
[,1] [,2]
[1,] 109
[2,]87
[3,]65
[4,]43
[5,]21
apply(mat, 2, function(x) x[order(x)])
[,1] [,2]
[1,]21
[2,]43
[3,]65
[4,]8
?sqlQuery
as.is - argument
Andrija
On Jun 7, 2013 9:10 PM, Sneha Bishnoi sneha.bish...@gmail.com wrote:
Hey all!
I am trying to select a bunch of id's (data type -character) from a table
and store them in a variable in R
But when i do this, it automatically truncates the leading zero's in
PM, andrija djurovic djandr...@gmail.comwrote:
?sqlQuery
as.is - argument
Andrija
On Jun 7, 2013 9:10 PM, Sneha Bishnoi sneha.bish...@gmail.com wrote:
Hey all!
I am trying to select a bunch of id's (data type -character) from a
table
and store them in a variable in R
But when i do
Hi. Check R FAQ, section 7.31 Why doesn't R think these numbers are equal?
http://cran.r-project.org/doc/FAQ/R-FAQ.html
all.equal(a,b)
Andrija
On Mon, May 20, 2013 at 2:36 PM, Jannis bt_jan...@yahoo.de wrote:
Dear R users,
I ran into the strange situation where a number does not seem to
Hi Miao.
1. Calendar, Iris, IQ are the named region in excel file
multiregion.xlsx
(demoFiles/multiregion.xlsx). Open this file (demoFiles/multiregion.xlsx),
go to Formulas tab and click Name manager to see reference regions.
2. Check following functions:
?readWorksheet #arguments startCol,
0.2 barbarica
4 4.6 3.1 1.5 0.2setosa
5 5.0 3.6 1.4 0.2setosa
6 5.4 3.9 1.7 0.4setosa
identical(DF1, DF2)
[1] TRUE
Andrija
On Tue, Apr 23, 2013 at 9:04 AM, andrija djurovic
Hi.
If you want to do it completely in R you can create R gui using gWidgets
package.
Here is an example of creating gui for function arguments (thanks to John
Verzani):
library(gWidgets)
options(guiToolkit=tcltk)
##' An editor for an argument
##' depends on calss of object
arg_editor -
Hi.
It would be easier to help you if you show us the result you are trying to
obtain.
Here are my attempts:
sweep(a,2,div, FUN=/)
[,1] [,2] [,3]
[1,]1 2.0 2.33
[2,]2 2.5 2.67
[3,]3 3.0 3.00
or
a/matrix(rep(div,3),ncol=3, byrow=TRUE)
[,1] [,2]
Hi.
You can try with argument skip in read.csv function(check ?read.csv).
Also, if you want directly to import an Excel file you can use
readWorksheet function from XLConnect package and use argument startRow to
set up the first row to read from.
Hope this helps.
Andrija
On Thu, Apr 18, 2013
Hi.
Here is one approach:
options(scipen=300)
numb -
73167176531330624919225119674426574742355349194934969835203127745063262395783180169848018694788518438586156078911294949545950173795833195285320880551112540698747158523863050715693290963295227443043557
strsplit(as.character(numb), )
blocks -
Hi Igor.
Here is one way:
DF - read.table(textConnection(90.1194354
87.94788274
80.34744843
64.06080347
30.40173724
0
0
0
0
0
16.28664495
23.88707926
29.31596091
48.85993485
13.02931596
0
0
0
7.600434311
20.62975027
29.31596091
32.5732899), header=FALSE)
a - DF$V1[which(DF$V1!=0)]
indx -
Hi.
I completely forgot split function so loop:
l - vector(list, n_levels)
for(i in 1:n_levels)
{
l[[i]] - a[blocks==levels(blocks)[i]]
}
l
could be substitute with:
split(a, blocks),
but anyway Rui's solution is better.
Andrija
On Thu, Apr 18, 2013 at 1:18 PM, andrija djurovic djandr
?rep
On Wed, Apr 17, 2013 at 11:11 AM, Katherine Gobin katherine_go...@yahoo.com
wrote:
Dear R forum
I have a data.frame
df = data.frame(dates = c(4/15/2013, 4/14/2013, 4/13/2013,
4/12/2013), values = c(47, 38, 56, 92))
I need to to create a vector by repeating the dates as
katherine_go...@yahoo.com
wrote:
Dear Andrija Djurovic,
Thanks for the suggestion. Ia m aware of rep. However, here I need to
repeat not only dates, but a string Current_date. Thus, I need to create
a vector ( to be included in some other data.frame) with the name say dt
which will contain
dt
Hi.
Thanks once more for helping me out.
Beside that you gave me a nice idea and here is the sample code of dashboard
for an R-powered race car that you can't wait to see :)
library(animation)
library(jpeg)
# Original code by Gaston Sanchez
# http://www.r-bloggers.com/gauge-chart-in-r/
#
Hi. Thanks for help.
In meanwhile some of contributors already send me the same link with
examples.
I agree with you and I am not trying to drive a race car just to do what
was asked from me :)
Andrija
On Wed, Apr 3, 2013 at 11:24 AM, Barry Rowlingson
b.rowling...@lancaster.ac.uk wrote:
On
Hi useRs.
Does anybody know if there is some function that creates speedometer chart
in R? Or if anybody has proposals where to start looking and which
functions I can modify in order to create this kind of chart?
Thanks for any help
Andrija
[[alternative HTML version deleted]]
Hi all.
I would like to highlight overlapping regions of two densities and I could
not find a way to do it.
Here is the sample code:
myd - c(2,4,5, 4,3,2,2,3,3,3,2,3,3,4,2,4,3,3,3,2,2.5,
2, 3,3, 2.3, 3, 3, 2, 3)
myd1 - myd-2
plot(range(density(myd)$x, density(myd1)$x),
suggestion ?
Pierrick Bruneau
CRP Gabriel Lippmann
On Wed, Mar 20, 2013 at 1:32 PM, andrija djurovic djandr...@gmail.comwrote:
Hi all.
I would like to highlight overlapping regions of two densities and I could
not find a way to do it.
Here is the sample code:
myd - c(2,4,5
yy - apply(cbind(d0$y[idx0], d1$y[idx1]), 1, min)
xx - d0$x[idx0]
xx - c(xx[1], xx, xx[1])
yy - c(0, yy, 0)
polygon(xx, yy, col = blue)
Hope this helps,
Rui Barradas
Em 20-03-2013 12:32, andrija djurovic escreveu:
Hi all.
I would like to highlight overlapping regions of two
Hi,
see function ?head or [.
If DF is you data frame, top n values of DF you can select with head(DF, n)
or DF[1:n, ]...
Andrija
On Sun, Feb 10, 2013 at 11:31 AM, catalin roibu catalinro...@gmail.comwrote:
Dear R users,
I have a problem. I don't know how to select the top 10 (n) values for
Here are some examples of data aggregation functions in R:
http://www.slideshare.net/djandrija/data-aggregation-in-r
http://www.psychwire.co.uk/2011/04/data-aggregation-in-r-plyr-sqldf-and-data-table/
Andrija
On Mon, Feb 4, 2013 at 10:29 AM, Benjamin Gillespie gy...@leeds.ac.ukwrote:
Hi
set.seed(2211)
x - rnorm(100)
#get your working directory
getwd()
#save it as pdf
pdf(hist.pdf)
hist(x)
dev.off()
On Tue, Jan 29, 2013 at 10:22 PM, hp wan huaping@gmail.com wrote:
Can you implement it using my provided example? I read the user guide
about dev.copy2pdf
but I still
hi
try with plyr library and function ddply
Andrija
On 30 Aug 2012 12:58, Sam Steingold s...@gnu.org wrote:
Is there a way for an apply-type function to return a data frame?
the closest thing I think of is
foo - as.data.frame(sapply(...))
names(foo) - c()
is there a more elegant
I forgot to mention data.table package and also function aggregate as part
of base R functions could be useful here
Andrija
On 30 Aug 2012 13:09, andrija djurovic djandr...@gmail.com wrote:
hi
try with plyr library and function ddply
Andrija
On 30 Aug 2012 12:58, Sam Steingold s
Hi.
I don't know how did you create data frame X but if you check str(X) you
will see that you have one or more factors inside.
Try using stringsAsFactors=FALSE options while creating data frame.
Hope this helps.
Andrija
On Thu, Jul 26, 2012 at 3:23 PM, namit saileshchowd...@gmail.com wrote:
Hi. Try this:
a=c cb
Andrija
On Tue, Jul 17, 2012 at 9:02 AM, arunkumar akpbond...@gmail.com wrote:
Hi
I 've a data
a=c(10,20,30)
b=c(100,200,300)
c=c(50,60,70)
I want to compare a[1]=c[1]b[1],..
How to compare for all the records
-
Thanks in Advance
Arun
Hi.
You should check function addtable2plot from plotrix package.
Also, here is an example of modified addtable2plot function that I
sometimes use.
This function is probably to far from perfect but, maybe, it will give you
some ideas how to solve your problem:
t2p - function(x=par(usr)[1],y=
Hi. Maybe this:
ct - table(test)
as.numeric(names(ct[ct==max(ct)]))
test[test[,1]%in%as.numeric(names(ct[ct==max(ct)])),,drop=FALSE]
?
Andrija
On Wed, Jul 11, 2012 at 8:33 PM, Amanduh320 aadam...@uwo.ca wrote:
I'm stuck on a seemingly simple problem. I'm trying to subset the data by
several
Hi. Here are some examples that could be useful here:
set.seed(1)
x - sample(1:2, 100, rep=T)
y - sample(1:3, 100, rep=T)
TAB - table(x,y)
#check the object class
class(TAB)
apply(TAB, 2, max)
apply(TAB[,2:3], 2, max)
apply(TAB, 1, max)
DF - as.data.frame.matrix(TAB)
class(DF)
sapply(DF, max)
Hi. Try with following functions:
?intersection
?%in%
?[
Perhaps someone will provide you more help if you read and follow posting
guide
http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html
Andrija
On Tue, Jun 26, 2012 at 5:03 PM, ÷ÁÓÉÌØÞÅÎËÏ áÌÅËÓÁÎÄÒ
Hi. Yes it is possible.
Here is one approach:
DF - read.table(textConnection(
Unit DayHour Price Flag
afd11/2/20031 1 N
afd11/2/20031 2 N
afd11/2/20031 3 N
afd11/2/20031 4 Y
dcf11/2/2003
Hi. Try:
as.data.frame(cbind(a[,1],a[,2]))
Andrija
On Wed, Jun 6, 2012 at 9:51 PM, Joshua Budman josh.bud...@gmail.com wrote:
Hi,
I am trying to process genomics data and the presence of both
characters and integers in an array is giving issues. The following is
an example:
Hi. You can do something like this:
gsub(\\|\\|Leukotriene A4 hydrolase,,LTA4H||Leukotriene A4 hydrolase)
Andrija
On Wed, Jun 6, 2012 at 10:45 PM, Bill Hyman billhym...@yahoo.com wrote:
Dear all,
Does any one know how to remove part of the string?
For example, LTA4H||Leukotriene A4
Hi. Rui already gave you a solution.
Beside that you can, also, use substr function in this concrete example:
substr(LTA4H||Leukotriene A4 hydrolase, 1, 5)
This can be adjusted to rest of your data also, but you haven't provided
enough information.
Andrija
On Wed, Jun 6, 2012 at 11:27 PM, Rui
Hi.
rollapply function for zoo package could be a useful here.
library(zoo)
?rollapply
Andrija
On Fri, May 25, 2012 at 5:22 PM, bantex bantexmutat...@hotmail.com wrote:
hi guys,
I am using trivariate VAR model to get 10 step ahead orthogonalized impulse
response functions. I want to use
Hi.
try using table function:
ID=c(1,1,1,1,2,2,2,2,3,3,3,3)
table(IF)
ID
1 2 3
4 4 4
Also check ?tapply function
Andrija
On Fri, May 25, 2012 at 5:38 PM, Charles Determan Jr deter...@umn.eduwrote:
Hello,
Simple question that I am stuck on and can't seem to find an answer in the
help
Hi.
I use RODBC for importing Excel files quiet often and never got the
similar problem.
Have you tried with sqlQuery?
z - odbcConnectExcel(./BBaselinePtQaires_apr2011.xls)
BQ - sqlQuery(z, select * from [BBaselinePtQaires$])
Andrija
On Fri, Apr 20, 2012 at 11:57 PM, Jeff Newmiller
RODBC
On Mon, Apr 16, 2012 at 11:40 AM, Partha Sinha pnsinh...@gmail.com wrote:
Dear All
please let me know how to connect SQL server from R? which all
packages I will require for this?
Thanks
Parth
__
R-help@r-project.org mailing list
Hi all.
I found one situation, on my OS - Windows 7, where R stops working
with reported error R for Windows GUI front-end has stopped working.
Here is the example:
library(plyr)
DF - data.frame(x=c(1:3, NA, NA), y=factor(sample(1:3,5,rep=T),levels=1:5))
DF[DF$x3, ]
#this works properly
)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
The problem is in a C function from the plyr package, so you need to take it
up the maintainer.
-pd
On Apr 14, 2012, at 11:28 , andrija djurovic wrote:
Hi all.
I found one situation, on my OS
Hi,
here are some solutions:
DF - read.table(textConnection(
A B C
1 1 3
1 1 4
1 1 5
1 2 6
1 2 7
1 3 8 ), header=TRUE)
#using sqldf package
library(sqldf)
sqldf(select A, B, count(*)
from DF
group by
Hi. You can try this:
df[type%in%type_list, ]
You can also use sqldf package and subset data frames usign sql statements:
library(sqldf)
df - data.frame(x1=1:10, type=10:1)
type_list - data.frame(index=seq(1,10,by=2))
sqldf(select df.*
from df
where df.type in (select * from
Hi.
Maybe this will help you:
set.seed(1)
temp - 1:100
v - rnorm(100)
temp[temp16 | temp38]
v[temp16 | temp38]
Andrija
On Wed, Feb 29, 2012 at 7:09 PM, babyluck madr...@gmx.ch wrote:
Dear helpers
I have two data sets saved as vectors (temperature and velocity). Now I need
to take out a
Hi.
You can do something like this:
df - read.table(textConnection(
GenRep
A_1 1
A_1 2
A_2 1
A_2 2
B_1 1
B_1 2
B_3 1
B_3 2
OP1_1 1
OP1_1 2
OP1_5 1
OP1_5 2),header=TRUE,stringsAsFactors=FALSE)
str(df)
#adding a new column
cbind(df,ncol =
Hi.
If I understood you correctly here is one approach to your solution:
k - 5
mat - diag(1,nrow=k,ncol=k)
set.seed(10)
samp - mat[sample(1:k,3,rep=FALSE),]
samp
[,1] [,2] [,3] [,4] [,5]
[1,]00100
[2,]01000
[3,]00010
#check
Hi. You can do something like this:
#find the most frequent values of x
t - table(x)
t[t==max(t)]
5
8
#sort table t based on frequencies
t[order(as.numeric(t),decreasing = TRUE)]
x
5 6 4 17 1 2 13 30 100 300
8 5 4 2 1 1 1 1 1 1
#extract any range from sorted
Hi. You can use expand.grid here
expand.grid(x,y,z)
Andrija
On Wed, Jan 4, 2012 at 5:32 PM, jeremy jeremynamer...@gmail.com wrote:
Hi all,
I'm trying to combine exhaustively several character arrays in R like:
x=c(one,two,three)
y=c(yellow,blue,green)
z=c(apple,cheese)
in order to get
Hi. You assign two times different values to variable label. Try this
and i hope you will notice a mistake:
i=1
label - paste(score, i, sep=_)
label
assign(label, x1+(x2*i) )
label
Instead of this you can do something like:
rm(list=ls())
n = 10
set.seed(1)
x1 = rnorm(n,0)
x2 = rnorm(n,0)
Hi. Here is one approach:
if (length(b)0) data[,-b] else data
Andrija
On Thu, Dec 8, 2011 at 1:25 PM, Vikram Bahure economics.vik...@gmail.comwrote:
Dear R users,
I have a very simple query.
I am using the following command, which should give me row no. for the
matching colnames. It
Hi all. I tried to calculate sum of deviations from the weighted mean and i
didn't get what i expected - 0. Here is an example:
wt - c(10,25,38,22,5)
x - 6:10
wm - weighted.mean(x,wt)
(x-wm)*wt
[1] -18.70 -21.75 4.94 24.86 10.65
sum((x-wm)*wt)
[1] -1.24345e-14
With simple mean I got 0:
:15 AM, andrija djurovic djandr...@gmail.com wrote:
Hi all. I tried to calculate sum of deviations from the weighted mean
and i
didn't get what i expected - 0. Here is an example:
wt - c(10,25,38,22,5)
x - 6:10
wm - weighted.mean(x,wt)
(x-wm)*wt
[1] -18.70 -21.75 4.94 24.86
Hi. Maybe this will help you:
expand.grid(x,y,z)
apply(expand.grid(x,y,z),1, function (x) paste(x[1], x[2], x[3], sep=))
Andrija
On Tue, Dec 6, 2011 at 1:53 PM, Gaj Stan (BIGCAT)
stan@maastrichtuniversity.nl wrote:
Hello fellow R-users,
Given are three vectors and the outcome would be
Hi to all.
I have a problem to connect to an Excel database using RODBC.
Namely, I am using 64-bit R 2.14.0, under Windows 7 and I tried following:
library(RODBC)
channel - odbcConnectExcel(results.xlsx)
Error in odbcConnectExcel(results.xlsx) :
odbcConnectExcel is only usable with 32-bit
...@gmail.com wrote:
Do you need to use RODBC specifically? I've been using XLConnect quite a
lot recently and have been quite pleased with it.
Michael
On Dec 4, 2011, at 9:40 AM, andrija djurovic djandr...@gmail.com wrote:
Hi to all.
I have a problem to connect to an Excel database using RODBC
Hi. Maybe this can help you (you can try additionally to incorporate
threshold):
set.seed(1)
x-rnorm(10,10,1)
values - sample(1:10,10) #values that we are looking for
mat - matrix(c(x,values),ncol=2)
closest-function(x,values)#function is an example from The R book
(Crawley)
+ {
+
Hi. One approach is using replicate. See ?replicate:
replicate(3,rnorm(100,1,2))
Andrija
On Sat, Dec 3, 2011 at 7:10 PM, Martin Zonyrah martin20...@yahoo.comwrote:
Hi,
I need help. I am trying to iterate this command x - rnorm(100, 1.0,
2.0) one hundred times in R but I don't seem to have
Hi Brad. Maybe something like this:
lapply(rep(1,6), function(x) rnorm(10,0,1))
Andrija
On Sat, Dec 3, 2011 at 8:21 PM, B77S bps0...@auburn.edu wrote:
Hi Michael,
How would you do this with lapply to return a list?
I can't seem to get that to work (I haven't used these much and am trying
?eval
s- expression(log(a+b))
a-1
b-2
eval(s)
Andrija
On Sun, Nov 27, 2011 at 11:16 AM, Victor vdem...@gmail.com wrote:
I would like to make a string executable, e.g,
s- ln(a+b)
a-1
b-2
execute string s to obtain ln(a+b)
How can I make it?
Ciao fron Rome
Vittorio
Hi.
You haven't specified object to store results.
Try something like:
dat = c() #or dat = list() or matrix with specified ncol and nrow
for(i in 1:20){
dat[i]=complete(dat.mice,[i]
}
On Sun, Nov 27, 2011 at 4:02 PM, Christopher Desjardins desja...@umn.eduwrote:
Hi,
I have a pretty simple
Hi.
May be this:
df = data.frame( A=c('a','b','c'), B=c(1,2,3), C=c(10,20,30),
stringsAsFactors=FALSE)
newrow = c('X', 100, 200)
rbind(df,newrow)[c(1,4,2,3),]
Andrija
On Thu, Nov 24, 2011 at. 6:05 PM, Sammy Zee szee2...@gmail.com wrote:
Is there easy way (without copying the existing rows
Hi,
one solution is to use sink. Check ?sink to see explanation and following
example.
sink(sink-examp.txt)
i - 1:10
outer(i, i, *)
sink()
Andrija
On Tue, Nov 1, 2011 at 10:43 AM, AlexC alexandre.chaus...@unil.ch wrote:
Hello,
Thank you for your replies. I cannot run the function rcor.test
Hi,
you are almost there:
sapply(x, function(x) quantile(as.numeric(x), c(0.01, 0.99)))
x1 x2 x3x4 x5 x6
1% 0.0351777 0.007628441 0.225533 0.4459064 1 1
99% 0.9938919 0.964901423 1.826894 3.6226944 3 2
Andrija
On Mon, Oct 31, 2011 at 2:09 PM, aajit75
Or this:
str(x)
'data.frame': 100 obs. of 6 variables:
$ x1: num 0.4548 0.0352 0.6353 0.6017 0.8588 ...
$ x2: num 0.849 0.335 0.986 0.617 0.212 ...
$ x3: num 1.35 0.46 1.67 1.23 1.14 ...
$ x4: num 2.67 0.91 3.31 2.48 2.28 ...
$ x5: Factor w/ 3 levels 1,2,3: 3 1 3 3 3 1 2 3 3 1 ...
$
as.logical(c(1,0,1,1))
[1] TRUE FALSE TRUE TRUE
?as.logical
On Sun, Oct 30, 2011 at 8:50 PM, Alaios ala...@yahoo.com wrote:
probably you mean
For [-indexing only: i, j, ... can be logical
vectors, indicating elements/slices to select. Such vectors
are recycled if
-project.org]
On Behalf Of Alaios
Sent: Sunday, October 30, 2011 1:40 PM
To: andrija djurovic
Cc: R-help@r-project.org
Subject: Re: [R] why the a[-indx] does not work?
I think this does the work
return(m[!as.logical(data)])
I am not sure though if this is the same with
return(m
Hi Boris.
Here is one approach:
N-100
a-rep(0,N)
a[sample(N,1)]-1
a
which(a==1)
Look ?sample, ?which.
Andrija
On Thu, Sep 8, 2011 at 10:42 AM, Boris Beranger borisberan...@gmail.comwrote:
Hi everyone,
I have a zero vector of length N and I would like to randomly allocate the
value 1 to
Hi R users.
sorry for missing example and if question is to general but I am wondering
if it is possible to execute subqueries in function sqlQuery (package RODBC)
with opened connection with Excel or SQL server 2000. I couldn't find any
example of this.
And if it is possible what should be a
to solve
this problem?
On Wed, Aug 10, 2011 at 10:16 AM, Prof Brian Ripley
rip...@stats.ox.ac.ukwrote:
In what sense is this a 'subquery'? It is just an SQL command (write it on
one line, no terminating ;, which is not part of the query).
On Wed, 10 Aug 2011, andrija djurovic wrote:
Hi R
Hi.
There is no need to do this in a for loop.
Here is one approach:
x - read.table(textConnection(Site Prof H
1 1 24
1 1 16
1 1 67
1 2 23
1 2 56
1 2 45
2 1 67
2 1 46), header = TRUE)
closeAllConnections()
x
] On Behalf Of andrija djurovic
Sent: Tuesday, May 03, 2011 11:28 AM
To: Woida71
Cc: r-help@r-project.org
Subject: Re: [R] Simple loop
Hi.
There is no need to do this in a for loop.
Here is one approach:
x - read.table(textConnection(Site Prof H
1 1 24
1 1
Hi.
Have a look also at ?addmargins.
addmargins(table(fS,fF),c(1,2),FUN=list(total.row=sum,total.col=sum))
Andrija
On Fri, Apr 15, 2011 at 3:29 PM, Dmitry Berman ravenb...@gmail.com wrote:
Listers,
I have created a cross-tab matrix using the following code:
S -
Sorry, I've just reversed the names of dimensions :)
addmargins(table(fS,fF),c(1,2),FUN=list(total.col=sum,total.row=sum))
Andrija
On Fri, Apr 15, 2011 at 3:50 PM, andrija djurovic djandr...@gmail.comwrote:
Hi.
Have a look also at ?addmargins.
addmargins(table(fS,fF),c(1,2),FUN=list
hi:
here is one solution:
cat-as.factor(c(1,1,3,2,4))
model.matrix(~cat-1,cat)
cbind(cat,model.matrix(~cat-1,cat))
Andrija
On Tue, Apr 12, 2011 at 2:17 PM, Shane Phillips sphill...@lexington1.netwrote:
I have a categorical variable in a dataframe similar to the following...
cat
1
1
3
2
Hi:
Here is one solution:
a-factor(c(1,2,4,5,6))
b-factor(c(2,2,4,5,5))
b1-factor(b,levels=c(levels(b),levels(a)[levels(a)%in%levels(b)==FALSE]))
table(a,b1)
but be aware that levels of b is a subset of levels of a.
Andrija
On Wed, Apr 6, 2011 at 10:39 AM, suparna mitra
Hi:
try this and have a look at ?cut just to change the lables:
data.frame(
weeks=sprintf('%s %d','week',1:30),
specialweeks=cut(1:30,c(0,2,5,12,18,19,20),right = FALSE))
Andrija
On Tue, Apr 5, 2011 at 1:20 PM, beatleb rhelpfo...@gmail.com wrote:
Dear R-useRs,
I am looking for a why to
Hi:
here is one solution. Not so elegant but maybe it will give you some ideas:
mylist1-rep(mylist,c(2,2))
a-matrix(c(index1,!index1,index2,!index2),ncol=4)
mylist2-list()
for (i in 1:4)
{
mylist2[[i]]-mylist1[[i]][,a[,i]]
}
mylist2
Andrija
On Sun, Apr 3, 2011 at 6:56 PM, Axel Urbiz
HI,
here is another solution:
int - sample(1:20,10)
int
[1] 10 4 5 2 14 17 9 11 16 13
mat-matrix(11:30,ncol=4)
mat
[,1] [,2] [,3] [,4]
[1,] 11 16 21 26
[2,] 12 17 22 27
[3,] 13 18 23 28
[4,] 14 19 24 29
[5,] 15 20 25 30
mat[apply(mat,1,
Hi everybody.
I have list like this:
l-list(data.frame(q1=c(1,2,check),q2=c(3,check,5)),
data.frame(q1=c(check,1),q2=c(4,5)))
names(l)-c(A,B)
rownames(l[[1]])-c(aa,bb,cc)
rownames(l[[2]])-c(aa,bb)
Every object has the same number of columns but different number of rows.
Does anyone know if it
Dallazuanna www...@gmail.comwrote:
Use dput:
dput(l, file = l_str.txt)
Then, to read again:
l - dget(file = 'l_str.txt')
On Wed, Mar 16, 2011 at 11:55 AM, andrija djurovic djandr...@gmail.com
wrote:
Hi everybody.
I have list like this:
l-list(data.frame(q1=c(1,2,check),q2=c(3,check,5
Thanks everyone for different solutions.
Every solution works very well. For my purpose, this function sink does what
I was looking for.
Andrija
On Wed, Mar 16, 2011 at 4:23 PM, Roman Luštrik roman.lust...@gmail.comwrote:
How about?
sink(andrija.csv)
l
sink()
--
View this message in
Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of David Winsemius
Sent: Tuesday, 15 March 2011 6:29 AM
To: andrija djurovic
Cc: r-help@r-project.org
Subject: Re: [R] data.frame transformation
On Mar 14, 2011, at 3:51 PM, andrija djurovic wrote
Hi,
maybe this:
df-data.frame(a=c(1,2,3,Inf,4,Inf),b=c(Inf,2,3,4,5,8))
df[apply(df,1, function(x) !any(x==Inf)),]
df[apply(df,1, function(x) any(x==Inf)),]
Andrija
On Tue, Mar 15, 2011 at 10:44 PM, Alexy Khrabrov delivera...@gmail.comwrote:
How do I apply a function to every row of a
1 - 100 of 114 matches
Mail list logo