Syntax error IGNORE 1 ROWS and selecting columns when loading csv [closed] - mariadb

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I am trying to upload a CSV file using the following syntax
LOAD DATA LOCAL INFILE 'C:\\Users\\file\\upload.csv' INTO TABLE customer
FIELDS TERMINATED BY ';'
LINES TERMINATED BY '\n'
IGNORE 1 ROWS
(#col1,#col2,#col3) SET
account_number=#col1,
customer=#col2,
customer_id=#col3
;
It works without the IGNORE 1 ROWS line.
Which is the right syntax to include IGNORE 1 ROWS in this case?

It looks like you are using MariaDB and not MySQL. The syntax IGNORE 1 ROWS is only supported by MySQL.
The syntax supported by both MySQL and MariaDB is IGNORE 1 LINES

Related

R cannot export all rows to csv [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 4 years ago.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Improve this question
Fundamental stuff but i couldn't seem to get around this. I performed the following process:
d1<-read.csv('hourly.csv',sep=",",header=F)
names(d1)<-c("date","rain","q","qa","qb")
d2<-read.csv('event.csv',sep=",",header=F)
names(d2)<-c("enum","st","et","rain2","qtot")
for(k in 1:206){
st<-d2[k,2]
et<-d2[k,3]
Datetime<-d1[st,]
print(Datetime)
write.csv(Datetime, file="DatesA3.csv")
}
In the end, i exported the results to a csv file. There are 206 rows altogether and they display fine in R. But when exporting, only the last row is exported in the csv file. I tried multiple things such at write.table, append, etc. but nothing seems to work.
How do i export every row into one file?
Please advise and thank you!
Datetime[k, ] <- d1[st, ] # instead, otherwise you overwrite
# and write the result outside the loop

Getting 'unknown symbol' error when using separate() in R [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
I have loaded a csv file into r called my_data. But some columns have multiple fields and I want to split them into separate new columns. When executing this command:
separate(data=my_data,col=totals,into=c("Visits" , "Hits", "Pageviews",
"TransactionRevenue", "NewVisits"),sep=”,”)
I get this error message:
Error: unexpected symbol in "separate(data=my_data,col=totals,into=c("Visits" , "Hits", "Pageviews", "TransactionRevenue”, "NewVisits"
I am trying to figure out what is wrong but with no success. Any help?
It looks like the sep= has smart quotes instead of straight quotes. Try changing it to
separate(data=my_data,col=totals,into=c("Visits" , "Hits", "Pageviews",
"TransactionRevenue", "NewVisits"),sep=",")

for loop in data frame in R [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
I am new in R and I would like to ask what is wrong in the following simple command. When i try:
for (k in 1:1){
logdata= logDataset[1:74+k,k]}
logdata collects the values from rows 2:75 of column 1 of the logDataset data frame. But when I use:
logdata=logDataset[1:75,1]
logdata collects correctly the first 75 values of the first column. Why the first command does not work as the second one? How can I use the "for" command for collecting the first 75 values of the first column? Many thanks.

Undefined Columns Selected (when using order function) [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
I have searched for answers to my question and can't seem to find any answer. I am trying to sort my data so that I can first sort by year of birth and then by last name. Here is my code:
ResidentsBD_99_2015_clean < ResidentsBD_99_2015_clean[order(ResidentsBD_99_2015_clean[, birthdate_year],
ResidentsBD_99_2015_clean[, "surname"],
decreasing = FALSE), ]
When I run this code, this is the error message that I recieve:
Error in `[.data.frame`(ResidentsBD_99_2015_clean, , birthdate_year) :
undefined columns selected
You might just be stuck with typos in your code. birthdate_year should be quoted. It also looks like you have a typo in the assign-operator (<-).
In a more general sense, I prefer ordering with dplyr.
library(dplyr)
ResidentsBD_99_2015_clean <- arrange(ResidentsBD_99_2015_clean, birthdate_year, surname)
From what I can see from your code, it might just be the missing - in the assignment and some small syntax problem. Try this:
ResidentsBD_99_2015_clean<- ResidentsBD_99_2015_clean[order(ResidentsBD_99_2015_clean$birthdate_year, ResidentsBD_99_2015_clean$surname),]

Excel messes up some dots (".") in a number [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 6 years ago.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Improve this question
I have a tab delimited file:
I created this file in R as a data.frame and wrote it to the above file using write.table(dataFrame,"filepath",row.names=FALSE). However after I opened this in excel I got some ##### in my excel file:
The only difference between the tab del file and the excel file is that in the excel file the . is omitted, but I don't have any idea how this is possible because most of the other numbers are just fine. Any suggestion to fix this problem is welcome.
Update
I can fit the data in the column:
However there should be a . after the 1
Probably your import settings are wrong regarding the seperation for thousands and decimals. Notice that the problem arises when the first number is >1. Excel interprets a number as a thousand if the first number is > 1 , because it woudln't make sense for excel to convert a number which begins with a 0 to a thousand. So you have to fix this:
You have to do this while importing the file in the last step, you have to click on Advanced and then set the Decimal seperator to: . and the Thousands seperator to: , (or visa versa, it's what you prefer offcourse but in your case it has to be this)

Resources