Displaying 20 results from an estimated 20000 matches similar to: "Label rows of table by factor level for groups of factors"
2013 Apr 24
1
Floating point precision causing undesireable behaviour when printing as.POSIXlt times with microseconds?
Dear list,
When using as.POSIXlt with times measured down to microseconds the default format.POSIXlt seems to cause some possibly undesirable behaviour:
According to the code in format.POSIXlt the maximum accuracy of printing fractional seconds is 1 microsecond, but if I do;
options( digits.secs = 6 )
as.POSIXlt( 1.000002 , tz="", origin="1970-01-01")
as.POSIXlt( 1.999998 ,
2012 Nov 22
4
Data Extraction
Hello,
I would appreciate if someone could help me resolve the following:
1. df1[!is.na( X1 | X2 | X3 | X4 | X5),][,1:5] # This does not work
2. Is these message harmful? The following object(s) are masked from 'df1 (position 3)':
X1, X2, X3, X4, X5
Thanks,
Pradip Muhuri
#Reproducible Example
set.seed(5)
df1<-data.frame(matrix(sample(c(1:10,NA),100,replace=TRUE),ncol=5))
2010 Sep 02
2
lower triangle of the correlation matrix with xtable
Dear all,
mydata<-data.frame(x1=c(1,4,6),x2=c(3,1,2),x3=c(2,1,3))
cor(mydata)
x1 x2 x3
x1 1.0000000 -0.5960396 0.3973597
x2 -0.5960396 1.0000000 0.5000000
x3 0.3973597 0.5000000 1.0000000
I wonder if it is possible to fill only lower triangle of this
correlation matrix? Using 'dist' doesn't seem to be useful as it doesnt
allow to convert this table
2011 May 25
1
Time and db precision
I have a loop that regularly checks for new data to analyse in my database. In order to facilitate this, the database table has a timestamp column with the time that the data was inserted into the database. Something like this:
while (....) {
load(timetoken.Rdata)
df <- sqlQuery(con, paste("SELECT * FROM tabledf WHERE timestamp > ", timetoken, sep = ""))
2009 Apr 15
2
How to Reshuffle a distance object
I would like to randomly shuffle a distance object, such as the one
created by ade4{dist.binary} below. My first attempt, using
sample(jc.dist) creates a shuffled vector, losing the lower triangular
structure of the distance object. How can I Ishuffle the lower
triangular part of a distance matrix without losing the structure?
Thanks. --Dale
x1 <- c(rep(0,4),1)
x2 <- c(rep(0,2),rep(1,3))
2012 Mar 19
2
Save File after order
Hello,
??? I'm trying to write the sorted data in a file of a data.frame, My
question and my problem is that when I record in file adds a new column
row.name, which apparently is the original position in the file.
??? I wanted to write to the file without this column
x<-data.frame(name="x1",Time=20)
x<-rbind(x,data.frame(name="x2",Time=25))
2011 Dec 03
2
help in removal of fixed pattern
Hi
I have column name as given below
If the variable is in log(X1 + 1) pattern it should be removed and i need
only X1
Input
log(x1 + 1)
x2
log(X3 +1)
Expected Output X1 X2 X3
Please help me
--
View this message in context: http://r.789695.n4.nabble.com/help-in-removal-of-fixed-pattern-tp4152524p4152524.html
Sent from the R help mailing list archive at Nabble.com.
2012 Feb 17
5
How to change the order of columns in a data frame?
Dear all,
I have a data frame in which the columns need to be ordered. The first column X is at the right position, but the remaining columns X1-Xn should be ordered like this: X1, X2, X3 etc instead of like below.
> colnames(pos1)
[1] "X" "X1" "X10" "X11" "X12" "X13" "X14" "X15" "X16"
2011 Jun 03
1
Surv(): Stop time must be > start time, NA created
I am writing to get a better handle on a warning I am getting from a coxph analysis I am doing.
I am analysing age of onset of dementia *after* the onset of parkinson disease. My data looks like:
age.park age.dem age.death censor x1 x2 x3 x4
1 76 87 88 0 16 33 E3 E3
2 75 84 84 0 33 36 E3 E3
3 77 81 81 1 NA NA
2012 Jan 09
6
runif with condition
Hi
I want to generate 4 random number which sum up to 100 always
Please help
-----
Thanks in Advance
Arun
--
View this message in context: http://r.789695.n4.nabble.com/runif-with-condition-tp4278704p4278704.html
Sent from the R help mailing list archive at Nabble.com.
2012 Aug 01
3
help with a regression problem
Hello,
I have a big data frame where consecutive time dates and corresponding observed values for each subject (ID) are on a line. I want to compute the linear slope for each subject. I would like to use apply but I do
not know how to express the corresponding function. An example using a loop follows
#
# create dummy data set There are missing values
a <- c(1,2,3,4, 1,1,1,1, 2,2,3,3,
2006 Dec 04
1
package mgcv, command gamm
Hi
I am an engineer and am running the package mgcv and specifically the
command gamm (generalized additive mixed modelling), with random
effects. i have a few queries:
1. When I run the command with 1000/2000 observations, it runs ok.
However, I would like to see the results as in vis.gam command in the
same package, with the 3-d visuals. It appears no such option is
available for gamm in the
2011 Jun 21
2
WG: R-Problem
Dear forumites
As a newbie I try to figure out whether R can do a certain job quicker than other programs and it seems so, but I don't find a solution to a seemingly simple problem:
I have built a matrix of distance with as.matrix(dist()) with several hundred rows and columns
1 2 3 4
1 0 1.3 1.6 2.1
2 1.3 0
2011 Mar 09
4
Extracting only odd columns from a matrix
Hi,
This might seem like a simple question but at the moment I am stuck for ideas. The columns of my matrix in which some data is stored are of this form:
X1 Y1 X2 Y2 X3 Y3 ... Xn Yn
with n~100. I would like to look at just the X values (i.e. odd column numbers). Is there an easy way to loop round extracting only these columns?
Any help would be appreciated.
2012 Sep 26
3
map two names into one
Dear R user:
I have got the following problem:
I have imported two data sets into R: one set includes price information, another one includes volume information. but I noticed the wrong data order problem in the product name,
for instance,
in one data set,
"GALAXY ACE S 5830"
in another one,
it is "S 5830 GALAXY ACE"
both represent same product. how do i map two name
2011 Aug 25
4
{R} How to extract correctly from vector?
Dear list,
I have problem that I cannot solve and would like to ask your opinion. I
tried to ask a few days ago already but got no answer and all my attempts to
solve it by myself since then failed. Sorry for repeated posting! Here the
problem broken down a bit.
My problem basically is, that I want to use the elements of a character
vector as names for objects and by recalling only the
2011 Mar 22
1
help need on working in subset within a dataframe
Dear R-experts
Execuse me for an easy question, but I need help, sorry for that.
>From days I have been working with a large dataset, where operations are
needed within a component of dataset. Here is my question:
I have big dataset where x1:.....x1000 or so. What I need to do is to work
on 4 consequite variables to calculate a statistics and output. So far so
good. There are more vector
2010 Sep 16
1
Local Variable
Dear All,
I have a function:
gen <- function(m){for(i in 1:m){assign(paste("x",i, sep=""),
(7*get(paste("x",i-1,sep="")))%%13); print(get(paste("x", i, sep="")))}}
my question is, I do gen(20), then the function prints out 20 values,
however when I do objects(), I can't see x1,x2,x3,....,x20 as objects. Why?
Are they local
2012 Mar 08
8
Copy dataframe for another
I'm trying to copy the results of a dataframe to another within a cycle for
but I am not able to implement the rbind, because give th
d<-Null
df<-NULL
for(r in 2: nrow(x))
{
val_user<-x.name[[r]]
pos<-x.pos[[r]] -4
age <-x.age[[r]]
d<-data.frame(val_user,pos,)
print(d)
}
df<-rbind(df,d)
}
someone can help me solve this
Thanks
2009 Apr 22
4
read.table or read.csv without row index?
Hello all,
Probably my concepts about the data.frame and matrix and array in R
are not clear, I need some clarification to help me understand them
better.
>M <- read.table("test1.csv",sep=",",row.names=NULL,header=T)
gives me: M as
M1 M2 M3 M4 M5 M6 M7 M8 M9 M10
1 9 11 14 15 18 20 20 20 20 20
2 3 4 8 9 11 12 14 15 15 15
3 4 5 8 8 9 9 9 9 9 9
4 4