Displaying 20 results from an estimated 20000 matches similar to: "matrix position to list of coordinates"
2020 Sep 24
1
How to use `[` without evaluating the arguments.
Hello R-devel,
I am currently attempting to implement an API similar to data.table wherein single bracket subsetting can accept an unquoted expression to be evaluated in the context of my object.
A simple example from the data.table package looks like this:
DT <- data.table(col1 = c('a', 'b', 'c'), col2 = c('x', 'y', 'z'))
DT[col1 ==
2011 Dec 14
2
plot matrix of characters
Hi, I am looking for options to plot the following type of matrices:
"A" "B" "C" "D"
"A" "A" "C" "C"
"A" "A" "A" "C"
as a image like this: http://www.phaget4.org/R/image002.jpg
2011 Dec 13
4
sum with dates
How do I sum 15 years to my dataset?
original dataset
dates val
1 2001-01-12 1.2
2 2001-02-12 1.2
3 2001-03-12 1.2
result
dates val
1 2016-01-12 1.2
2 2016-02-12 1.2
3 2016-03-12 1.2
2011 Nov 08
3
lapply to list of variables
Hi
Can someone help me with this?
How can I apply a function to a list of variables.
something like this
listvar=list("Monday","Tuesday","Wednesday")
func=function(x){x[which(x<=10)]=NA}
lapply(listvar, func)
were
Monday=[213,56,345,33,34,678,444]
Tuesday=[213,56,345,33,34,678,444]
...
in my case I have a neverending list of vectors.
Thanks!
2012 Feb 06
3
Logistic Regression
I am looking for R packages that can make a Logistic Regression model
with parameter estimation by Maximum Likelihood Estimation.
Many thanks for helping out.
2011 Jul 29
5
HIRHAM netcdf files
Can someone help me out with a "small" problem?
I've started using netcdf files recently, and I want to extract the grid id
and also the coordinates from a HIRHAM netcdf file.
I know how to extract a slice of dataset both in space and in time and I
also know the area that this file should cover, however I have no idea
regarding the reference for both LAT/LON and RLAT/RLON.
I tried
2012 Jan 05
3
save output of print() to txt file
I am looking for other option to write the output of the print command in R
I am using sink() to write the R output to a file. This is similar to
what I have:
> a=c(1:30)
> a
[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
23 24 25 26 27 28 29 30
> sink("vectorA.txt");print(a);sink()
I am looking for othe roptions to save the output of the print()
2006 Aug 18
1
Boxplot Help
Hello R-users and developers,
Once again, I'm asking for your help.
I can identify outliers in boxplot with this instruction
result <- boxplot( Income ~ Sex, col = "lightgray", data=dados)
if (length(result$out))
text(result$group, result$out, result$out, pos = 4, col = "red")
But I can not identify the outlier's id (variable names) in the boxplot.
2011 Dec 28
3
transparency using plot+points with sp classes
How can I make one point graphics with transparency
These are all sp classes:
plot(polygons_area,axes=TRUE,asp=1.5,main="Title",xlab="Latitude",
ylab="Longitude")
points(observations2000,type = "p",pch=21,col="green")
points(observation1999,type = "p",pch=21,col="blue")
points(reference.points,type =
2006 Dec 10
4
sample "n" random positions from a matrix
Hi there,
I have a binary matrix (dim 100x100) filled with values 0 and 1. I need select a record "n" positions of that matrix when values are 1. How can I do that?
Thanks for all,
Miltinho
Brazil
---------------------------------
[[alternative HTML version deleted]]
2011 Nov 28
5
window manager interface commands for linux
How can i replicate this in Linux:
source(file.choose())
I've tried source(tkgetOpenFile()) but with no luck
2012 Feb 03
3
strftime - Dates from Excel files
Hi
I have many excel files were the Date field was not declared as date,
so the dates look like this: 1/2/1978
I know that the format is day/month/year
How can I make R change this to Date format?
If I use strftime, I get wrong dates:
dataset=c("1/2/1978")
strftime(dataset,"%d/%m/%Y")
"19/02/0001"
Thanks in advance.
2009 Jul 24
2
Stting non-overlaping text positions
Dear List
I am having problems to set text labels in a scatter plot. At some areas dots
are close and labels overlap and texts cannot be read. I have too many dots
to adjust this manually. Is there any function that will calculate the label
offsets to avoid this overlapping problem?
Thanks
Ana
--
Ana Conesa
Bioinformatics and Genomics Department
Centro de Investigaciones Principe Felipe
2012 Feb 08
4
String position character replacement
Hi,
Is there a way to efficiently replace specified indices in a string with another character? For example, if I had a vector of strings such as
[1] "hellohowareyoudoing"
[2] "imgoodhowareyou"
[3] "goodandyou"
[4] "yesimgoodijusttoldyou"
[5] "ohyesthatsright"
and had a list of positions that I want to replace with the character "-"
2024 May 21
1
wrtiteBin in conjunction with seek : the position in the file is not good when writing
? Tue, 21 May 2024 11:29:33 +0200
Laurent Rhelp <laurentRHelp at free.fr> ?????:
> pos <- seek(con_in,2,origin="start")
> # We have to repeat the command to return the good amount of read
> # bytes
> print(paste0("pos is not equal to 2, pos = ",pos))
That's because seek() returns the previous position ("before any
move", the one that the
2008 Oct 31
4
[ifelse] how to maintain a value from original matrix without probs?
Dear all,
I have a matrix with positive and negative values.
>From this I would like to produce 2 matrices:
1st - retaining positives and putting NA in other positions
2nd - retaining negatives and putting NA in other positions
and then apply rowMeans for both.
I am trying to use the function ifelse in the exemplified form:
ifelse(A>0,A,NA)
but by putting A as a 2nd parameter it
2011 Apr 27
6
Assignments inside lapply
Dear all I would like to ask you if an assignment can be done inside a lapply statement.
For example
I would like to covert a double nested for loop
for (i in c(1:dimx)){
for (j in c(1:dimy)){
Powermap[i,j] <- Pr(c(i,j),c(PRX,PRY),f)
}
}
to something like that:
ij<-expand.grid(i=seq(1:dimx),j=(1:dimy))
unlist(lapply(1:nrow(ij),function(rowId) { return
2008 Aug 26
4
sequence with start and stop positions
Hi,
I have a vector of start positions, and another vector of stop positions,
eg start<-c(1,20,50)
stop<-c(7,25,53)
Is there a quick way to create a sequence from these vectors?
new<-c(1,2,3,4,5,6,7,20,21,22,23,24,25,50,51,52,53)
the way Im doing it at the moment is
pos<-seq(start[1],stop[1])
for (i in 2:length(start)){
new<-seq(start[i],stop[i])
pos<-c(pos,new)
}
2012 Oct 26
1
matrix algebra for constructing a special matrix?
Dear R-users,
would it be a better way to construct the matrix below without using any for-loop or model.matrix? preferably with some matrix algebra?
Thanks in advance,
Carlo Giovanni Camarda
## dimensions
m <- 3
n <- 4
mn <- m*n
k <- m+n-1
## with a for-loop
X <- matrix(0, mn, k)
for(i in 1:n){
wr <- 1:m+(i-1)*m
wc <- rev(1:m+(i-1))
where <- cbind(wr,wc)
2010 Jun 03
1
plot polar coordinates
Hi,
I'd like to plot in in polar coordinates a line which is given as a
vector of lengths and angles.
library("plotrix")